UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FGenericPlatformStackWalk Struct Reference

#include <GenericPlatformStackWalk.h>

+ Inheritance diagram for FGenericPlatformStackWalk:

Classes

struct  EStackWalkFlags
 

Public Types

typedef FGenericPlatformStackWalk Base
 

Static Public Member Functions

static CORE_API void Init ()
 
static bool InitStackWalking ()
 
static bool InitStackWalkingForProcess (const FProcHandle &Process)
 
static CORE_API bool ProgramCounterToHumanReadableString (int32 CurrentCallDepth, uint64 ProgramCounter, ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, FGenericCrashContext *Context=nullptr)
 
static CORE_API bool SymbolInfoToHumanReadableString (const FProgramCounterSymbolInfo &SymbolInfo, ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize)
 
static CORE_API bool SymbolInfoToHumanReadableStringEx (const FProgramCounterSymbolInfoEx &SymbolInfo, FString &out_HumanReadableString)
 
static void ProgramCounterToSymbolInfo (uint64 ProgramCounter, FProgramCounterSymbolInfo &out_SymbolInfo)
 
static void ProgramCounterToSymbolInfoEx (uint64 ProgramCounter, FProgramCounterSymbolInfoEx &out_SymbolInfo)
 
static CORE_API uint32 CaptureStackBackTrace (uint64 *BackTrace, uint32 MaxDepth, void *Context=nullptr)
 
static CORE_API uint32 CaptureThreadStackBackTrace (uint64 ThreadId, uint64 *BackTrace, uint32 MaxDepth, void *Context=nullptr)
 
CORE_API static FORCENOINLINE void StackWalkAndDump (ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, int32 IgnoreCount, void *Context=nullptr)
 
static CORE_API void StackWalkAndDump (ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, void *ProgramCounter, void *Context=nullptr)
 
static CORE_API TArray< FProgramCounterSymbolInfoGetStack (int32 IgnoreCount, int32 MaxDepth=100, void *Context=nullptr)
 
static void ThreadStackWalkAndDump (ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, int32 IgnoreCount, uint32 ThreadId)
 
static CORE_API void StackWalkAndDumpEx (ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, int32 IgnoreCount, uint32 Flags, void *Context=nullptr)
 
static CORE_API void StackWalkAndDumpEx (ANSICHAR *HumanReadableString, SIZE_T HumanReadableStringSize, void *ProgramCounter, uint32 Flags, void *Context=nullptr)
 
static FORCEINLINE int32 GetProcessModuleCount ()
 
static FORCEINLINE int32 GetProcessModuleSignatures (FStackWalkModuleInfo *ModuleSignatures, const int32 ModuleSignaturesSize)
 
static CORE_API TMap< FName, FString > GetSymbolMetaData ()
 
static CORE_API void CopyVirtualPathToLocal (char *Dest, int32 DestCapacity, const char *Source)
 

Static Protected Member Functions

static CORE_API bool WantsDetailedCallstacksInNonMonolithicBuilds ()
 

Detailed Description

Generic implementation for most platforms

Member Typedef Documentation

◆ Base

Member Function Documentation

◆ CaptureStackBackTrace()

uint32 FGenericPlatformStackWalk::CaptureStackBackTrace ( uint64 BackTrace,
uint32  MaxDepth,
void Context = nullptr 
)
static

Capture a stack backtrace and optionally use the passed in exception pointers.

Parameters
BackTrace[out] Pointer to array to take backtrace
MaxDepthEntries in BackTrace array
ContextOptional thread context information

◆ CaptureThreadStackBackTrace()

uint32 FGenericPlatformStackWalk::CaptureThreadStackBackTrace ( uint64  ThreadId,
uint64 BackTrace,
uint32  MaxDepth,
void Context = nullptr 
)
static

Capture a stack backtrace for a specific thread.

Parameters
ThreadIdID of the thread to trace
BackTrace[out] Pointer to array to take backtrace
MaxDepthEntries in BackTrace array
ContextOptional thread context information

◆ CopyVirtualPathToLocal()

