Skip to content

Commit

Permalink
Add the ALC to DumpMT (#3508)
Browse files Browse the repository at this point in the history
* Add the ALC to DumpMT

* Update to use DML for ALC

* Reduce change for testing

* Reduce change for testing

* Bring back QI for ISOSDacInterface8

* Acquire ALC

* Revert back to original fix

* Disable dumpmt for 7.0

* Check for at least .NET 7

* Don't leave a failure status code.

Co-authored-by: Juan Sebastian Hoyos Ayala <[email protected]>
  • Loading branch information
AaronRobinsonMSFT and hoyosjs authored Nov 22, 2022
1 parent 61d96b4 commit ac9b0dc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
3 changes: 3 additions & 0 deletions src/SOS/SOS.UnitTests/Scripts/OtherCommands.script
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,12 @@ VERIFY:\s*Class Name:\s+SymbolTestApp.Program\s+
VERIFY:\s*File:\s+.*SymbolTestApp\.(dll|exe)\s+

# Verify DumpMT
!IFDEF:MAJOR_RUNTIME_VERSION_GE_7
# https://github.com/dotnet/diagnostics/issues/3516
SOSCOMMAND:DumpMT <POUT>\s*Method Table:\s+(<HEXVAL>)\s+<POUT>
VERIFY:\s*Name:\s+SymbolTestApp.Program\s+
VERIFY:\s*File:\s+.*SymbolTestApp\.(dll|exe)\s+
ENDIF:MAJOR_RUNTIME_VERSION_GE_7

SOSCOMMAND:FinalizeQueue
VERIFY:\s*SyncBlocks to be cleaned up:\s+<DECVAL>\s+
Expand Down
28 changes: 23 additions & 5 deletions src/SOS/Strike/strike.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ DECLARE_API(DumpMT)
}

EnableDMLHolder dmlHolder(dml);
TableOutput table(2, 16, AlignLeft, false);
TableOutput table(2, 20, AlignLeft, false);

if (nArg == 0)
{
Expand Down Expand Up @@ -1326,6 +1326,24 @@ DECLARE_API(DumpMT)
}
}

ReleaseHolder<ISOSDacInterface8> sos8;
if (SUCCEEDED(g_sos->QueryInterface(__uuidof(ISOSDacInterface8), &sos8)))
{
CLRDATA_ADDRESS assemblyLoadContext = 0;
if (SUCCEEDED(sos8->GetAssemblyLoadContext(TO_CDADDR(dwStartAddr), &assemblyLoadContext)))
{
const char* title = "AssemblyLoadContext:";
if (assemblyLoadContext != 0)
{
table.WriteRow(title, ObjectPtr(assemblyLoadContext));
}
else
{
table.WriteRow(title, "Default ALC - The managed instance of this context doesn't exist yet.");
}
}
}

table.WriteRow("BaseSize:", PrefixHex(vMethTable.BaseSize));
table.WriteRow("ComponentSize:", PrefixHex(vMethTable.ComponentSize));
table.WriteRow("DynamicStatics:", vMethTable.bIsDynamic ? "true" : "false");
Expand Down Expand Up @@ -10338,7 +10356,7 @@ DECLARE_API(EEVersion)
else
ExtOut("Workstation mode\n");

if (!GetGcStructuresValid())
if (!GetGcStructuresValid())
{
ExtOut("In plan phase of garbage collection\n");
}
Expand Down Expand Up @@ -15797,7 +15815,7 @@ class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataLog
}
}
if (IsInterrupt())
{
{
return COR_E_OPERATIONCANCELED;
}
return S_OK;
Expand All @@ -15808,7 +15826,7 @@ class EnumMemoryCallback : public ICLRDataEnumMemoryRegionsCallback, ICLRDataLog
{
ExtOut("%s", message);
if (IsInterrupt())
{
{
return COR_E_OPERATIONCANCELED;
}
return S_OK;
Expand All @@ -15824,7 +15842,7 @@ DECLARE_API(enummem)
if (SUCCEEDED(Status))
{
ToRelease<ICLRDataEnumMemoryRegionsCallback> callback = new EnumMemoryCallback(false, true);
ULONG32 minidumpType =
ULONG32 minidumpType =
(MiniDumpWithPrivateReadWriteMemory |
MiniDumpWithDataSegs |
MiniDumpWithHandleData |
Expand Down
15 changes: 4 additions & 11 deletions src/SOS/Strike/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3488,7 +3488,7 @@ size_t FunctionType (size_t EIP)

//
// Return true if major runtime version (logical product version like 2.1,
// 3.0 or 5.x). Currently only major versions of 3 or 5 are supported.
// 3.0 or 5.x).
//
bool IsRuntimeVersion(DWORD major)
{
Expand All @@ -3504,13 +3504,10 @@ bool IsRuntimeVersion(VS_FIXEDFILEINFO& fileInfo, DWORD major)
{
switch (major)
{
case 5:
return HIWORD(fileInfo.dwFileVersionMS) == 5;
case 3:
return HIWORD(fileInfo.dwFileVersionMS) == 4 && LOWORD(fileInfo.dwFileVersionMS) == 700;
default:
_ASSERTE(FALSE);
break;
return HIWORD(fileInfo.dwFileVersionMS) == major;
}
return false;
}
Expand All @@ -3536,18 +3533,14 @@ bool IsRuntimeVersionAtLeast(VS_FIXEDFILEINFO& fileInfo, DWORD major)
}
// fall through

case 5:
if (HIWORD(fileInfo.dwFileVersionMS) >= 5)
default:
if (HIWORD(fileInfo.dwFileVersionMS) >= major)
{
return true;
}
// fall through

break;

default:
_ASSERTE(FALSE);
break;
}
return false;
}
Expand Down

0 comments on commit ac9b0dc

Please sign in to comment.