ICorProfilerInfo::GetILToNativeMapping Method

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

Syntax

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

Parameters

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

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 GetILToNativeMapping method returns, map will contain some or all of the COR_DEBUG_IL_TO_NATIVE_MAP structures.

Remarks

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.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: Available since 2.0

See also