StackSnapshotCallback Function
Provides the profiler with information on each managed frame and each run of unmanaged frames on the stack during a stack walk, which is initiated by the ICorProfilerInfo2::DoStackSnapshot Method method.
HRESULT __stdcall StackSnapshotCallback (
FunctionID funcId,
UINT_PTR ip,
COR_PRF_FRAME_INFO frameInfo,
ULONG32 contextSize,
BYTE context[],
void *clientData
);
Parameters
Parameter | Description |
---|---|
funcId |
[in] If this value is zero, this callback is for a run of unmanaged frames; otherwise, it is the identifier of a managed function and this callback is for a managed frame. |
ip |
[in] The value of the native code instruction pointer in the frame. |
frameInfo |
[in] A COR_PRF_FRAME_INFO value that references information about the stack frame. This value is valid for use only during this callback. |
contextSize |
[in] The size of the CONTEXT structure, which is referenced by the context parameter. |
context |
[in] A pointer to a Win32 CONTEXT structure that represents the state of the CPU for this frame. The context parameter is valid only if the COR_PRF_SNAPSHOT_CONTEXT flag was passed in ICorProfilerInfo2::DoStackSnapshot Method. |
clientData |
[in] A pointer to the client data, which is passed straight through from ICorProfilerInfo2::DoStackSnapshot Method. |
Remarks
The StackSnapshotCallback function is implemented by the profiler writer. You must limit the complexity of work done in StackSnapshotCallback. For example, when using ICorProfilerInfo2::DoStackSnapshot Method in an asynchronous manner, the target thread may be holding locks. If code within StackSnapshotCallback requires the same locks, a deadlock could ensue.
The ICorProfilerInfo2::DoStackSnapshot Method method calls the StackSnapshotCallback function once per managed frame or once per run of unmanaged frames. If StackSnapshotCallback is called for a run of unmanaged frames, the profiler may use the register context (referenced by the context parameter) to perform its own unmanaged stack walk. In this case, the Win32 CONTEXT structure represents the CPU state for the most recently pushed frame within the run of unmanaged frames. Although the Win32 CONTEXT structure includes values for all registers, you should rely only on the values of the stack pointer register, frame pointer register, instruction pointer register, and the nonvolatile (that is, preserved) integer registers.
Requirements
Platforms: Windows 2000, Windows XP, Windows Server 2003 family
Header: CorProf.idl
Library: CorGuids.lib
.NET Framework Version: 2.0, 1.1, 1.0
See Also
Reference
ICorProfilerInfo2::DoStackSnapshot Method