forked from mirrors/gecko-dev
Bug 1485716 - part 2 - add aarch64 windows support to the stack walking code; r=aklotz
This code is untested and has been cargo-culted a little bit from the existing x86 code, but should work OK; all the code in Windows is compiled with frame pointers, we're compiled with frame pointers after the previous patch, and so the frame pointer unwinding path makes the most sense.
This commit is contained in:
parent
c1c5987ee2
commit
b8909530ab
2 changed files with 11 additions and 4 deletions
|
|
@ -207,7 +207,7 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||
context = aData->context;
|
||||
}
|
||||
|
||||
#if defined(_M_IX86) || defined(_M_IA64)
|
||||
#if defined(_M_IX86) || defined(_M_IA64) || defined(_M_ARM64)
|
||||
// Setup initial stack frame to walk from.
|
||||
STACKFRAME64 frame64;
|
||||
memset(&frame64, 0, sizeof(frame64));
|
||||
|
|
@ -219,6 +219,10 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||
frame64.AddrPC.Offset = context->StIIP;
|
||||
frame64.AddrStack.Offset = context->SP;
|
||||
frame64.AddrFrame.Offset = context->RsBSP;
|
||||
#elif defined _M_ARM64
|
||||
frame64.AddrPC.Offset = context->Pc;
|
||||
frame64.AddrStack.Offset = context->Sp;
|
||||
frame64.AddrFrame.Offset = context->Fp;
|
||||
#endif
|
||||
frame64.AddrPC.Mode = AddrModeFlat;
|
||||
frame64.AddrStack.Mode = AddrModeFlat;
|
||||
|
|
@ -226,7 +230,7 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||
frame64.AddrReturn.Mode = AddrModeFlat;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#ifdef _M_AMD64
|
||||
// If there are any active suppressions, then at least one thread (we don't
|
||||
// know which) is holding a lock that can deadlock RtlVirtualUnwind. Since
|
||||
// that thread may be the one that we're trying to unwind, we can't proceed.
|
||||
|
|
@ -254,7 +258,7 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||
DWORD64 addr;
|
||||
DWORD64 spaddr;
|
||||
|
||||
#if defined(_M_IX86) || defined(_M_IA64)
|
||||
#if defined(_M_IX86) || defined(_M_IA64) || defined(_M_ARM64)
|
||||
// 32-bit frame unwinding.
|
||||
// Debug routines are not threadsafe, so grab the lock.
|
||||
EnterCriticalSection(&gDbgHelpCS);
|
||||
|
|
@ -263,6 +267,8 @@ WalkStackMain64(struct WalkStackData* aData)
|
|||
IMAGE_FILE_MACHINE_IA64,
|
||||
#elif defined _M_IX86
|
||||
IMAGE_FILE_MACHINE_I386,
|
||||
#elif defined _M_ARM64
|
||||
IMAGE_FILE_MACHINE_ARM64,
|
||||
#endif
|
||||
aData->process,
|
||||
aData->thread,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ MozStackWalk(MozWalkStackCallback aCallback, uint32_t aSkipFrames,
|
|||
uint32_t aMaxFrames, void* aClosure);
|
||||
|
||||
#if defined(_WIN32) && \
|
||||
(defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64))
|
||||
(defined(_M_IX86) || defined(_M_AMD64) || \
|
||||
defined(_M_IA64) || defined(_M_ARM64))
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue