summaryrefslogtreecommitdiff
path: root/src/ToolBox
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2016-04-26 16:56:44 -0700
committerMike McLaughlin <mikem@microsoft.com>2016-04-26 16:56:44 -0700
commit18268beae931cbd4d110959ea53d785b193eceb1 (patch)
treefcd31d7e4b373c2d60c58bf51edc07952712039c /src/ToolBox
parent3fbfb5eb51c87dbdeb0014492279deabf14411aa (diff)
parent8c808737cacc0a361186022a25915701b64c7ab4 (diff)
downloadcoreclr-18268beae931cbd4d110959ea53d785b193eceb1.tar.gz
coreclr-18268beae931cbd4d110959ea53d785b193eceb1.tar.bz2
coreclr-18268beae931cbd4d110959ea53d785b193eceb1.zip
Merge pull request #4502 from seanshpark/arm_sos_with_lldb38
ARM, SOS: Fix libsos.so load fail and changes for SOS to work with ARM-Linux
Diffstat (limited to 'src/ToolBox')
-rw-r--r--src/ToolBox/PdbTypeMatch/PdbTypeMatch.cpp1
-rw-r--r--src/ToolBox/SOS/Strike/CMakeLists.txt1
-rw-r--r--src/ToolBox/SOS/Strike/datatarget.cpp7
-rw-r--r--src/ToolBox/SOS/Strike/disasm.h7
-rw-r--r--src/ToolBox/SOS/Strike/disasmARM.cpp16
-rw-r--r--src/ToolBox/SOS/Strike/util.cpp2
-rw-r--r--src/ToolBox/SOS/lldbplugin/inc/lldbservices.h1
-rw-r--r--src/ToolBox/SOS/lldbplugin/services.cpp4
8 files changed, 31 insertions, 8 deletions
diff --git a/src/ToolBox/PdbTypeMatch/PdbTypeMatch.cpp b/src/ToolBox/PdbTypeMatch/PdbTypeMatch.cpp
index 08118452e7..052e9e0d1d 100644
--- a/src/ToolBox/PdbTypeMatch/PdbTypeMatch.cpp
+++ b/src/ToolBox/PdbTypeMatch/PdbTypeMatch.cpp
@@ -458,6 +458,7 @@ bool LoadDataFromPdb(
case IMAGE_FILE_MACHINE_I386 : g_dwMachineType = CV_CFL_80386; break;
case IMAGE_FILE_MACHINE_IA64 : g_dwMachineType = CV_CFL_IA64; break;
case IMAGE_FILE_MACHINE_AMD64 : g_dwMachineType = CV_CFL_AMD64; break;
+ case IMAGE_FILE_MACHINE_ARMNT : g_dwMachineType = CV_CFL_ARM7; break;
}
}
diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt
index 36893b1e42..88089c6193 100644
--- a/src/ToolBox/SOS/Strike/CMakeLists.txt
+++ b/src/ToolBox/SOS/Strike/CMakeLists.txt
@@ -28,6 +28,7 @@ elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
add_definitions(-DSOS_TARGET_ARM=1)
add_definitions(-D_TARGET_WIN32_=1)
+ add_definitions(-D_TARGET_ARM_=1)
add_definitions(-DDBG_TARGET_32BIT)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-DSOS_TARGET_ARM64=1)
diff --git a/src/ToolBox/SOS/Strike/datatarget.cpp b/src/ToolBox/SOS/Strike/datatarget.cpp
index 869ae674ab..0e981dd537 100644
--- a/src/ToolBox/SOS/Strike/datatarget.cpp
+++ b/src/ToolBox/SOS/Strike/datatarget.cpp
@@ -81,7 +81,14 @@ HRESULT STDMETHODCALLTYPE
DataTarget::GetPointerSize(
/* [out] */ ULONG32 *size)
{
+#if defined(SOS_TARGET_AMD64) || defined(SOS_TARGET_ARM64)
*size = 8;
+#elif defined(SOS_TARGET_ARM)
+ *size = 4;
+#elif
+ #error Unsupported architecture
+#endif
+
return S_OK;
}
diff --git a/src/ToolBox/SOS/Strike/disasm.h b/src/ToolBox/SOS/Strike/disasm.h
index d3c13fee3f..6972c39ccb 100644
--- a/src/ToolBox/SOS/Strike/disasm.h
+++ b/src/ToolBox/SOS/Strike/disasm.h
@@ -108,9 +108,9 @@ eTargetType GetFinalTarget(DWORD_PTR callee, DWORD_PTR* finalMDorIP);
//-----------------------------------------------------------------------------------------
#ifndef THUMB_CODE
-#define THUMB_CODE 1;
+#define THUMB_CODE 1
#endif
-#define STACKWALK_CONTROLPC_ADJUST_OFFSET 2;
+#define STACKWALK_CONTROLPC_ADJUST_OFFSET 2
#ifdef SOS_TARGET_X86
@@ -186,7 +186,7 @@ public:
typedef ARM_CONTEXT TGT_CTXT;
static IMachine* GetInstance()
- { static ARMMachine s_ARMMachineInstance; return &s_ARMMachineInstance; }
+ { return &s_ARMMachineInstance; }
ULONG GetPlatform() const { return IMAGE_FILE_MACHINE_ARMNT; }
ULONG GetContextSize() const { return sizeof(ARM_CONTEXT); }
@@ -238,6 +238,7 @@ private:
static LPCSTR s_DSOHeading;
static LPCSTR s_GCRegs[14];
static LPCSTR s_SPName;
+ static ARMMachine s_ARMMachineInstance;
}; // class ARMMachine
#endif // SOS_TARGET_ARM
diff --git a/src/ToolBox/SOS/Strike/disasmARM.cpp b/src/ToolBox/SOS/Strike/disasmARM.cpp
index acdd633d4a..80dce71890 100644
--- a/src/ToolBox/SOS/Strike/disasmARM.cpp
+++ b/src/ToolBox/SOS/Strike/disasmARM.cpp
@@ -48,6 +48,8 @@ namespace ARMGCDump
#error This file should be used to support SOS targeting ARM debuggees
#endif
+#ifdef SOS_TARGET_ARM
+ARMMachine ARMMachine::s_ARMMachineInstance;
// Decodes the target label of the immediate form of bl and blx instructions. The PC given is that of the
// start of the instruction.
@@ -334,6 +336,8 @@ static void HandleValue(TADDR value)
}
}
+#endif // !FEATURE_PAL
+
/**********************************************************************\
* Routine Description: *
* *
@@ -351,6 +355,7 @@ void ARMMachine::Unassembly (
BOOL bSuppressLines,
BOOL bDisplayOffsets) const
{
+#ifndef FEATURE_PAL
ULONG_PTR PC = PCBegin;
char line[1024];
char *ptr;
@@ -524,11 +529,12 @@ void ARMMachine::Unassembly (
ExtOut ("\n");
}
+#endif // !FEATURE_PAL
}
+#if 0 // @ARMTODO: Figure out how to extract this information under CoreARM
static void ExpFuncStateInit (TADDR *PCRetAddr)
{
-#if 0 // @ARMTODO: Figure out how to extract this information under CoreARM
ULONG64 offset;
if (FAILED(g_ExtSymbols->GetOffsetByName("ntdll!KiUserExceptionDispatcher", &offset))) {
return;
@@ -541,10 +547,9 @@ static void ExpFuncStateInit (TADDR *PCRetAddr)
PCRetAddr[i++] = (TADDR)offset;
}
}
-#endif // 0
}
+#endif // 0
-#endif // !FEATURE_PAL
// @ARMTODO: Figure out how to extract this information under CoreARM
BOOL ARMMachine::GetExceptionContext (TADDR stack, TADDR PC, TADDR *cxrAddr, CROSS_PLATFORM_CONTEXT * cxr,
@@ -598,13 +603,13 @@ BOOL ARMMachine::GetExceptionContext (TADDR stack, TADDR PC, TADDR *cxrAddr, CRO
#endif // 0
}
-#ifndef FEATURE_PAL
///
/// Dump ARM GCInfo table
///
void ARMMachine::DumpGCInfo(BYTE* pTable, unsigned methodSize, printfFtn gcPrintf, bool encBytes, bool bPrintHeader) const
{
+#ifndef FEATURE_PAL
if (bPrintHeader)
{
ExtOut("Pointer table:\n");
@@ -614,6 +619,7 @@ void ARMMachine::DumpGCInfo(BYTE* pTable, unsigned methodSize, printfFtn gcPrint
gcDump.gcPrintf = gcPrintf;
gcDump.DumpGCTable(pTable, methodSize, 0);
+#endif // !FEATURE_PAL
}
-#endif // !FEATURE_PAL
+#endif // SOS_TARGET_ARM
diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp
index 3285be4c98..b902aa13a5 100644
--- a/src/ToolBox/SOS/Strike/util.cpp
+++ b/src/ToolBox/SOS/Strike/util.cpp
@@ -4548,6 +4548,8 @@ public:
*pPlatform = CORDB_PLATFORM_POSIX_X86;
else if(platformKind == IMAGE_FILE_MACHINE_AMD64)
*pPlatform = CORDB_PLATFORM_POSIX_AMD64;
+ else if(platformKind == IMAGE_FILE_MACHINE_ARMNT)
+ *pPlatform = CORDB_PLATFORM_POSIX_ARM;
else
return E_FAIL;
#else
diff --git a/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h b/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
index 925b6c4327..6c713141f3 100644
--- a/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
+++ b/src/ToolBox/SOS/lldbplugin/inc/lldbservices.h
@@ -68,6 +68,7 @@ extern "C" {
#define DEBUG_CLASS_IMAGE_FILE 3
#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)
// Execution status codes used for waiting,
diff --git a/src/ToolBox/SOS/lldbplugin/services.cpp b/src/ToolBox/SOS/lldbplugin/services.cpp
index 21d1a2c13c..f6b42139c4 100644
--- a/src/ToolBox/SOS/lldbplugin/services.cpp
+++ b/src/ToolBox/SOS/lldbplugin/services.cpp
@@ -401,7 +401,11 @@ HRESULT
LLDBServices::GetExecutingProcessorType(
PULONG type)
{
+#ifdef DBG_TARGET_AMD64
*type = IMAGE_FILE_MACHINE_AMD64;
+#elif DBG_TARGET_ARM
+ *type = IMAGE_FILE_MACHINE_ARMNT;
+#endif
return S_OK;
}