summaryrefslogtreecommitdiff
path: root/src/ToolBox
diff options
context:
space:
mode:
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>2017-10-05 11:31:44 +0300
committerJan Vorlicek <janvorli@microsoft.com>2017-10-05 10:31:44 +0200
commitde4daccc1ea52ddc1ae8ac9e48cde603c507b868 (patch)
treec8bf3f40f838811fd4410123fc3e869dc4475cde /src/ToolBox
parentd0baa73f54eb0f7eba1364e207c02afa984760cb (diff)
downloadcoreclr-de4daccc1ea52ddc1ae8ac9e48cde603c507b868.tar.gz
coreclr-de4daccc1ea52ddc1ae8ac9e48cde603c507b868.tar.bz2
coreclr-de4daccc1ea52ddc1ae8ac9e48cde603c507b868.zip
[x86/Linux][SOS] Fix clrstack command of lldb sosplugin on x86 (#13973)
* [x86/Linux][SOS] Add support for x86 in GetContextFromFrame It's need for 'clrstack -f' command of SOS plugin on x86. * [x86/Linux] Fix RtlpGetFunctionEndAddress function We should use PTR_UNWIND_INFO instead of PUNWIND_INFO for pointer to UNWIND_INFO structure because it's pointer from other process and we need to use DAC to read data using it. * [x86/Linux][SOS] Define DEBUG_STACK_CONTEXT for x86 It's needed for 'clrstack -f' command in libsosplugin. * [x86/Linux] Fix undefined references in libmscordbi.so on x86 Asm block like following: __asm fnsave currentFPUState where currentFPUState is structure works with MSVC but leads to undefined reference currentFPUState in the binary with other compilers. So rewrite such asm blocks for them. This patch fixes error "Unable to load 'libmscordbi.so'" during execution of 'clrstack -f' command of SOS plugin on x86. * [x86/Linux] Fix calling convention inconsistency WINAPI and STDAPI are defined as __cdecl but in some cases functions with these attributes are called using stdcall calling convention. It leads to crashes during execution of 'clrstack -i' command of SOS plugin on x86.
Diffstat (limited to 'src/ToolBox')
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp4
-rw-r--r--src/ToolBox/SOS/lldbplugin/services.cpp19
2 files changed, 22 insertions, 1 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index 6963cffe29..5ab45d5dca 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -324,7 +324,9 @@ DECLARE_API(IP2MD)
#define DEBUG_STACK_CONTEXT AMD64_CONTEXT
#elif defined(_TARGET_ARM_) // _TARGET_WIN64_
#define DEBUG_STACK_CONTEXT ARM_CONTEXT
-#endif // _TARGET_ARM_
+#elif defined(_TARGET_X86_) // _TARGET_ARM_
+#define DEBUG_STACK_CONTEXT X86_CONTEXT
+#endif // _TARGET_X86_
#ifdef DEBUG_STACK_CONTEXT
// I use a global set of frames for stack walking on win64 because the debugger's
diff --git a/src/ToolBox/SOS/lldbplugin/services.cpp b/src/ToolBox/SOS/lldbplugin/services.cpp
index d0ea7bced9..3186920eb0 100644
--- a/src/ToolBox/SOS/lldbplugin/services.cpp
+++ b/src/ToolBox/SOS/lldbplugin/services.cpp
@@ -1577,6 +1577,25 @@ LLDBServices::GetContextFromFrame(
dtcontext->R10 = GetRegister(frame, "r10");
dtcontext->R11 = GetRegister(frame, "r11");
dtcontext->R12 = GetRegister(frame, "r12");
+#elif DBG_TARGET_X86
+ dtcontext->Eip = frame.GetPC();
+ dtcontext->Esp = frame.GetSP();
+ dtcontext->Ebp = frame.GetFP();
+ dtcontext->EFlags = GetRegister(frame, "eflags");
+
+ dtcontext->Edi = GetRegister(frame, "edi");
+ dtcontext->Esi = GetRegister(frame, "esi");
+ dtcontext->Ebx = GetRegister(frame, "ebx");
+ dtcontext->Edx = GetRegister(frame, "edx");
+ dtcontext->Ecx = GetRegister(frame, "ecx");
+ dtcontext->Eax = GetRegister(frame, "eax");
+
+ dtcontext->SegCs = GetRegister(frame, "cs");
+ dtcontext->SegSs = GetRegister(frame, "ss");
+ dtcontext->SegDs = GetRegister(frame, "ds");
+ dtcontext->SegEs = GetRegister(frame, "es");
+ dtcontext->SegFs = GetRegister(frame, "fs");
+ dtcontext->SegGs = GetRegister(frame, "gs");
#endif
}