From 47d8420b0c687fb8b2d480d7c40434eb01991e73 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Fri, 2 Mar 2018 09:54:31 -0800 Subject: [PATCH] Fix !threads -special spurious error message (#16701) 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 | 3 +-- src/ToolBox/SOS/Strike/strike.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj index ae5660f..7cff9d7 100644 --- a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj +++ b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj @@ -29,11 +29,10 @@ true - full _DEBUG;DEBUG;TRACE;$(DefineConstants) - + portable diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index fbffe0a..aaaf39a 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -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("!gcroot %p, 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; } -- 2.7.4