dotnet-dump analyze clrthreads -special (#943)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Tue, 24 Mar 2020 17:25:33 +0000 (13:25 -0400)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 17:25:33 +0000 (13:25 -0400)
* dotnet-dump analyze clrthreads -special

Detect support at runtime

src/SOS/Strike/strike.cpp

index 61b30ef0109b4004592c181c7452a528c26d2512..0a3c3b198334fbc868322e3b3bd2a545e5c2e02d 100644 (file)
@@ -6892,25 +6892,37 @@ 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            
+#else //FEATURE_PAL
+            BOOL bSupported = true;
+
+            if (((g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsCore) &&
+                (g_pRuntime->GetRuntimeConfiguration() != IRuntime::WindowsDesktop)))
+            {
+                Print("Special thread information is only supported on Windows targets.\n");
+                bSupported = false;
+            }
+            else if (bMiniDump)
+            {
+                Print("Special thread information is not available in mini dumps.\n");
+                bSupported = false;
+            }
+
+            if (bSupported)
+            {
+                HRESULT Status2 = PrintSpecialThreads();
+                if (!SUCCEEDED(Status2))
+                    Status = Status2;
+            }
+#endif // FEATURE_PAL
         }
     }
     catch (sos::Exception &e)