#include "base/profiler/stack_copier_signal.h"
#include <errno.h>
#include <linux/futex.h>
#include <signal.h>
#include <stdint.h>
#include <sys/ucontext.h>
#include <syscall.h>
#include <atomic>
#include <cstring>
#include <optional>
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ptr_exclusion.h"
#include "base/notreached.h"
#include "base/profiler/register_context.h"
#include "base/profiler/stack_buffer.h"
#include "base/profiler/suspendable_thread_delegate.h"
#include "base/time/time_override.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
namespace base {
namespace {
class AsyncSafeWaitableEvent { … };
class ScopedEventSignaller { … };
struct HandlerParams { … };
std::atomic<HandlerParams*> g_handler_params;
void CopyStackSignalHandler(int n, siginfo_t* siginfo, void* sigcontext) { … }
class ScopedSetSignalHandlerParams { … };
class ScopedSigaction { … };
}
StackCopierSignal::StackCopierSignal(
std::unique_ptr<ThreadDelegate> thread_delegate)
: … { … }
StackCopierSignal::~StackCopierSignal() = default;
bool StackCopierSignal::CopyStack(StackBuffer* stack_buffer,
uintptr_t* stack_top,
TimeTicks* timestamp,
RegisterContext* thread_context,
Delegate* delegate) { … }
std::vector<uintptr_t*> StackCopierSignal::GetRegistersToRewrite(
RegisterContext* thread_context) { … }
}