Partilhar via


FunctionLeave2 Function

Notifies the profiler that a function is about to return to the caller and provides information about the stack frame and function return value.

void FunctionLeave2 (
        [in]  FunctionID                        funcId,
        [in]  UINT_PTR                          clientData,
        [in]  COR_PRF_FRAME_INFO                func,
        [in]  COR_PRF_FUNCTION_ARGUMENT_RANGE  *retvalRange
);

Parameters

Parameter Description

funcId

[in] The identifier of the function that is returning.

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.

retvalRange

[in] A pointer to a COR_PRF_FUNCTION_ARGUMENT_RANGE Structure structure that specifies the memory location of the function's return value.

In order to access return value information, the COR_PRF_ENABLE_FUNCTION_RETVAL 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 retvalRange parameters are not valid after the FunctionLeave2 function returns because the values may change or be destroyed.

The FunctionLeave2 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 FunctionLeave2.

The implementation of FunctionLeave2 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 FunctionLeave2 returns.

Also, the FunctionLeave2 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

FunctionEnter2 Function
FunctionTailcall2 Function
ICorProfilerInfo2::SetEnterLeaveFunctionHooks2 Method

Other Resources

Profiling Global Static Functions