Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GCDescs in front of MethodTable to dumps #72658

Merged
merged 2 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ BOOL DacValidateEEClass(EEClass *pEEClass)

}

BOOL DacValidateMethodTable(MethodTable *pMT, BOOL &bIsFree)
BOOL DacValidateMethodTable(PTR_MethodTable pMT, BOOL &bIsFree)
{
// Verify things are right.
BOOL retval = FALSE;
Expand Down Expand Up @@ -440,7 +440,7 @@ ClrDataAccess::GetMethodTableSlot(CLRDATA_ADDRESS mt, unsigned int slot, CLRDATA

SOSDacEnter();

MethodTable* mTable = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable mTable = PTR_MethodTable(TO_TADDR(mt));
BOOL bIsFree = FALSE;
if (!DacValidateMethodTable(mTable, bIsFree))
{
Expand Down Expand Up @@ -1465,7 +1465,7 @@ ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, _Ino
SOSDacEnter();

TADDR mtTADDR = DACGetMethodTableFromObjectPointer(TO_TADDR(obj), m_pTarget);
MethodTable *mt = PTR_MethodTable(mtTADDR);
PTR_MethodTable mt = PTR_MethodTable(mtTADDR);

// Object must be a string
BOOL bFree = FALSE;
Expand Down Expand Up @@ -1515,7 +1515,7 @@ ClrDataAccess::GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, _Inou

// Don't turn the Object into a pointer, it is too costly on
// scans of the gc heap.
MethodTable *mt = NULL;
PTR_MethodTable mt = NULL;
TADDR mtTADDR = DACGetMethodTableFromObjectPointer(CLRDATA_ADDRESS_TO_TADDR(obj), m_pTarget);
if (mtTADDR != NULL)
mt = PTR_MethodTable(mtTADDR);
Expand Down Expand Up @@ -1732,7 +1732,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData

SOSDacEnter();

MethodTable* pMT = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable pMT = PTR_MethodTable(TO_TADDR(mt));
BOOL bIsFree = FALSE;
if (!DacValidateMethodTable(pMT, bIsFree))
{
Expand Down Expand Up @@ -1775,7 +1775,7 @@ ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, _Inout

SOSDacEnter();

MethodTable *pMT = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable pMT = PTR_MethodTable(TO_TADDR(mt));
BOOL free = FALSE;

if (mt == HOST_CDADDR(g_pFreeObjectMethodTable))
Expand Down Expand Up @@ -1936,7 +1936,7 @@ ClrDataAccess::GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTabl

SOSDacEnter();

MethodTable* pMT = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable pMT = PTR_MethodTable(TO_TADDR(mt));
BOOL bIsFree = FALSE;
if (!pMT || !DacValidateMethodTable(pMT, bIsFree))
{
Expand Down Expand Up @@ -1966,7 +1966,7 @@ ClrDataAccess::GetMethodTableCollectibleData(CLRDATA_ADDRESS mt, struct DacpMeth

SOSDacEnter();

MethodTable* pMT = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable pMT = PTR_MethodTable(TO_TADDR(mt));
BOOL bIsFree = FALSE;
if (!pMT || !DacValidateMethodTable(pMT, bIsFree))
{
Expand All @@ -1993,7 +1993,7 @@ ClrDataAccess::GetMethodTableTransparencyData(CLRDATA_ADDRESS mt, struct DacpMet

SOSDacEnter();

MethodTable *pMT = PTR_MethodTable(TO_TADDR(mt));
PTR_MethodTable pMT = PTR_MethodTable(TO_TADDR(mt));
BOOL bIsFree = FALSE;
if (!DacValidateMethodTable(pMT, bIsFree))
{
Expand Down Expand Up @@ -2177,7 +2177,7 @@ ClrDataAccess::GetObjectData(CLRDATA_ADDRESS addr, struct DacpObjectData *object
hr = E_INVALIDARG;

BOOL bFree = FALSE;
MethodTable *mt = NULL;
PTR_MethodTable mt = NULL;
if (SUCCEEDED(hr))
{
mt = PTR_MethodTable(mtTADDR);
Expand Down Expand Up @@ -5125,7 +5125,7 @@ HRESULT ClrDataAccess::IsTrackedType(
hr = E_INVALIDARG;

BOOL bFree = FALSE;
MethodTable *mt = NULL;
PTR_MethodTable mt = NULL;
if (SUCCEEDED(hr))
{
mt = PTR_MethodTable(mtTADDR);
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/vm/methodtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7835,6 +7835,16 @@ MethodTable::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
DWORD size = GetEndOffsetOfOptionalMembers();
DacEnumMemoryRegion(dac_cast<TADDR>(this), size);

// Make sure the GCDescs are added to the dump
if (ContainsPointers())
{
PTR_CGCDesc gcdesc = CGCDesc::GetCGCDescFromMT(this);
size_t size = gcdesc->GetSize();
// Manually calculate the start of the GCDescs because CGCDesc::GetStartOfGCData() isn't DAC'ified.
TADDR gcdescStart = dac_cast<TADDR>(this) - size;
DacEnumMemoryRegion(gcdescStart, size);
}

if (!IsCanonicalMethodTable())
{
PTR_MethodTable pMTCanonical = GetCanonicalMethodTable();
Expand Down