diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Support/Windows/Signals.inc | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
Diffstat (limited to 'lib/Support/Windows/Signals.inc')
| -rw-r--r-- | lib/Support/Windows/Signals.inc | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/Support/Windows/Signals.inc b/lib/Support/Windows/Signals.inc index 1ef51888baf3..21dd2dd13754 100644 --- a/lib/Support/Windows/Signals.inc +++ b/lib/Support/Windows/Signals.inc @@ -212,8 +212,14 @@ static StringRef Argv0; enum { #if defined(_M_X64) NativeMachineType = IMAGE_FILE_MACHINE_AMD64 -#else +#elif defined(_M_ARM64) + NativeMachineType = IMAGE_FILE_MACHINE_ARM64 +#elif defined(_M_IX86) NativeMachineType = IMAGE_FILE_MACHINE_I386 +#elif defined(_M_ARM) + NativeMachineType = IMAGE_FILE_MACHINE_ARMNT +#else + NativeMachineType = IMAGE_FILE_MACHINE_UNKNOWN #endif }; @@ -318,18 +324,18 @@ static void PrintStackTraceForThread(llvm::raw_ostream &OS, HANDLE hProcess, using namespace llvm; // Print the PC in hexadecimal. DWORD64 PC = StackFrame.AddrPC.Offset; -#if defined(_M_X64) +#if defined(_M_X64) || defined(_M_ARM64) OS << format("0x%016llX", PC); -#elif defined(_M_IX86) +#elif defined(_M_IX86) || defined(_M_ARM) OS << format("0x%08lX", static_cast<DWORD>(PC)); #endif // Print the parameters. Assume there are four. -#if defined(_M_X64) +#if defined(_M_X64) || defined(_M_ARM64) OS << format(" (0x%016llX 0x%016llX 0x%016llX 0x%016llX)", StackFrame.Params[0], StackFrame.Params[1], StackFrame.Params[2], StackFrame.Params[3]); -#elif defined(_M_IX86) +#elif defined(_M_IX86) || defined(_M_ARM) OS << format(" (0x%08lX 0x%08lX 0x%08lX 0x%08lX)", static_cast<DWORD>(StackFrame.Params[0]), static_cast<DWORD>(StackFrame.Params[1]), @@ -526,10 +532,14 @@ void llvm::sys::PrintStackTrace(raw_ostream &OS) { StackFrame.AddrPC.Offset = Context.Rip; StackFrame.AddrStack.Offset = Context.Rsp; StackFrame.AddrFrame.Offset = Context.Rbp; -#else +#elif defined(_M_IX86) StackFrame.AddrPC.Offset = Context.Eip; StackFrame.AddrStack.Offset = Context.Esp; StackFrame.AddrFrame.Offset = Context.Ebp; +#elif defined(_M_ARM64) || defined(_M_ARM) + StackFrame.AddrPC.Offset = Context.Pc; + StackFrame.AddrStack.Offset = Context.Sp; + StackFrame.AddrFrame.Offset = Context.Fp; #endif StackFrame.AddrPC.Mode = AddrModeFlat; StackFrame.AddrStack.Mode = AddrModeFlat; @@ -804,6 +814,13 @@ static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) { StackFrame.AddrStack.Mode = AddrModeFlat; StackFrame.AddrFrame.Offset = ep->ContextRecord->Ebp; StackFrame.AddrFrame.Mode = AddrModeFlat; +#elif defined(_M_ARM64) || defined(_M_ARM) + StackFrame.AddrPC.Offset = ep->ContextRecord->Pc; + StackFrame.AddrPC.Mode = AddrModeFlat; + StackFrame.AddrStack.Offset = ep->ContextRecord->Sp; + StackFrame.AddrStack.Mode = AddrModeFlat; + StackFrame.AddrFrame.Offset = ep->ContextRecord->Fp; + StackFrame.AddrFrame.Mode = AddrModeFlat; #endif HANDLE hProcess = GetCurrentProcess(); |
