ICorProfilerInfo::GetILToNativeMapping Method

Gets a map from Microsoft intermediate language (MSIL) offsets to native offsets for the code contained in the specified function.


HRESULT GetILToNativeMapping(  
    [in] FunctionID functionId,  
    [in] ULONG32 cMap,  
    [out] ULONG32 *pcMap,  
    [out, size_is(cMap), length_is(*pcMap)]  
        COR_DEBUG_IL_TO_NATIVE_MAP map[]);  


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

[in] The maximum size of the map array.

[out] The total number of available COR_DEBUG_IL_TO_NATIVE_MAP structures.

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


The GetILToNativeMapping 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 GetILToNativeMapping 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 GetILToNativeMapping again.

Alternatively, you can first call GetILToNativeMapping 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 GetILToNativeMapping again.


Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 2.0

See Also

ICorProfilerInfo Interface
GetILToNativeMapping2 Method
Profiling Interfaces