IDebugControl4::GetContextStackTrace method

The GetContextStackTrace method returns the frames at the top of the call stack, starting with an arbitrary register context and returning the reconstructed register context for each stack frame.

Syntax

HRESULT GetContextStackTrace(
  PVOID              StartContext,
  ULONG              StartContextSize,
  PDEBUG_STACK_FRAME Frames,
  ULONG              FramesSize,
  PVOID              FrameContexts,
  ULONG              FrameContextsSize,
  ULONG              FrameContextsEntrySize,
  PULONG             FramesFilled
);

Parameters

StartContext

Specifies the register context for the top of the stack.

StartContextSize

Specifies the size, in bytes, of the StartContext register context.

Frames

Receives the stack frames. The number of elements this array holds is FrameSize. If Frames is NULL, this information is not returned.

FramesSize

Specifies the number of items in the array Frames.

FrameContexts

Receives the reconstructed register context for each frame in the stack. The entries in this array correspond to the entries in the Frames array. The type of the thread context is the CONTEXT structure for the target's effective processor. If FrameContexts is NULL, this information is not returned.

FrameContextsSize

Specifies the size, in bytes, of the memory pointed to by FrameContexts. The number of stack frames returned equals the number of contexts returned, and FrameContextsSize must equal FramesSize times FrameContextsEntrySize.

FrameContextsEntrySize

Specifies the size, in bytes, of each frame context in FrameContexts.

FramesFilled

Receives the number of frames that were placed in the array Frames and contexts in FrameContexts. If FramesFilled is NULL, this information is not returned.

Return value

Return code Description
S_OK
The method was successful.
 

This method can also return error values. For more information, see Return Values.

Remarks

The stack trace returned to Frames and FrameContexts can be printed using OutputContextStackTrace.

It is common for stack unwinds to restore only a subset of the registers. For example, stack unwinds will not always restore the volatile register state because the volatile registers are scratch registers and code does not need to preserve them. Registers that are not restored on unwind are left as the last value restored, so care should be taken when using the register state that might not be restored by an unwind.

Requirements

   
Target Platform Desktop
Header dbgeng.h (include Dbgeng.h, Ntddk.h)

See also

GetStackTrace

IDebugControl4

OutputContextStackTrace

k, kb, kc, kd, kp, kP, kv (Display Stack Backtrace)