Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 30fb27b

Browse files
authored
fix for il to native mapping etw events (#15038)
After investigation the failures look unrelated to my changes. Thanks Jan and Noah.
1 parent b2b7d2c commit 30fb27b

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

src/debug/ee/debugger.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,7 +3029,7 @@ DebuggerMethodInfo *Debugger::GetOrCreateMethodInfo(Module *pModule, mdMethodDef
30293029
* structs will be returned, and some of the ilOffsets in this array
30303030
* may be the values specified in CorDebugIlToNativeMappingTypes.
30313031
******************************************************************************/
3032-
HRESULT Debugger::GetILToNativeMapping(UINT_PTR pNativeCodeStartAddress, ULONG32 cMap,
3032+
HRESULT Debugger::GetILToNativeMapping(PCODE pNativeCodeStartAddress, ULONG32 cMap,
30333033
ULONG32 *pcMap, COR_DEBUG_IL_TO_NATIVE_MAP map[])
30343034
{
30353035
CONTRACTL
@@ -3133,7 +3133,8 @@ HRESULT Debugger::GetILToNativeMapping(UINT_PTR pNativeCodeStartAddress, ULONG32
31333133
//
31343134

31353135
HRESULT Debugger::GetILToNativeMappingIntoArrays(
3136-
MethodDesc * pMD,
3136+
MethodDesc * pMethodDesc,
3137+
PCODE pCode,
31373138
USHORT cMapMax,
31383139
USHORT * pcMap,
31393140
UINT ** prguiILOffset,
@@ -3157,7 +3158,7 @@ HRESULT Debugger::GetILToNativeMappingIntoArrays(
31573158

31583159
// Get the JIT info by functionId.
31593160

3160-
DebuggerJitInfo * pDJI = GetLatestJitInfoFromMethodDesc(pMD);
3161+
DebuggerJitInfo * pDJI = GetJitInfo(pMethodDesc, (const BYTE *)pCode);
31613162

31623163
// Dunno what went wrong
31633164
if (pDJI == NULL)

src/debug/ee/debugger.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,11 +2025,12 @@ class Debugger : public DebugInterface
20252025
DebuggerJitInfo *GetLatestJitInfoFromMethodDesc(MethodDesc * pMethodDesc);
20262026

20272027

2028-
HRESULT GetILToNativeMapping(UINT_PTR pNativeCodeStartAddress, ULONG32 cMap, ULONG32 *pcMap,
2028+
HRESULT GetILToNativeMapping(PCODE pNativeCodeStartAddress, ULONG32 cMap, ULONG32 *pcMap,
20292029
COR_DEBUG_IL_TO_NATIVE_MAP map[]);
20302030

20312031
HRESULT GetILToNativeMappingIntoArrays(
2032-
MethodDesc * pMD,
2032+
MethodDesc * pMethodDesc,
2033+
PCODE pCode,
20332034
USHORT cMapMax,
20342035
USHORT * pcMap,
20352036
UINT ** prguiILOffset,

src/inc/eventtracebase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ namespace ETW
547547
BOOL fGetReJitIDs);
548548
static VOID SendEventsForNgenMethods(Module *pModule, DWORD dwEventOptions);
549549
static VOID SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL);
550-
static VOID SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, ReJITID rejitID);
550+
static VOID SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, SIZE_T pCode, ReJITID rejitID);
551551
static VOID SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0);
552552
static VOID SendHelperEvent(ULONGLONG ullHelperStartAddress, ULONG ulHelperSize, LPCWSTR pHelperName);
553553
public:

src/vm/dbginterface.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,14 @@ class DebugInterface
279279
DWORD nativeOffset,
280280
DWORD *ilOffset) = 0;
281281

282-
virtual HRESULT GetILToNativeMapping(UINT_PTR pNativeCodeStartAddress,
282+
virtual HRESULT GetILToNativeMapping(PCODE pNativeCodeStartAddress,
283283
ULONG32 cMap,
284284
ULONG32 *pcMap,
285285
COR_DEBUG_IL_TO_NATIVE_MAP map[]) = 0;
286286

287287
virtual HRESULT GetILToNativeMappingIntoArrays(
288-
MethodDesc * pMD,
288+
MethodDesc * pMethodDesc,
289+
PCODE pCode,
289290
USHORT cMapMax,
290291
USHORT * pcMap,
291292
UINT ** prguiILOffset,

src/vm/eventtrace.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5253,7 +5253,7 @@ VOID ETW::MethodLog::MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrC
52535253
_ASSERTE(g_pDebugInterface != NULL);
52545254
g_pDebugInterface->InitializeLazyDataIfNecessary();
52555255

5256-
ETW::MethodLog::SendMethodILToNativeMapEvent(pMethodDesc, ETW::EnumerationLog::EnumerationStructs::JitMethodILToNativeMap, rejitID);
5256+
ETW::MethodLog::SendMethodILToNativeMapEvent(pMethodDesc, ETW::EnumerationLog::EnumerationStructs::JitMethodILToNativeMap, pCode, rejitID);
52575257
}
52585258

52595259
} EX_CATCH { } EX_END_CATCH(SwallowAllExceptions);
@@ -6664,7 +6664,7 @@ VOID ETW::MethodLog::SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptio
66646664
//
66656665

66666666
// static
6667-
VOID ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, ReJITID rejitID)
6667+
VOID ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, SIZE_T pCode, ReJITID rejitID)
66686668
{
66696669
CONTRACTL
66706670
{
@@ -6698,6 +6698,7 @@ VOID ETW::MethodLog::SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWOR
66986698

66996699
HRESULT hr = g_pDebugInterface->GetILToNativeMappingIntoArrays(
67006700
pMethodDesc,
6701+
pCode,
67016702
kMapEntriesMax,
67026703
&cMap,
67036704
&rguiILOffset,
@@ -6871,7 +6872,7 @@ VOID ETW::MethodLog::SendEventsForJitMethodsHelper(BaseDomain *pDomainFilter,
68716872

68726873
// Send any supplemental events requested for this MethodID
68736874
if (fSendILToNativeMapEvent)
6874-
ETW::MethodLog::SendMethodILToNativeMapEvent(pMD, dwEventOptions, rejitID);
6875+
ETW::MethodLog::SendMethodILToNativeMapEvent(pMD, dwEventOptions, codeStart, rejitID);
68756876

68766877
// When we're called to announce unloads, then the methodunload event itself must
68776878
// come after any supplemental events, so that the method unload event is the

0 commit comments

Comments
 (0)