Fixes to make the lldb plugin work on ARM64 (dotnet/coreclr#9216)
authorFrederik Carlier <frederik.carlier@quamotion.mobi>
Wed, 1 Feb 2017 01:09:57 +0000 (02:09 +0100)
committerJan Vorlicek <janvorli@microsoft.com>
Wed, 1 Feb 2017 01:09:57 +0000 (02:09 +0100)
* Fixes to make the lldb plugin work on ARM64

Commit migrated from https://github.com/dotnet/coreclr/commit/abb186f739508be16c4bf51a54804aa2b302bc73

src/coreclr/src/ToolBox/SOS/Strike/exts.cpp
src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp
src/coreclr/src/debug/daccess/datatargetadapter.cpp

index 0b1f976..566ba35 100644 (file)
@@ -111,30 +111,29 @@ ArchQuery(void)
     {
         targetMachine = AMD64Machine::GetInstance();
     }
-#endif // SOS_TARGET_AMD64
-#ifdef SOS_TARGET_X86
+#elif defined(SOS_TARGET_X86)
     if (targetArchitecture == IMAGE_FILE_MACHINE_I386)
     {
         targetMachine = X86Machine::GetInstance();
     }
-#endif // SOS_TARGET_X86
-#ifdef SOS_TARGET_ARM
+#elif defined(SOS_TARGET_ARM)
     if (targetArchitecture == IMAGE_FILE_MACHINE_ARMNT)
     {
         targetMachine = ARMMachine::GetInstance();
     }
-#endif // SOS_TARGET_ARM
-#ifdef SOS_TARGET_ARM64
+#elif defined(SOS_TARGET_ARM64)
     if (targetArchitecture == IMAGE_FILE_MACHINE_ARM64)
     {
         targetMachine = ARM64Machine::GetInstance();
     }
-#endif // SOS_TARGET_ARM64
+#else
+#error "Undefined target architecture"
+#endif
 
     if (targetMachine == NULL)
     {
         g_targetMachine = NULL;
-        ExtErr("SOS does not support the current target architecture.\n");
+        ExtErr("SOS does not support the current target architecture 0x%llx.\n", targetArchitecture);
         return E_FAIL;
     }
 
index 16702b1..4817e81 100644 (file)
@@ -81,6 +81,7 @@ extern "C" {
 #define IMAGE_FILE_MACHINE_I386              0x014c  // Intel 386.
 #define IMAGE_FILE_MACHINE_ARMNT             0x01c4  // ARM Thumb-2 Little-Endian
 #define IMAGE_FILE_MACHINE_AMD64             0x8664  // AMD64 (K8)
+#define IMAGE_FILE_MACHINE_ARM64             0xAA64  // ARM64 Little-Endian
 
 // Execution status codes used for waiting,
 // for returning current status and for
index d05a5e2..3b235ba 100644 (file)
@@ -411,6 +411,10 @@ LLDBServices::GetExecutingProcessorType(
     *type = IMAGE_FILE_MACHINE_AMD64;
 #elif DBG_TARGET_ARM
     *type = IMAGE_FILE_MACHINE_ARMNT;
+#elif DBG_TARGET_ARM64
+    *type = IMAGE_FILE_MACHINE_ARM64;
+#else
+#error "Unsupported target"
 #endif
     return S_OK;
 }
index f2a1cc6..4d4031d 100644 (file)
@@ -127,8 +127,12 @@ DataTargetAdapter::GetPlatform(
         platform = CORDB_PLATFORM_POSIX_ARM;
         break;
 
-    case IMAGE_FILE_MACHINE_IA64:
     case IMAGE_FILE_MACHINE_ARM64:
+        ulExpectedPointerSize = 8;
+        platform = CORDB_PLATFORM_POSIX_ARM64;
+       break;
+
+    case IMAGE_FILE_MACHINE_IA64:
         _ASSERTE_MSG(false, "Not supported platform.");
         return E_NOTIMPL;