Muokkaa

Jaa


ICorProfilerInfo4::GetILToNativeMapping2 Method

Gets a map from common intermediate language (CIL) offsets to native offsets for the code contained in the JIT-recompiled version of the specified function.

Syntax

HRESULT GetILToNativeMapping2(
    [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[]);

Parameters

functionId [in] The ID of the function that contains the code.

pReJitId [in] The identity of the JIT-recompiled function. The identity must be zero in .NET Framework 4.5.

cMap [in] The maximum size of the map array.

pcMap [out] The total number of available COR_DEBUG_IL_TO_NATIVE_MAP structures.

map [out] An array of COR_DEBUG_IL_TO_NATIVE_MAP structures, each of which specifies the offsets. After the GetILToNativeMapping2 method returns, map will contain some or all of the COR_DEBUG_IL_TO_NATIVE_MAP structures.

Remarks

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.

Note

The ICorProfilerFunctionControl::SetILInstrumentedCodeMap method is not implemented in .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 .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.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 4.5

See also