Skip to content

Commit 0f66f23

Browse files
max-charlambMax Charlamb
andauthored
[DAC] ClrDataAccess::GetFrameName support Frames using identifier instead of vptr (#112488)
* fix ClrDataAccess::GetFrameName for FrameIdentifier change * remove g_dacVtStrings and DacGetVtNameW which are no longer used --------- Co-authored-by: Max Charlamb <maxcharlamb@microsoft.com>
1 parent 3484494 commit 0f66f23

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

src/coreclr/debug/daccess/dacfn.cpp

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ struct DacHostVtPtrs
2424
#undef VPTR_CLASS
2525
};
2626

27-
28-
const WCHAR *g_dacVtStrings[] =
29-
{
30-
#define VPTR_CLASS(name) W(#name),
31-
#include <vptr_list.h>
32-
#undef VPTR_CLASS
33-
};
34-
3527
DacHostVtPtrs g_dacHostVtPtrs;
3628

3729
HRESULT
@@ -45,6 +37,13 @@ DacGetHostVtPtrs(void)
4537
return S_OK;
4638
}
4739

40+
const WCHAR *g_dacFrameStrings[] =
41+
{
42+
#define FRAME_TYPE_NAME(name) W(#name),
43+
#include "FrameTypes.h"
44+
#undef FRAME_TYPE_NAME
45+
};
46+
4847
bool
4948
DacExceptionFilter(Exception* ex, ClrDataAccess* access,
5049
HRESULT* status)
@@ -1134,22 +1133,17 @@ DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx)
11341133
#endif // !_PREFIX_
11351134
}
11361135

1137-
PWSTR DacGetVtNameW(TADDR targetVtable)
1136+
PWSTR DacGetFrameNameW(TADDR frameIdentifier)
11381137
{
11391138
PWSTR pszRet = NULL;
11401139

1141-
TADDR *targ = &DacGlobalValues()->EEJitManager__vtAddr;
1142-
TADDR *targStart = targ;
1143-
for (ULONG i = 0; i < sizeof(g_dacHostVtPtrs) / sizeof(PVOID); i++)
1144-
{
1145-
if (targetVtable == (*targ))
1146-
{
1147-
pszRet = (PWSTR) *(g_dacVtStrings + (targ - targStart));
1148-
break;
1149-
}
1140+
FrameIdentifier frameId = static_cast<FrameIdentifier>(frameIdentifier);
11501141

1151-
targ++;
1142+
if (!(frameId == FrameIdentifier::None || frameId >= FrameIdentifier::CountPlusOne))
1143+
{
1144+
pszRet = (PWSTR) g_dacFrameStrings[(int)frameId - 1];
11521145
}
1146+
11531147
return pszRet;
11541148
}
11551149

src/coreclr/debug/daccess/request.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,7 @@ ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_u
21432143

21442144
SOSDacEnter();
21452145

2146-
PWSTR pszName = DacGetVtNameW(CLRDATA_ADDRESS_TO_TADDR(vtable));
2146+
PWSTR pszName = DacGetFrameNameW(CLRDATA_ADDRESS_TO_TADDR(vtable));
21472147
if (pszName == NULL)
21482148
{
21492149
hr = E_INVALIDARG;
@@ -2921,7 +2921,7 @@ ClrDataAccess::GetGCDynamicAdaptationMode(int* pDynamicAdaptationMode)
29212921
{
29222922
*pDynamicAdaptationMode = -1;
29232923
hr = S_FALSE;
2924-
}
2924+
}
29252925
SOSDacLeave();
29262926
return hr;
29272927
}

src/coreclr/inc/daccess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ PWSTR DacInstantiateStringW(TADDR addr, ULONG32 maxChars, bool throwEx);
699699
TADDR DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx);
700700
TADDR DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx);
701701
TADDR DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx);
702-
PWSTR DacGetVtNameW(TADDR targetVtable);
702+
PWSTR DacGetFrameNameW(TADDR frameIdentifier);
703703

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

0 commit comments

Comments
 (0)