Freigeben über


ICorProfilerInfo::SetILInstrumentedCodeMap Method

Sets a code map for the specified function using the specified Microsoft intermediate language (MSIL) map entries.

Note

In the .NET Framework version 2.0, calling SetILInstrumentedCodeMap on a FunctionID that represents a generic function in a particular application domain will affect all instances of that function in the application domain.

HRESULT SetILInstrumentedCodeMap(
    [in]                         FunctionID functionId,
    [in]                         BOOL       fStartJit,
    [in]                         ULONG      cILMapEntries,
    [in, size_is(cILMapEntries)] COR_IL_MAP rgILMapEntries[]);

Parameters

Parameter Description

functionId

[in] The ID of the function for which to set the code map.

fStartJit

[in] A Boolean value that indicates whether the call to the SetILInstrumentedCodeMap method is the first for a particular FunctionID. Set fStartJit to true in the first call to SetILInstrumentedCodeMap for a given FunctionID, and to false thereafter.

cILMapEntries

[in] The number of elements in the cILMapEntries array.

rgILMapEntries

[in] An array of COR_IL_MAP Structure structures, each of which specifies the MSIL offsets.

Remarks

A profiler often inserts statements within the source code of a method for the purpose of instrumenting that method, for example, to notify when a given source line is reached. SetILInstrumentedCodeMap allows a profiler to map the original MSIL instructions to their new locations. A profiler can use ICorProfilerInfo::GetILToNativeMapping Method to get the original MSIL offset for a given native offset.

The debugger will assume that each old offset refers to an MSIL offset within the original, unmodified MSIL code, and that each new offset refers to the MSIL offset within the new, instrumented code. The map should be sorted in increasing order. For stepping to work properly, follow these guidelines:

  • Instrumented MSIL code should not be reordered.

  • Original MSIL code should not be removed.

  • The map should include entries for all of the sequence points from the program database (PDB) file. The map does not interpolate missing entries. So, given the following map:

    (0 old, 0 new)

    (5 old, 10 new)

    (9 old, 20 new)

    • An old offset of 0, 1, 2, 3, or 4 will be mapped to new offset 0.

    • An old offset of 5, 6, 7, or 8 will be mapped to new offset 10.

    • An old offset of 9 or higher will be mapped to new offset 20.

    • A new offset of 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 will be mapped to old offset 0.

    • A new offset of 10, 11, 12, 13, 14, 15, 16, 17, 18, or 19 will be mapped to old offset 5.

    • A new offset of 20 or higher will be mapped to old offset 9.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0, 1.1

See Also

Reference

ICorProfilerInfo Interface