[llvm] r310001 - Support: WOA64 and WOA Signals

Martell Malone via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 16:12:33 PDT 2017


Author: martell
Date: Thu Aug  3 16:12:33 2017
New Revision: 310001

URL: http://llvm.org/viewvc/llvm-project?rev=310001&view=rev
Log:
Support: WOA64 and WOA Signals

Reviewers: rnk

Differential Revision: https://reviews.llvm.org/D21813

Modified:
    llvm/trunk/lib/Support/Windows/Signals.inc

Modified: llvm/trunk/lib/Support/Windows/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Signals.inc?rev=310001&r1=310000&r2=310001&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Signals.inc (original)
+++ llvm/trunk/lib/Support/Windows/Signals.inc Thu Aug  3 16:12:33 2017
@@ -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(llv
     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_ostr
   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 LLVMUnhandledExceptio
   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();




More information about the llvm-commits mailing list