From aa78a2773ffe573c705caa11dd66467ae6c82781 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Thu, 19 Nov 2015 18:13:25 -0800 Subject: Some SOS fixes/cleanup (bpmd, setclrpath, setsostid). Enable the module load notification when no module or methods are found. setclrpath/setsostid print the current path/tid if no arguments. "setsostid -clear" now clears the tid/os id mapping. Added better exception hook to sos plugin to catch special CLRN exception. Before multiple lldb "Exception breakpoints" where set each time bpmd added a new bp. Added a "DoNotDeleteOrDisable" message to the exception breakpoint created. Fix bpmd on release builds. RtlpRaiseException was being inlined and the ExceptionRecord parameter was being optimized away causing the GetLastEventInformation api to failed and the special CLRN exception to be ignored. Add sos help support. "soshelp" displays help about a command. --- src/pal/src/exception/seh-unwind.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/pal/src/exception/seh-unwind.cpp') diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp index f0749e7b29..dde7ba87fc 100644 --- a/src/pal/src/exception/seh-unwind.cpp +++ b/src/pal/src/exception/seh-unwind.cpp @@ -556,9 +556,16 @@ Note: The name of this function and the name of the ExceptionRecord parameter is used in the sos lldb plugin code to read the exception record. See coreclr\src\ToolBox\SOS\lldbplugin\debugclient.cpp. + + This function must not be inlined or optimized so the below PAL_VirtualUnwind + calls end up with RaiseException caller's context and so the above debugger + code finds the function and ExceptionRecord parameter. --*/ PAL_NORETURN -static void RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord) +__attribute__((noinline)) +__attribute__((optnone)) +static void +RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord) { // Capture the context of RtlpRaiseException. CONTEXT ContextRecord; @@ -572,6 +579,7 @@ static void RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord) // The frame we're looking at now is RaiseException. We have to unwind one // level further to get the actual context user code could be resumed at. PAL_VirtualUnwind(&ContextRecord, NULL); + #if defined(_X86_) ExceptionRecord->ExceptionAddress = (void *) ContextRecord.Eip; #elif defined(_AMD64_) @@ -582,19 +590,7 @@ static void RtlpRaiseException(EXCEPTION_RECORD *ExceptionRecord) #error unsupported architecture #endif - EXCEPTION_POINTERS pointers; - pointers.ExceptionRecord = ExceptionRecord; - pointers.ContextRecord = &ContextRecord; - - SEHRaiseException(InternalGetCurrentThread(), &pointers, 0); -} - -PAL_NORETURN -void SEHRaiseException(CPalThread *pthrCurrent, - PEXCEPTION_POINTERS lpExceptionPointers, - int signal_code) -{ - throw PAL_SEHException(lpExceptionPointers->ExceptionRecord, lpExceptionPointers->ContextRecord); + throw PAL_SEHException(ExceptionRecord, &ContextRecord); } /*++ -- cgit v1.2.3