Fix !threads -special spurious error message (#16701)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 2 Mar 2018 17:54:31 +0000 (09:54 -0800)
committerGitHub <noreply@github.com>
Fri, 2 Mar 2018 17:54:31 +0000 (09:54 -0800)
Fix !threads -special spurious error message

Generate portable PDB for SOS.NETCore.

Fix issue #16665. Incorrect command names in messages on Linux.

src/ToolBox/SOS/NETCore/SOS.NETCore.csproj
src/ToolBox/SOS/Strike/strike.cpp

index ae5660f..7cff9d7 100644 (file)
   <!-- Configuration specific properties -->
   <PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">
     <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
     <DefineConstants>_DEBUG;DEBUG;TRACE;$(DefineConstants)</DefineConstants>
   </PropertyGroup>
 
-  <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
+  <PropertyGroup>
     <DebugType>portable</DebugType>
   </PropertyGroup>
 
index fbffe0a..aaaf39a 100644 (file)
@@ -166,8 +166,10 @@ HMODULE g_hInstance = NULL;
 
 #ifdef FEATURE_PAL
 #define SOSPrefix ""
+#define SOSThreads "clrthreads"
 #else
 #define SOSPrefix "!"
+#define SOSThreads "!threads"
 #endif
 
 #if defined _X86_ && !defined FEATURE_PAL
@@ -5779,8 +5781,12 @@ HRESULT PrintSpecialThreads()
             continue;
         }
 
-        TADDR moduleTlsDataAddr = 0;
+        if (tlsArrayAddr == NULL)
+        {
+            continue;
+        }
 
+        TADDR moduleTlsDataAddr = 0;
         if (!SafeReadMemory (tlsArrayAddr + sizeof (void*) * (dwCLRTLSDataIndex & 0xFFFF), &moduleTlsDataAddr, sizeof (void**), NULL))
         {
             PrintLn("Failed to get Tls expansion slots for thread ", ThreadID(SysId));        
@@ -7670,8 +7676,8 @@ DECLARE_API(FindAppDomain)
         if (IsDMLEnabled())
             DMLOut("<exec cmd=\"!gcroot /d %p\">!gcroot %p</exec>, and if you find a root on a\n", p_Object, p_Object);
         else
-            ExtOut("!gcroot %p, and if you find a root on a\n", p_Object);
-        ExtOut("stack, check the AppDomain of that stack with !threads.\n");
+            ExtOut(SOSPrefix "gcroot %p, and if you find a root on a\n", p_Object);
+        ExtOut("stack, check the AppDomain of that stack with " SOSThreads ".\n");
         ExtOut("Note that the Thread could have transitioned between\n");
         ExtOut("multiple AppDomains.\n");
     }
@@ -9646,7 +9652,7 @@ DECLARE_API(GCRoot)
     if (all)
         ExtOut("Found %d roots.\n", i);
     else
-        ExtOut("Found %d unique roots (run '!GCRoot -all' to see all roots).\n", i);
+        ExtOut("Found %d unique roots (run '" SOSPrefix "gcroot -all' to see all roots).\n", i);
 
     return Status;
 }
@@ -12348,7 +12354,7 @@ private:
         if ((hr = g_clrData->GetTaskByOSThreadID(osID, &pTask)) != S_OK)
         {
             ExtOut("Unable to walk the managed stack. The current thread is likely not a \n");
-            ExtOut("managed thread. You can run !threads to get a list of managed threads in\n");
+            ExtOut("managed thread. You can run " SOSThreads " to get a list of managed threads in\n");
             ExtOut("the process\n");
             return hr;
         }