void FGenericPlatformStackWalk::CopyVirtualPathToLocal ( char Dest,
int32  DestCapacity,
const char Source 
)
static

Converts virtual path to local and write local path to Dest. If no virtual path if sound, Source will be written

◆ GetProcessModuleCount()

static FORCEINLINE int32 FGenericPlatformStackWalk::GetProcessModuleCount ( )
inlinestatic

Returns the number of modules loaded by the currently running process.

◆ GetProcessModuleSignatures()

static FORCEINLINE int32 FGenericPlatformStackWalk::GetProcessModuleSignatures ( FStackWalkModuleInfo ModuleSignatures,
const int32  ModuleSignaturesSize 
)
inlinestatic

Gets the signature for every module loaded by the currently running process.

Parameters
ModuleSignaturesAn array to retrieve the module signatures.
ModuleSignaturesSizeThe size of the array pointed to by ModuleSignatures.
Returns
The number of modules copied into ModuleSignatures

◆ GetStack()

TArray< FProgramCounterSymbolInfo > FGenericPlatformStackWalk::GetStack ( int32  IgnoreCount,
int32  MaxDepth = 100,
void Context = nullptr 
)
static

Walks the stack and updates the Stack array with the symbol information for each line in the stack.

Parameters
IgnoreCountNumber of stack entries to ignore (some are guaranteed to be in the stack walking code)
MaxDepthThe maximum depth to trace, can't be more than 100, offset from IgnoreCount.
ContextOptional thread context information
Returns
The stack of symbols to return.

◆ GetSymbolMetaData()

TMap< FName, FString > FGenericPlatformStackWalk::GetSymbolMetaData ( )
static

Gets the meta-data associated with all symbols of this target. This may include things that are needed to perform further offline processing of symbol information (eg, the source binary).

Returns
A map containing the meta-data (if any).

◆ Init()

void FGenericPlatformStackWalk::Init ( )
static

Initializes options related to stack walking from ini, i.e. how detailed the stack walking should be, performance settings etc.

◆ InitStackWalking()

static bool FGenericPlatformStackWalk::InitStackWalking ( )
inlinestatic

Initializes stack traversal and symbol. Must be called before any other stack/symbol functions. Safe to reenter.

◆ InitStackWalkingForProcess()

static bool FGenericPlatformStackWalk::InitStackWalkingForProcess ( const FProcHandle Process)
inlinestatic

Like InitStackWalking but initializes stack walking for another process.

Parameters
ProcessProcess that is going to be queried
Returns
True if successful, false otherwise.

◆ ProgramCounterToHumanReadableString()

bool FGenericPlatformStackWalk::ProgramCounterToHumanReadableString ( int32  CurrentCallDepth,
uint64  ProgramCounter,
ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
FGenericCrashContext Context = nullptr 
)
static

Converts the passed in program counter address to a human readable string and appends it to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
: Please, do not override this method. Can't be modified or altered without notice.

This method is the same for all platforms to simplify parsing by the crash processor.

Example formatted line:

UE4Editor_Core!FOutputDeviceWindowsErrorSerialize() (0xddf1bae5) + 620 bytes [\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:110] ModuleName!FunctionName (ProgramCounter) + offset bytes [StrippedFilepath:LineNumber]

Parameters
CurrentCallDepthDepth of the call, if known (-1 if not - note that some platforms may not return meaningful information in the latter case)
ProgramCounterAddress to look symbol information up for
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
ContextPointer to crash context, if any
Returns
true if the symbol was found, otherwise false

◆ ProgramCounterToSymbolInfo()

static void FGenericPlatformStackWalk::ProgramCounterToSymbolInfo ( uint64  ProgramCounter,
FProgramCounterSymbolInfo out_SymbolInfo 
)
inlinestatic

Converts the passed in program counter address to a symbol info struct, filling in module and filename, line number and displacement.

Warning
: The code assumes that the destination strings are big enough
Parameters
ProgramCounterAddress to look symbol information up for
out_SymbolInfoSymbol information associated with program counter

