[#BloombergLP-balst-StackTracePrintUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balst.adoc[balst]::StackTracePrintUtil :relfileprefix: ../../ :mrdocs: This `struct` serves as a namespace for static methods that perform and print a description of a stack trace. == Synopsis Declared in `<balst_stacktraceprintutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct StackTracePrintUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balst/StackTracePrintUtil/logExceptionStackTrace.adoc[`logExceptionStackTrace`] | Log a message using `BSLS_LOG` consisting of "About to throw <exceptionName>. <message>" followed by a stack trace. This function is to be set as an exception "pre throw hook" for the component `bslstl_stdexceptutil`. If this funciton is set as the pre throw hook, it will be called prior to exceptions being thrown, Note that this function requires considerable disk access and is therefore slow, so it should not be used for frequently‐occurring exceptions that are expected to be caught and recovered from. | xref:BloombergLP/balst/StackTracePrintUtil/printStackTrace.adoc[`printStackTrace`] | Obtain a trace of the stack and print it to the specified `stream`. Optionally specify `maxFrames` indicating the maximum number of frames from the top of the stack that will be printed. If `maxFrames` is not specified, a value of at least 1024 is used. Optionally specify `demanglingPreferredFlag`, indicating a preference whether to attempt to demangle function names. If `damanglingPreferredFlag` is not specified, an attempt to demangle is assumed. If an error occurs, a single‐line error message is printed to `stream`. Optionally specify `additionalIgnoreFrames` which is added to `bsls::StackAddressUtil::k_IGNORE_FRAMES` to ignore frames of the caller. Return a reference to 'stream. The behavior is undefined unless `‐1 <= maxFrames` and `0 <= additionalIgnoreFrames`. Note that attempting to demangle symbol names could involve calling `malloc`, and that symbol names are always demangled on the Windows platform. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#