From 0574721f1e8aaf84db5d5752c85e4b1ef20a90fd Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Mon, 30 Jan 2017 17:52:12 +0100 Subject: [PATCH] Support building lldbplugin on ARM64 (dotnet/coreclr#9195) Commit migrated from https://github.com/dotnet/coreclr/commit/8fc684957641c2984ec66d8e92eb3d326f986dba --- src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt | 7 +++++-- src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp | 4 ++++ src/coreclr/src/debug/inc/dbgtargetcontext.h | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt index 6b3bad1..29b36e8 100644 --- a/src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt +++ b/src/coreclr/src/ToolBox/SOS/lldbplugin/CMakeLists.txt @@ -30,8 +30,11 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_ARM) add_definitions(-DDBG_TARGET_32BIT=1) add_definitions(-DDBG_TARGET_ARM=1) elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64) - message(WARNING "lldb is not supported on linux/aarch64 yet") - return() + add_definitions(-D_TARGET_ARM64_=1) + add_definitions(-DDBG_TARGET_64BIT=1) + add_definitions(-DDBG_TARGET_ARM64=1) + add_definitions(-DDBG_TARGET_WIN64=1) + add_definitions(-DBIT64) endif() set(ENABLE_LLDBPLUGIN ${CLR_CMAKE_PLATFORM_UNIX} CACHE BOOL "Enable building the SOS plugin for LLDB.") diff --git a/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp b/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp index d2d2cf9..d05a5e2 100644 --- a/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp +++ b/src/coreclr/src/ToolBox/SOS/lldbplugin/services.cpp @@ -171,6 +171,10 @@ LLDBServices::VirtualUnwind( DWORD spToFind = dtcontext->Esp; #elif DBG_TARGET_ARM DWORD spToFind = dtcontext->Sp; +#elif DBG_TARGET_ARM64 + DWORD64 spToFind = dtcontext->Sp; +#else +#error "spToFind undefined for this platform" #endif int numFrames = thread.GetNumFrames(); diff --git a/src/coreclr/src/debug/inc/dbgtargetcontext.h b/src/coreclr/src/debug/inc/dbgtargetcontext.h index 22b1c84..c2b45ee 100644 --- a/src/coreclr/src/debug/inc/dbgtargetcontext.h +++ b/src/coreclr/src/debug/inc/dbgtargetcontext.h @@ -371,6 +371,14 @@ typedef DECLSPEC_ALIGN(8) struct { #define DT_CONTEXT_FULL (DT_CONTEXT_CONTROL | DT_CONTEXT_INTEGER | DT_CONTEXT_FLOATING_POINT) #define DT_CONTEXT_ALL (DT_CONTEXT_CONTROL | DT_CONTEXT_INTEGER | DT_CONTEXT_FLOATING_POINT | DT_CONTEXT_DEBUG_REGISTERS) +#define DT_ARM64_MAX_BREAKPOINTS 8 +#define DT_ARM64_MAX_WATCHPOINTS 2 + +typedef struct { + ULONGLONG Low; + LONGLONG High; +} DT_NEON128; + typedef DECLSPEC_ALIGN(16) struct { // // Control flags. @@ -426,7 +434,7 @@ typedef DECLSPEC_ALIGN(16) struct { // Floating Point/NEON Registers // - /* +0x110 */ NEON128 V[32]; + /* +0x110 */ DT_NEON128 V[32]; /* +0x310 */ DWORD Fpcr; /* +0x314 */ DWORD Fpsr; @@ -434,10 +442,10 @@ typedef DECLSPEC_ALIGN(16) struct { // Debug registers // - /* +0x318 */ DWORD Bcr[ARM64_MAX_BREAKPOINTS]; - /* +0x338 */ DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; - /* +0x378 */ DWORD Wcr[ARM64_MAX_WATCHPOINTS]; - /* +0x380 */ DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; + /* +0x318 */ DWORD Bcr[DT_ARM64_MAX_BREAKPOINTS]; + /* +0x338 */ DWORD64 Bvr[DT_ARM64_MAX_BREAKPOINTS]; + /* +0x378 */ DWORD Wcr[DT_ARM64_MAX_WATCHPOINTS]; + /* +0x380 */ DWORD64 Wvr[DT_ARM64_MAX_WATCHPOINTS]; /* +0x390 */ } DT_CONTEXT; -- 2.7.4