◆ ProgramCounterToSymbolInfoEx()

static void FGenericPlatformStackWalk::ProgramCounterToSymbolInfoEx ( uint64  ProgramCounter,
FProgramCounterSymbolInfoEx out_SymbolInfo 
)
inlinestatic

Same as above, but can be used with external applications since it doesn't re-initialize the active process.

◆ StackWalkAndDump() [1/2]

void FGenericPlatformStackWalk::StackWalkAndDump ( ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
int32  IgnoreCount,
void Context = nullptr 
)
static

Walks the stack and appends the human readable string to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
Parameters
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
IgnoreCountNumber of stack entries to ignore (some are guaranteed to be in the stack walking code)
ContextOptional thread context information

◆ StackWalkAndDump() [2/2]

void FGenericPlatformStackWalk::StackWalkAndDump ( ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
void ProgramCounter,
void Context = nullptr 
)
static

Walks the stack and appends the human readable string to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
Parameters
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
ProgramCounterInstruction address that should be at the top of the stack
ContextOptional thread context information

◆ StackWalkAndDumpEx() [1/2]

void FGenericPlatformStackWalk::StackWalkAndDumpEx ( ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
int32  IgnoreCount,
uint32  Flags,
void Context = nullptr 
)
static

Walks the stack and appends the human readable string to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
Parameters
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
IgnoreCountNumber of stack entries to ignore (some are guaranteed to be in the stack walking code)
FlagsUsed to pass additional information (see StackWalkFlags)
ContextOptional thread context information

◆ StackWalkAndDumpEx() [2/2]

void FGenericPlatformStackWalk::StackWalkAndDumpEx ( ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
void ProgramCounter,
uint32  Flags,
void Context = nullptr 
)
static

Walks the stack and appends the human readable string to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
Parameters
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
ProgramCounterInstruction address that should be at the top of the stack
FlagsUsed to pass additional information (see StackWalkFlags)
ContextOptional thread context information

◆ SymbolInfoToHumanReadableString()

bool FGenericPlatformStackWalk::SymbolInfoToHumanReadableString ( const FProgramCounterSymbolInfo SymbolInfo,
ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize 
)
static

Converts the passed in symbol information to a human readable string and appends it to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
: Please, do not override this method. Can't be modified or altered without notice.

This method is the same for all platforms to simplify parsing by the crash processor.

Example formatted line:

UE4Editor_Core!FOutputDeviceWindowsErrorSerialize() (0xddf1bae5) + 620 bytes [\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:110] ModuleName!FunctionName (ProgramCounter) + offset bytes [StrippedFilepath:LineNumber]

Parameters
SymbolInfoSymbol information
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
ContextPointer to crash context, if any
Returns
true if the symbol was found, otherwise false

◆ SymbolInfoToHumanReadableStringEx()

bool FGenericPlatformStackWalk::SymbolInfoToHumanReadableStringEx ( const FProgramCounterSymbolInfoEx SymbolInfo,
FString &  out_HumanReadableString 
)
static

Same as above, but can be used with external applications.

◆ ThreadStackWalkAndDump()

static void FGenericPlatformStackWalk::ThreadStackWalkAndDump ( ANSICHAR HumanReadableString,
SIZE_T  HumanReadableStringSize,
int32  IgnoreCount,
uint32  ThreadId 
)
inlinestatic

Walks the stack for the specified thread and appends the human readable string to the passed in one.

Warning
: The code assumes that HumanReadableString is large enough to contain the information.
Parameters
HumanReadableStringString to concatenate information with
HumanReadableStringSizesize of string in characters
IgnoreCountNumber of stack entries to ignore (some are guaranteed to be in the stack walking code)
ThreadIdThreadId to walk the strack for.

◆ WantsDetailedCallstacksInNonMonolithicBuilds()

bool FGenericPlatformStackWalk::WantsDetailedCallstacksInNonMonolithicBuilds ( )
staticprotected

Returns true if non-monolithic builds should produce full callstacks in the log (and load all debug symbols)


The documentation for this struct was generated from the following files: