diff options
author | Mike McLaughlin <mikem@microsoft.com> | 2016-02-08 17:47:31 -0800 |
---|---|---|
committer | Mike McLaughlin <mikem@microsoft.com> | 2016-02-10 13:38:08 -0800 |
commit | 7d74570d33823d4734fa287bc21a81ff12f7b40a (patch) | |
tree | a5c30abede3ac0679554444651fa1026288ae594 /src/ToolBox | |
parent | ceb0a800ad650a36a32e543146669e9f3654e948 (diff) | |
download | coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.tar.gz coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.tar.bz2 coreclr-7d74570d33823d4734fa287bc21a81ff12f7b40a.zip |
Fix SOS managed breakpoints when coreclr symbols are stripped.
Added a SOS DAC interface (ISOSDacInterface4::GetClrNotification) to get the exception
notification arguments instead of using the GetLastExceptionInformation function from the lldb
sosplugin that depends on coreclr symbols being present.
On the coreclr side, the clr notification arguments are saved in a global variable that is DAC
accessible. A critical section was added to protect this global variable while the special
exception is raised.
Setting the internal COMPlus_DebugBreakOnAssert environment variable causes 3 or 4 breaks in
the debugger with no reason. It was breaking in the function that was determining whether it
should break. I was using COMPlus_BreakOnEELoad=2 to break after coreclr was loaded and initialized
to set managed breakpoints and on a debug build it generates an assert (on release just a DebugBreak).
Diffstat (limited to 'src/ToolBox')
-rw-r--r-- | src/ToolBox/SOS/Strike/strike.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 1ee3eabc0b..c78cec5205 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -6878,9 +6878,43 @@ int CNotification::s_condemnedGen = -1; BOOL CheckCLRNotificationEvent(DEBUG_LAST_EVENT_INFO_EXCEPTION* pdle) { + ISOSDacInterface4 *psos4 = NULL; + CLRDATA_ADDRESS arguments[3]; + HRESULT Status; + + if (SUCCEEDED(Status = g_sos->QueryInterface(__uuidof(ISOSDacInterface4), (void**) &psos4))) + { + int count = _countof(arguments); + int countNeeded = 0; + + Status = psos4->GetClrNotification(arguments, count, &countNeeded); + psos4->Release(); + + if (SUCCEEDED(Status)) + { + memset(&pdle->ExceptionRecord, 0, sizeof(pdle->ExceptionRecord)); + pdle->FirstChance = TRUE; + pdle->ExceptionRecord.ExceptionCode = CLRDATA_NOTIFY_EXCEPTION; + + _ASSERTE(count <= EXCEPTION_MAXIMUM_PARAMETERS); + for (int i = 0; i < count; i++) + { + pdle->ExceptionRecord.ExceptionInformation[i] = arguments[i]; + } + // The rest of the ExceptionRecord isn't used by TranslateExceptionRecordToNotification + return TRUE; + } + // No pending exception notification + return FALSE; + } + + // The new DAC based interface doesn't exists so ask the debugger for the last exception + // information. NOTE: this function doesn't work on xplat version when the coreclr symbols + // have been stripped. + ULONG Type, ProcessId, ThreadId; ULONG ExtraInformationUsed; - HRESULT Status = g_ExtControl->GetLastEventInformation( + Status = g_ExtControl->GetLastEventInformation( &Type, &ProcessId, &ThreadId, |