From 89758000a6edc65a78348ab4f2027f001e7b679b Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Mon, 23 Mar 2020 22:36:07 -0400 Subject: [PATCH 1/3] dotnet-dump analyze clrthreads -special Detect support at runtime --- src/SOS/Strike/strike.cpp | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index fb44ec32af..6f5159aa7a 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -6888,25 +6888,34 @@ DECLARE_API(Threads) // We need to support minidumps for this command. BOOL bMiniDump = IsMiniDumpFile(); - if (bMiniDump && bPrintSpecialThreads) - { - Print("Special thread information is not available in mini dumps.\n"); - } - EnableDMLHolder dmlHolder(dml); try { Status = PrintThreadsFromThreadStore(bMiniDump, bPrintLiveThreadsOnly); - if (!bMiniDump && bPrintSpecialThreads) + if (bPrintSpecialThreads) { -#ifdef FEATURE_PAL - Print("\n-special not supported.\n"); -#else //FEATURE_PAL - HRESULT Status2 = PrintSpecialThreads(); - if (!SUCCEEDED(Status2)) - Status = Status2; -#endif //FEATURE_PAL + BOOL bSupported = true; + + if (bMiniDump && bPrintSpecialThreads) + { + Print("Special thread information is not available in mini dumps.\n"); + bSupported = false; + } + + if (((g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsCore) && + (g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsDesktop))) + { + Print("Special thread information is only supported on Windows dumps.\n"); + bSupported = false; + } + + if (bSupported) + { + HRESULT Status2 = PrintSpecialThreads(); + if (!SUCCEEDED(Status2)) + Status = Status2; + } } } catch (sos::Exception &e) From 9c2e0b099a8b65839cc2ab0fcde15b183f350929 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Mon, 23 Mar 2020 23:17:23 -0400 Subject: [PATCH 2/3] Fixes --- src/SOS/Strike/strike.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index 6f5159aa7a..55d0931894 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -6895,18 +6895,20 @@ DECLARE_API(Threads) Status = PrintThreadsFromThreadStore(bMiniDump, bPrintLiveThreadsOnly); if (bPrintSpecialThreads) { +#ifdef FEATURE_PAL + Print("\n-special not supported.\n"); +#else //FEATURE_PAL BOOL bSupported = true; - if (bMiniDump && bPrintSpecialThreads) + if (((g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsCore) && + (g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsDesktop))) { - Print("Special thread information is not available in mini dumps.\n"); + Print("Special thread information is only supported on Windows targets.\n"); bSupported = false; } - - if (((g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsCore) && - (g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsDesktop))) + else if (bMiniDump && bPrintSpecialThreads) { - Print("Special thread information is only supported on Windows dumps.\n"); + Print("Special thread information is not available in mini dumps.\n"); bSupported = false; } @@ -6916,6 +6918,7 @@ DECLARE_API(Threads) if (!SUCCEEDED(Status2)) Status = Status2; } +#endif // FEATURE_PAL } } catch (sos::Exception &e) From f723b2f8d3049111d8dce132184ca3d3aa8a8e2f Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Tue, 24 Mar 2020 12:28:14 -0400 Subject: [PATCH 3/3] Fix nits --- src/SOS/Strike/strike.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SOS/Strike/strike.cpp b/src/SOS/Strike/strike.cpp index 55d0931894..3fbe03a8cb 100644 --- a/src/SOS/Strike/strike.cpp +++ b/src/SOS/Strike/strike.cpp @@ -6896,7 +6896,7 @@ DECLARE_API(Threads) if (bPrintSpecialThreads) { #ifdef FEATURE_PAL - Print("\n-special not supported.\n"); + Print("\n-special not supported.\n"); #else //FEATURE_PAL BOOL bSupported = true; @@ -6906,7 +6906,7 @@ DECLARE_API(Threads) Print("Special thread information is only supported on Windows targets.\n"); bSupported = false; } - else if (bMiniDump && bPrintSpecialThreads) + else if (bMiniDump) { Print("Special thread information is not available in mini dumps.\n"); bSupported = false;