FunctionEnter2 Function

Notifies the profiler that control is being passed to a function and provides information about the stack frame and function arguments.

void FunctionEnter2 (
        [in]  FunctionID                       funcId, 
        [in]  UINT_PTR                         clientData, 
        [in]  COR_PRF_FRAME_INFO               func, 
        [in]  COR_PRF_FUNCTION_ARGUMENT_INFO  *argumentInfo
);

Parameters

Parameter Description

funcId

[in] The identifier of the function to which control is passed.

clientData

[in] The remapped function identifier, which the profiler previously specified via the FunctionIDMapper Function function.

func

[in] A COR_PRF_FRAME_INFO value that points to information about the stack frame.

The profiler should treat this as an opaque handle that can be passed back to the execution engine in the ICorProfilerInfo2::GetFunctionInfo2 Method method.

argumentInfo

[in] A pointer to a COR_PRF_FUNCTION_ARGUMENT_INFO Structure structure that specifies the locations in memory of the function's arguments.

In order to access argument information, the COR_PRF_ENABLE_FUNCTION_ARGS flag must be set. The profiler can use the ICorProfilerInfo::SetEventMask Method method to set the event flags.

Remarks

The values of the func and argumentInfo parameters are not valid after the FunctionEnter2 function returns because the values may change or be destroyed.

The FunctionEnter2 function is a callback — you must implement it. The implementation must use the __declspec(naked) storage-class attribute.

You must save all registers that you use, including those in the floating-point processing unit (FPU), because the execution engine does not save any registers prior to calling FunctionEnter2.

The implementation of FunctionEnter2 should not block because it will delay garbage collection (GC) and the implementation should not attempt a GC because the stack may not be in a GC-friendly state. If a GC is attempted, the runtime will block until FunctionEnter2 returns.

Also, the FunctionEnter2 function must not call into managed code or in any way cause a managed memory allocation.

Requirements

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

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

FunctionLeave2 Function
FunctionTailcall2 Function
ICorProfilerInfo2::SetEnterLeaveFunctionHooks2 Method

Other Resources

Profiling Global Static Functions