[ARM64] UnhandledExceptionHandler ARM64 support (#17587)

* Rename UnhandledExceptionHandler_x64.h and InitUnhandledExceptionHandler_x64

* Added ARM64 registers to UnhandledExceptionHandler

* Added ARM64 registers to unhandled_exception_handler.cpp
This commit is contained in:
Jeremy Sinclair
2022-04-08 05:19:42 -04:00
committed by GitHub
parent 5dd9049810
commit f778d010e5
9 changed files with 41 additions and 18 deletions

View File

@@ -82,18 +82,30 @@ void log_stack_trace(std::wstring& generalErrorDescription)
auto thread = GetCurrentThread();
STACKFRAME64 stack;
memset(&stack, 0, sizeof(STACKFRAME64));
#ifdef _M_ARM64
stack.AddrPC.Offset = context.Pc;
stack.AddrStack.Offset = context.Sp;
stack.AddrFrame.Offset = context.Fp;
#else
stack.AddrPC.Offset = context.Rip;
stack.AddrPC.Mode = AddrModeFlat;
stack.AddrStack.Offset = context.Rsp;
stack.AddrStack.Mode = AddrModeFlat;
stack.AddrFrame.Offset = context.Rbp;
#endif
stack.AddrPC.Mode = AddrModeFlat;
stack.AddrStack.Mode = AddrModeFlat;
stack.AddrFrame.Mode = AddrModeFlat;
std::wstringstream ss;
ss << generalErrorDescription << std::endl;
for (ULONG frame = 0;; frame++)
{
auto result = StackWalk64(IMAGE_FILE_MACHINE_AMD64,
auto result = StackWalk64(
#ifdef _M_ARM64
IMAGE_FILE_MACHINE_ARM64,
#else
IMAGE_FILE_MACHINE_AMD64,
#endif
process,
thread,
&stack,