[#BloombergLP-balst-StackTraceUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balst.adoc[balst]::StackTraceUtil :relfileprefix: ../../ :mrdocs: This `struct` serves as a namespace for a collection of functions that are useful for initializing and printing a stack‐trace object. == Synopsis Declared in `<balst_stacktraceutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct StackTraceUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balst/StackTraceUtil/hexStackTrace.adoc[`hexStackTrace`] | Write to the specified `stream` the stack addresses from a stack trace of the current thread, in hex from top to bottom, and return `stream`. | xref:BloombergLP/balst/StackTraceUtil/loadStackTraceFromAddressArray.adoc[`loadStackTraceFromAddressArray`] | Populate the specified `result` with stack‐trace information from the stack, described by the specified array of `addresses` of length `numAddresses`. Optionally specify `demanglingPreferredFlag` to indicate whether or not to attempt to perform demangling, however, demangling is always performed on the Windows platform and never performed on Solaris using the CC compiler regardless of the value of `demanglingPreferredFlag`. If `demanglingPreferredFlag` is not specified, demangling is performed on those platforms that support it. Return 0 on success, and a non‐zero value otherwise. Any frames previously contained in the stack‐trace object are discarded. The behavior is undefined unless `addresses` contains at least `numAddresses` addresses. Note that the return addresses from the stack can be obtained by calling `bsls::StackAddressUtil::getStackAddresses`, and that demangling sometimes involves calling `malloc`. | xref:BloombergLP/balst/StackTraceUtil/loadStackTraceFromStack.adoc[`loadStackTraceFromStack`] | Populate the specified `result` object with information about the current thread's program stack. Optionally specify `maxFrames` to indicate the maximum number of frames to take from the top of the stack. If `maxFrames` is not specified, the default limit is at least 1024. Optionally specify `demanglingPreferredFlag` to indicate whether to attempt to perform demangling, if possible. If `demanglingPreferredFlag` is not specfied, demangling is assumed to be preferred, however, demangling is always performed on the Windows platform and never performed on Solaris using the CC compiler regardless of the value of `demanglingPreferredFlag`. Any frames previously contained in the `stackTrace` object are discarded. Return 0 on success, and a non‐zero value otherwise. The behavior is undefined unless `maxFrames` (if specified) is greater than 0. Note that demangling may involve calling `malloc`. | xref:BloombergLP/balst/StackTraceUtil/printFormatted-00.adoc[`printFormatted`] | `printFormatted` overloads | xref:BloombergLP/balst/StackTraceUtil/printHexStackTrace.adoc[`printHexStackTrace`] | Write to the specified `stream` the stack addresses from a stack trace of the current thread, in hex from top to bottom, and return `stream`. Optionally specify `delimiter`, that is to be written between stack addresses. If `delimiter` is not specified, the addresses are separated by a single space. Optionally specify `maxFrames`, the upper limit of the number of frames to obtain, where a negative or unspecified value will be interpreted as a large finite default value. Optionally specify `additionalIgnoreFrames` to be added to the number of frames from the stack top to be ignored and not printed. Optionally specify `allocator` to be used for temporary storage; if none is specified, a locally created heap bypass allocator will be used. The behavior is undefined unless `delimiter != 0` and `additionalIgnoreFrames >= 0`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#