_EFN_StackTrace Function
Provides a text representation of a managed stack trace and an array of CONTEXT
records, one for each transition between unmanaged and managed code.
Syntax
HRESULT CALLBACK _EFN_StackTrace(
[in] PDEBUG_CLIENT Client,
[out] WCHAR wszTextOut[],
[out] size_t *puiTextLength,
[out] LPVOID pTransitionContexts,
[out] size_t *puiTransitionContextCount,
[in] size_t uiSizeOfContext,
[in] DWORD Flags
);
Parameters
Client
[in] The client being debugged.
wszTextOut
[out] The text representation of the stack trace.
puiTextLength
[out] A pointer to the number of characters in wszTextOut
.
pTransitionContexts
[out] The array of transition contexts.
puiTransitionContextCount
[out] A pointer to the number of transition contexts in the array.
uiSizeOfContext
[in] The size of the context structure.
Flags
[in] Set to either 0 or SOS_STACKTRACE_SHOWADDRESSES (0x01) to show the EBP register and the enter stack pointer (ESP) in front of each module!functionname
line.
Remarks
The _EFN_StackTrace
structure can be called from a WinDbg programmatic interface. Parameters are used as follows:
If
wszTextOut
is null andpuiTextLength
is not null, the function returns the string length inpuiTextLength
.If
wszTextOut
is not null, the function stores text inwszTextOut
up to the location indicated bypuiTextLength
. It returns successfully if there was enough room in the buffer, or returns E_OUTOFMEMORY if the buffer was not long enough.The transition portion of the function is ignored if
pTransitionContexts
andpuiTransitionContextCount
are both null. In this case, the function provides callers with text output of only the function names.If
pTransitionContexts
is null andpuiTransitionContextCount
is not null, the function returns the necessary number of context entries inpuiTransitionContextCount
.If
pTransitionContexts
is not null, the function treats it as an array of structures of lengthpuiTransitionContextCount
. The structure size is given byuiSizeOfContext
, and must be the size of SimpleContext orCONTEXT
for the architecture.wszTextOut
is written in the following format:"<ModuleName>!<Function Name>[+<offset in hex>] ... (TRANSITION) ..."
If the offset in hex is 0x0, no offset is written.
If there is no managed code on the thread currently in context, the function returns SOS_E_NOMANAGEDCODE.
The
Flags
parameter is either 0 or SOS_STACKTRACE_SHOWADDRESSES to see EBP and ESP in front of eachmodule!functionname
line. By default, it is 0.#define SOS_STACKTRACE_SHOWADDRESSES 0x00000001
Requirements
Platforms: See System Requirements.
Header: SOS_Stacktrace.h
.NET Framework Versions: Available since 2.0