Debugging Tools for Windows

StackTrace

The StackTrace function retrieves a stack trace for the process being debugged. Returns the number of frames read into the buffer pointed to by StackFrames.

ULONG 
  StackTrace (
    ULONG FramePointer,
    ULONG StackPointer,
    ULONG ProgramCounter,
    PEXTSTACKTRACE StackFrames,
    ULONG Frames
    );

Parameters

FramePointer
Specifies the frame pointer. If no specific value is desired, this should simply be set to zero.
StackPointer
Specifies the stack pointer. If no specific value is desired, this should simply be set to zero.
ProgramCounter
Specifies the instruction pointer. If no specific value is desired, this should simply be set to zero.
StackFrames
Receives the stack information. StackFrames must be a pointer to a buffer that is large enough to hold the number of stack frames specified by Frames. The stack frames are stored in the following data structure:

typedef struct _tagEXTSTACKTRACE {
    ULONG       FramePointer;
    ULONG       ProgramCounter;
    ULONG       ReturnAddress;
    ULONG       Args[4];
} EXTSTACKTRACE, *PEXTSTACKTRACE;

Frames
Specifies the maximum number of frames that will fit into the buffer.

Return Value

The actual number of frames written to the buffer pointed to by StackFrames.

Requirements

Headers: Defined in wdbgexts.h. If you are writing a WdbgExts extension, include wdbgexts.h. If you are writing a DbgEng extension that calls this function, include wdbgexts.h before dbgeng.h (see Writing DbgEng Extension Code for details).

Build machine: CAPEBUILD