FunctionLeave3WithInfo Function

Notifies the profiler that control is being returned from a function, and provides a handle that can be passed to the ICorProfilerInfo3::GetFunctionLeave3Info method to retrieve the stack frame and the return value.

Syntax

void __stdcall FunctionLeave3WithInfo(  
               [in] FunctionIDOrClientID functionIDOrClientID,  
               [in] COR_PRF_ELT_INFO eltInfo);  

Parameters

functionIDOrClientID [in] The identifier of the function from which control is returned.

eltInfo [in] An opaque handle that represents information about a given stack frame. This handle is valid only during the callback to which it is passed.

Remarks

The FunctionLeave3WithInfo callback method notifies the profiler as functions are called, and allows the profiler to use the ICorProfilerInfo3::GetFunctionLeave3Info method to inspect the return value. To access return value information, the COR_PRF_ENABLE_FUNCTION_RETVAL flag has to be set. The profiler can use the ICorProfilerInfo::SetEventMask method to set the event flags, and then use the ICorProfilerInfo3::SetEnterLeaveFunctionHooks3WithInfo method to register your implementation of this function.

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

The execution engine does not save any registers before calling this function.

  • On entry, you must save all registers that you use, including those in the floating-point unit (FPU).

  • On exit, you must restore the stack by popping off all the parameters that were pushed by its caller.

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

The FunctionLeave3WithInfo function must not call into managed code or cause a managed memory allocation in any way.

Requirements

Platforms: See System Requirements.

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Versions: Available since 4

See also