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

[DAC] ClrDataAccess::GetFrameName support Frames using identifier instead of vptr #112488

Merged
merged 3 commits into from
Feb 13, 2025
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
32 changes: 13 additions & 19 deletions src/coreclr/debug/daccess/dacfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ struct DacHostVtPtrs
#undef VPTR_CLASS
};


const WCHAR *g_dacVtStrings[] =
{
#define VPTR_CLASS(name) W(#name),
#include <vptr_list.h>
#undef VPTR_CLASS
};

DacHostVtPtrs g_dacHostVtPtrs;

HRESULT
Expand All @@ -45,6 +37,13 @@ DacGetHostVtPtrs(void)
return S_OK;
}

const WCHAR *g_dacFrameStrings[] =
{
#define FRAME_TYPE_NAME(name) W(#name),
#include "FrameTypes.h"
#undef FRAME_TYPE_NAME
};

bool
DacExceptionFilter(Exception* ex, ClrDataAccess* access,
HRESULT* status)
Expand Down Expand Up @@ -1134,22 +1133,17 @@ DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx)
#endif // !_PREFIX_
}

PWSTR DacGetVtNameW(TADDR targetVtable)
PWSTR DacGetFrameNameW(TADDR frameIdentifier)
{
PWSTR pszRet = NULL;

TADDR *targ = &DacGlobalValues()->EEJitManager__vtAddr;
TADDR *targStart = targ;
for (ULONG i = 0; i < sizeof(g_dacHostVtPtrs) / sizeof(PVOID); i++)
{
if (targetVtable == (*targ))
{
pszRet = (PWSTR) *(g_dacVtStrings + (targ - targStart));
break;
}
FrameIdentifier frameId = static_cast<FrameIdentifier>(frameIdentifier);

targ++;
if (!(frameId == FrameIdentifier::None || frameId >= FrameIdentifier::CountPlusOne))
{
pszRet = (PWSTR) g_dacFrameStrings[(int)frameId - 1];
}

return pszRet;
}

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_u

SOSDacEnter();

PWSTR pszName = DacGetVtNameW(CLRDATA_ADDRESS_TO_TADDR(vtable));
PWSTR pszName = DacGetFrameNameW(CLRDATA_ADDRESS_TO_TADDR(vtable));
if (pszName == NULL)
{
hr = E_INVALIDARG;
Expand Down Expand Up @@ -2921,7 +2921,7 @@ ClrDataAccess::GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode)
{
*pDynamicAdaptationMode = -1;
hr = S_FALSE;
}
}
SOSDacLeave();
return hr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/daccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ PWSTR DacInstantiateStringW(TADDR addr, ULONG32 maxChars, bool throwEx);
TADDR DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx);
TADDR DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx);
TADDR DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx);
PWSTR DacGetVtNameW(TADDR targetVtable);
PWSTR DacGetFrameNameW(TADDR frameIdentifier);

// Report a region of memory to the debugger
bool DacEnumMemoryRegion(TADDR addr, TSIZE_T size, bool fExpectSuccess = true);
Expand Down
Loading