![]() |
VR-Link API Documentation for HLA 4
|
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... | |
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.
|
protected |
| 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.
|
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 |
Capture the current call stack as a demangled, human-readable string.
| skip | Number of innermost frames to omit (this function is always skipped). |
| maxDepth | Maximum number of frames to capture. |
| crashAddress | When non-null, the frame whose instruction address matches this value (e.g. the faulting RIP) is flagged with a ">>>" marker. |
|
staticprotected |
Initializes the map of base addresses for loaded object files.
Clears ::myAddresSpaceMap if it has already been initialized.
|
staticprotected |
Looks up the file and line number for the instruction at offset in the given object file.
|
staticprotected |
Parses the given stack entry for the object file path and base name.
|
static |
Static callback for printing the call stack.
|
staticprotected |
Maps loaded object file names to base addresses in memory.
|
static |
|
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.
|
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.