VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Static Protected Member Functions | Static Protected Attributes
DtMiniDumper Class Reference

This class contains the logic necesary for printing a stack trace. More...

+ Collaboration diagram for DtMiniDumper:

Public Member Functions

 DtMiniDumper (const char *szAppName, bool promptUser=true, const char *svnRev=nullptr, bool skipRichCallStack=false)
 CTOR. More...
 

Static Public Member Functions

static void printCallStack (int sig, siginfo_t *info, void *secret)
 Static callback for printing the call stack. More...
 
static std::string backTrace (int skip=0, int maxDepth=100, const void *crashAddress=nullptr)
 Capture the current call stack as a demangled, human-readable string. More...
 

Static Public Attributes

static std::string myApplicationName
 

Protected Types

typedef std::map< std::string,
unsigned long > 
AddressSpaceMap
 

Static Protected Member Functions

static void initializeAddressSpace ()
 Initializes the map of base addresses for loaded object files. More...
 
static void objFileAndNameFromStack (char *stackEntry, std::string &objFile, std::string &objFileName)
 Parses the given stack entry for the object file path and base name. More...
 
static std::string lookupFileInfo (const std::string &objFile, unsigned long offset)
 Looks up the file and line number for the instruction at offset in the given object file. More...
 
static void appendAddr2LineDetail (std::ostream &strm)
 Best-effort legacy pass: appends pmap/addr2line file:line detail for each frame to strm. More...
 

Static Protected Attributes

static AddressSpaceMap myAddressSpaceMap
 Maps loaded object file names to base addresses in memory. More...
 
static bool mySkipRichCallStack
 When true, printCallStack skips the non-async-signal-safe boost::stacktrace/addr2line pass and leaves only the raw dump. More...
 
static char myCallstackLogPath [4096]
 The ".../<name>.callstack.log" path, precomputed once by the constructor. More...
 

Detailed Description

This class contains the logic necesary for printing a stack trace.

On crash (SIGSEGV, SIGABRT, SIGFPE) it captures a demangled backtrace via boost::stacktrace (with a backtrace_symbols() fallback), writes it to a .callstack.log file, echoes it to stderr and DtFatal, then re-raises the signal so the OS can produce a core file. A legacy pmap/addr2line pass can be enabled for extra file:line detail on stripped modules.

Member Typedef Documentation

typedef std::map<std::string, unsigned long> DtMiniDumper::AddressSpaceMap
protected

Constructor & Destructor Documentation

DtMiniDumper::DtMiniDumper ( const char *  szAppName,
bool  promptUser = true,
const char *  svnRev = nullptr,
bool  skipRichCallStack = false 
)

CTOR.

Installs handlers for SIGSEGV, SIGABRT and SIGFPE. Mirrors the Windows constructor so DtINIT_MINIDUMPER is identical on both platforms. szAppName is used as the base name of the .callstack.log file; when null or empty the name is taken from DtLogFileInfo. svnRev is an optional build revision (e.g. the product's SVN_REV) recorded in the crash-log header; DtINIT_MINIDUMPER passes it automatically when the including product defines SVN_REV. skipRichCallStack, when true, suppresses the non-async-signal-safe boost::stacktrace/addr2line pass, leaving only the raw, async-signal-safe dump. Defaults to false (rich pass enabled). Set it to true in environments such as automated tests where a crash inside malloc/free (heap corruption) could otherwise deadlock the rich pass and hang the process. Can also be forced at runtime with the MAK_MINIDUMPER_RAW_ONLY environment variable.

Member Function Documentation

static void DtMiniDumper::appendAddr2LineDetail ( std::ostream &  strm)
staticprotected

Best-effort legacy pass: appends pmap/addr2line file:line detail for each frame to strm.

Enabled only when MAK_MINIDUMPER_LEGACY_ADDR2LINE is set in the environment; boost::stacktrace usually supersedes it.

static std::string DtMiniDumper::backTrace ( int  skip = 0,
int  maxDepth = 100,
const void *  crashAddress = nullptr 
)
static

Capture the current call stack as a demangled, human-readable string.

Parameters
skipNumber of innermost frames to omit (this function is always skipped).
maxDepthMaximum number of frames to capture.
crashAddressWhen non-null, the frame whose instruction address matches this value (e.g. the faulting RIP) is flagged with a ">>>" marker.
static void DtMiniDumper::initializeAddressSpace ( )
staticprotected

Initializes the map of base addresses for loaded object files.

Clears ::myAddresSpaceMap if it has already been initialized.

static std::string DtMiniDumper::lookupFileInfo ( const std::string &  objFile,
unsigned long  offset 
)
staticprotected

Looks up the file and line number for the instruction at offset in the given object file.

static void DtMiniDumper::objFileAndNameFromStack ( char *  stackEntry,
std::string &  objFile,
std::string &  objFileName 
)
staticprotected

Parses the given stack entry for the object file path and base name.

static void DtMiniDumper::printCallStack ( int  sig,
siginfo_t *  info,
void *  secret 
)
static

Static callback for printing the call stack.

Member Data Documentation

AddressSpaceMap DtMiniDumper::myAddressSpaceMap
staticprotected

Maps loaded object file names to base addresses in memory.

std::string DtMiniDumper::myApplicationName
static
char DtMiniDumper::myCallstackLogPath[4096]
staticprotected

The ".../<name>.callstack.log" path, precomputed once by the constructor.

POD (trivially destructible) so printCallStack can safely read it even if static-destruction order has already destroyed myApplicationName (e.g. a crash during __cxa_finalize), which would otherwise corrupt the log file name if it were rebuilt at crash time.

bool DtMiniDumper::mySkipRichCallStack
staticprotected

When true, printCallStack skips the non-async-signal-safe boost::stacktrace/addr2line pass and leaves only the raw dump.

Set from the constructor's skipRichCallStack argument; OR'd at crash time with the MAK_MINIDUMPER_RAW_ONLY environment variable.


The documentation for this class was generated from the following file:

Document ID: Generated on Mon Sep 28 00:09:32 EDT 2026 from SVN revision 295353
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)