Gets a map from Microsoft intermediate language (MSIL) offsets to native offsets for the code contained in the JIT-recompiled version of the specified function.
HRESULT GetILToNativeMapping( [in] FunctionID functionId, [in] ReJITID reJitId, [in] ULONG32 cMap, [out] ULONG32 *pcMap, [out, size_is(cMap), length_is(*pcMap)] COR_DEBUG_IL_TO_NATIVE_MAP map);
GetILToNativeMapping2 is similar to the ICorProfilerInfo::GetILToNativeMapping method, except that it will allow the profiler to specify the ID of the recompiled function in future releases.
The ICorProfilerFunctionControl::SetILInstrumentedCodeMap method is not implemented in the .NET Framework 4.5, so functions that have been JIT-recompiled cannot have an IL-to-native mapping that differs from the originally compiled function. As such, GetILToNativeMapping2 cannot be called with a nonzero JIT-recompiled ID in the .NET Framework 4.5.
The GetILToNativeMapping2 method returns an array of COR_DEBUG_IL_TO_NATIVE_MAP structures. To convey that certain ranges of native instructions correspond to special regions of code (for example, the prolog), an entry in the array can have its ilOffset field set to a value of the CorDebugIlToNativeMappingTypes enumeration.
After GetILToNativeMapping2 returns, you must verify that the map buffer was large enough to contain all the COR_DEBUG_IL_TO_NATIVE_MAP structures. To do this, compare the value of cMap with the value of the pcMap parameter. If the pcMap value, when it is multiplied by the size of a COR_DEBUG_IL_TO_NATIVE_MAP structure, is larger than cMap, allocate a larger map buffer, update cMap with the new, larger size, and call GetILToNativeMapping2 again.
Alternatively, you can first call GetILToNativeMapping2 with a zero-length map buffer to obtain the correct buffer size. You can then set the buffer size to the value returned in pcMap and call GetILToNativeMapping2 again.
For more information about these two approaches, see Caller-Allocated Buffers.
Platforms: See .NET Framework System Requirements.
Header: CorProf.idl, CorProf.h
.NET Framework Versions: 4.5