Fix SOS thread statics display (#21426)
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 7 Dec 2018 09:32:59 +0000 (10:32 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Dec 2018 09:32:59 +0000 (10:32 +0100)
I've noticed that when dumping an object with thread locals using SOS
dumpobj command, I never get the thread locals. I've stepped through the
code in SOS that displays thread statics and found that for some strange
reason, it dismisses threads where DomainLocalModule doesn't have
"initialized" flag set for the given class. However, when runtime
accesses thread statics, it just checks "allocated" flag set for the
given class in the ThreadLocalModule. Removing the extra check for
DomainLocalModule fixed the problem and now thread statics are displayed
properly.

src/ToolBox/SOS/Strike/util.cpp

index 3abe606..5533017 100644 (file)
@@ -1327,18 +1327,6 @@ void DisplayThreadStatic(DacpModuleData* pModule, DacpMethodTableData* pMT, Dacp
         {   
             CLRDATA_ADDRESS appDomainAddr = vThread.domain;
 
-            // Get the DLM (we need this to check the ClassInit flags).
-            // It's annoying that we have to issue one request for
-            // domain-neutral modules and domain-specific modules.
-            DacpDomainLocalModuleData vDomainLocalModule;                
-            if (g_sos->GetDomainLocalModuleDataFromModule(pMT->Module, &vDomainLocalModule) != S_OK)
-            {
-                // Not initialized, go to next thread
-                // and continue looping
-                CurThread = vThread.nextThread;
-                continue;
-            }
-
             // Get the TLM
             DacpThreadLocalModuleData vThreadLocalModule;
             if (g_sos->GetThreadLocalModuleData(CurThread, (int)dwModuleIndex, &vThreadLocalModule) != S_OK)
@@ -1361,17 +1349,6 @@ void DisplayThreadStatic(DacpModuleData* pModule, DacpMethodTableData* pMT, Dacp
                 continue;
             }
 
-            Flags = 0;
-            GetDLMFlags(&vDomainLocalModule, pMT, &Flags);
-
-            if ((Flags&1) == 0) 
-            {
-                // Not initialized, go to next thread
-                // and continue looping
-                CurThread = vThread.nextThread;
-                continue;
-            }
-            
             ExtOut(" %x:", vThread.osThreadId);
             DisplayDataMember(pFD, dwTmp, FALSE);               
         }