Bug 1658424 - add support for grabbing fp on arm64 macOS in DMD; r=mccr8

This code just cribs from the profiler's code and has not been tested.

Differential Revision: https://phabricator.services.mozilla.com/D86647
This commit is contained in:
Nathan Froyd 2020-08-11 14:09:28 +00:00
parent eca436fc65
commit 92a3a92555

View File

@ -653,10 +653,16 @@ static uint32_t gGCStackTraceTableWhenSizeExceeds = 4 * 1024;
// FramePointerStackWalk() on Mac: Registers::SyncPopulate() for the frame
// pointer, and GetStackTop() for the stack end.
void** fp;
# if defined(__x86_64__)
asm(
// Dereference %rbp to get previous %rbp
"movq (%%rbp), %0\n\t"
: "=r"(fp));
# else
asm(
"ldr %0, [x29]\n\t"
: "=r"(fp));
# endif
void* stackEnd = pthread_get_stackaddr_np(pthread_self());
FramePointerStackWalk(StackWalkCallback, /* skipFrames = */ 0, MaxFrames,
&tmp, fp, stackEnd);