summaryrefslogtreecommitdiff
path: root/src/ToolBox/SOS/Strike/strike.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolBox/SOS/Strike/strike.cpp')
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp65
1 files changed, 62 insertions, 3 deletions
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index 731e2f505d..3bb3f50200 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -4361,8 +4361,10 @@ DECLARE_API(VerifyObj)
ExtOut("Unable to build snapshot of the garbage collector state\n");
goto Exit;
}
- DacpGcHeapDetails *pheapDetails = g_snapshot.GetHeap(taddrObj);
- bValid = VerifyObject(*pheapDetails, taddrObj, taddrMT, objSize, TRUE);
+ {
+ DacpGcHeapDetails *pheapDetails = g_snapshot.GetHeap(taddrObj);
+ bValid = VerifyObject(*pheapDetails, taddrObj, taddrMT, objSize, TRUE);
+ }
Exit:
if (bValid)
@@ -5888,6 +5890,56 @@ HRESULT PrintSpecialThreads()
}
#endif //FEATURE_PAL
+HRESULT SwitchToExceptionThread()
+{
+ HRESULT Status;
+
+ DacpThreadStoreData ThreadStore;
+ if ((Status = ThreadStore.Request(g_sos)) != S_OK)
+ {
+ Print("Failed to request ThreadStore\n");
+ return Status;
+ }
+
+ DacpThreadData Thread;
+ CLRDATA_ADDRESS CurThread = ThreadStore.firstThread;
+ while (CurThread)
+ {
+ if (IsInterrupt())
+ break;
+
+ if ((Status = Thread.Request(g_sos, CurThread)) != S_OK)
+ {
+ PrintLn("Failed to request Thread at ", Pointer(CurThread));
+ return Status;
+ }
+
+ TADDR taLTOH;
+ if (Thread.lastThrownObjectHandle != NULL)
+ {
+ if (SafeReadMemory(TO_TADDR(Thread.lastThrownObjectHandle), &taLTOH, sizeof(taLTOH), NULL))
+ {
+ if (taLTOH != NULL)
+ {
+ ULONG id;
+ if (g_ExtSystem->GetThreadIdBySystemId(Thread.osThreadId, &id) == S_OK)
+ {
+ if (g_ExtSystem->SetCurrentThreadId(id) == S_OK)
+ {
+ PrintLn("Found managed exception on thread ", ThreadID(Thread.osThreadId));
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ CurThread = Thread.nextThread;
+ }
+
+ return Status;
+}
+
struct ThreadStateTable
{
unsigned int State;
@@ -5961,12 +6013,14 @@ DECLARE_API(Threads)
BOOL bPrintSpecialThreads = FALSE;
BOOL bPrintLiveThreadsOnly = FALSE;
+ BOOL bSwitchToManagedExceptionThread = FALSE;
BOOL dml = FALSE;
CMDOption option[] =
{ // name, vptr, type, hasValue
{"-special", &bPrintSpecialThreads, COBOOL, FALSE},
{"-live", &bPrintLiveThreadsOnly, COBOOL, FALSE},
+ {"-managedexception", &bSwitchToManagedExceptionThread, COBOOL, FALSE},
#ifndef FEATURE_PAL
{"/d", &dml, COBOOL, FALSE},
#endif
@@ -5975,6 +6029,11 @@ DECLARE_API(Threads)
{
return Status;
}
+
+ if (bSwitchToManagedExceptionThread)
+ {
+ return SwitchToExceptionThread();
+ }
// We need to support minidumps for this command.
BOOL bMiniDump = IsMiniDumpFile();
@@ -9119,7 +9178,7 @@ DECLARE_API (ProcInfo)
if (pFntGetProcessTimes && pFntGetProcessTimes (hProcess,&CreationTime,&ExitTime,&KernelTime,&UserTime)) {
ExtOut("---------------------------------------\n");
ExtOut("Process Times\n");
- static char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
+ static const char *Month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"};
SYSTEMTIME SystemTime;
FILETIME LocalFileTime;