#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <string.h>
#include <algorithm>
#include <utility>
#include "base/debug/alias.h"
#include "base/profiler/sampling_profiler_thread_token.h"
#include "base/profiler/stack_buffer.h"
#include "base/profiler/stack_copier_signal.h"
#include "base/profiler/thread_delegate_posix.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
#include "base/threading/simple_thread.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
static const uint32_t kStackSentinels[] = …;
class TargetThread : public SimpleThread { … };
class TestStackCopierDelegate : public StackCopier::Delegate { … };
}
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
defined(THREAD_SANITIZER)
#define MAYBE_CopyStack …
#elif BUILDFLAG(IS_LINUX)
#define MAYBE_CopyStack …
#else
#define MAYBE_CopyStack …
#endif
TEST(StackCopierSignalTest, MAYBE_CopyStack) { … }
#if defined(THREAD_SANITIZER)
#define MAYBE_CopyStackTimestamp …
#elif BUILDFLAG(IS_LINUX)
#define MAYBE_CopyStackTimestamp …
#else
#define MAYBE_CopyStackTimestamp …
#endif
TEST(StackCopierSignalTest, MAYBE_CopyStackTimestamp) { … }
#if defined(THREAD_SANITIZER)
#define MAYBE_CopyStackDelegateInvoked …
#elif BUILDFLAG(IS_LINUX)
#define MAYBE_CopyStackDelegateInvoked …
#else
#define MAYBE_CopyStackDelegateInvoked …
#endif
TEST(StackCopierSignalTest, MAYBE_CopyStackDelegateInvoked) { … }
#if !(BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_32_BITS))
#define MAYBE_CopyStackFromOtherThread …
#elif BUILDFLAG(IS_LINUX)
#define MAYBE_CopyStackFromOtherThread …
#else
#define MAYBE_CopyStackFromOtherThread …
#endif
TEST(StackCopierSignalTest, MAYBE_CopyStackFromOtherThread) { … }
}