From d200b780d5a61f237010a5ca43c8bb029f9ce5a1 Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Wed, 1 Feb 2017 02:09:57 +0100 Subject: [PATCH] Fixes to make the lldb plugin work on ARM64 (dotnet/coreclr#9216) * 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 | 15 +++++++-------- src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h | 1 + src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp | 4 ++++ src/coreclr/src/debug/daccess/datatargetadapter.cpp | 6 +++++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/ToolBox/SOS/Strike/exts.cpp b/src/coreclr/src/ToolBox/SOS/Strike/exts.cpp index 0b1f976..566ba35 100644 --- a/src/coreclr/src/ToolBox/SOS/Strike/exts.cpp +++ b/src/coreclr/src/ToolBox/SOS/Strike/exts.cpp @@ -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; } diff --git a/src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h b/src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h index 16702b1..4817e81 100644 --- a/src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h +++ b/src/coreclr/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h @@ -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 diff --git a/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp b/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp index d05a5e2..3b235ba 100644 --- a/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp +++ b/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp @@ -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; } diff --git a/src/coreclr/src/debug/daccess/datatargetadapter.cpp b/src/coreclr/src/debug/daccess/datatargetadapter.cpp index f2a1cc6..4d4031d 100644 --- a/src/coreclr/src/debug/daccess/datatargetadapter.cpp +++ b/src/coreclr/src/debug/daccess/datatargetadapter.cpp @@ -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; -- 2.7.4