9#if defined(DART_HOST_OS_LINUX)
16#if defined(HOST_ARCH_IA32)
17 pc =
static_cast<uintptr_t
>(mcontext.gregs[REG_EIP]);
18#elif defined(HOST_ARCH_X64)
19 pc =
static_cast<uintptr_t
>(mcontext.gregs[REG_RIP]);
20#elif defined(HOST_ARCH_ARM)
21 pc =
static_cast<uintptr_t
>(mcontext.arm_pc);
22#elif defined(HOST_ARCH_ARM64)
23 pc =
static_cast<uintptr_t
>(mcontext.pc);
24#elif defined(HOST_ARCH_RISCV32)
25 pc =
static_cast<uintptr_t
>(mcontext.__gregs[REG_PC]);
26#elif defined(HOST_ARCH_RISCV64)
27 pc =
static_cast<uintptr_t
>(mcontext.__gregs[REG_PC]);
29#error Unsupported architecture.
37#if defined(HOST_ARCH_IA32)
38 fp =
static_cast<uintptr_t
>(mcontext.gregs[REG_EBP]);
39#elif defined(HOST_ARCH_X64)
40 fp =
static_cast<uintptr_t
>(mcontext.gregs[REG_RBP]);
41#elif defined(HOST_ARCH_ARM)
43 if ((mcontext.arm_cpsr & (1 << 5)) != 0) {
45 fp =
static_cast<uintptr_t
>(mcontext.arm_r7);
48 fp =
static_cast<uintptr_t
>(mcontext.arm_fp);
50#elif defined(HOST_ARCH_ARM64)
51 fp =
static_cast<uintptr_t
>(mcontext.regs[29]);
52#elif defined(HOST_ARCH_RISCV32)
53 fp =
static_cast<uintptr_t
>(mcontext.__gregs[REG_S0]);
54#elif defined(HOST_ARCH_RISCV64)
55 fp =
static_cast<uintptr_t
>(mcontext.__gregs[REG_S0]);
57#error Unsupported architecture.
66#if defined(HOST_ARCH_IA32)
67 sp =
static_cast<uintptr_t
>(mcontext.gregs[REG_ESP]);
68#elif defined(HOST_ARCH_X64)
69 sp =
static_cast<uintptr_t
>(mcontext.gregs[REG_RSP]);
70#elif defined(HOST_ARCH_ARM)
71 sp =
static_cast<uintptr_t
>(mcontext.arm_sp);
72#elif defined(HOST_ARCH_ARM64)
73 sp =
static_cast<uintptr_t
>(mcontext.sp);
74#elif defined(HOST_ARCH_RISCV32)
75 sp =
static_cast<uintptr_t
>(mcontext.__gregs[REG_SP]);
76#elif defined(HOST_ARCH_RISCV64)
77 sp =
static_cast<uintptr_t
>(mcontext.__gregs[REG_SP]);
79#error Unsupported architecture.
85#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR)
86 return static_cast<uintptr_t
>(mcontext.regs[
SPREG]);
95#if defined(HOST_ARCH_IA32)
97#elif defined(HOST_ARCH_X64)
99#elif defined(HOST_ARCH_ARM)
100 lr =
static_cast<uintptr_t
>(mcontext.arm_lr);
101#elif defined(HOST_ARCH_ARM64)
102 lr =
static_cast<uintptr_t
>(mcontext.regs[30]);
103#elif defined(HOST_ARCH_RISCV32)
104 lr =
static_cast<uintptr_t
>(mcontext.__gregs[REG_RA]);
105#elif defined(HOST_ARCH_RISCV64)
106 lr =
static_cast<uintptr_t
>(mcontext.__gregs[REG_RA]);
108#error Unsupported architecture.
114 struct sigaction act = {};
115 act.sa_handler =
nullptr;
116 act.sa_sigaction =
action;
117 sigemptyset(&act.sa_mask);
118 sigaddset(&act.sa_mask, SIGPROF);
119 act.sa_flags = SA_RESTART | SA_SIGINFO;
120 int r = sigaction(SIGPROF, &act,
nullptr);
127 struct sigaction act = {};
128 act.sa_handler = SIG_IGN;
129 sigemptyset(&act.sa_mask);
131 int r = sigaction(SIGPROF, &act,
nullptr);
static uintptr_t GetDartStackPointer(const mcontext_t &mcontext)
static uintptr_t GetCStackPointer(const mcontext_t &mcontext)
static uintptr_t GetFramePointer(const mcontext_t &mcontext)
static uintptr_t GetProgramCounter(const mcontext_t &mcontext)
static void Install(SignalAction action)
static uintptr_t GetLinkRegister(const mcontext_t &mcontext)
void(* SignalAction)(int signal, siginfo_t *info, void *context)