[#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&hyphen;trace object&period;

== Synopsis

Declared in `&lt;balst&lowbar;stacktraceutil&period;h&gt;`

[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`&period;
| xref:BloombergLP/balst/StackTraceUtil/loadStackTraceFromAddressArray.adoc[`loadStackTraceFromAddressArray`] 
| Populate the specified `result` with stack&hyphen;trace information from the stack, described by the specified array of `addresses` of length `numAddresses`&period; 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`&period; If `demanglingPreferredFlag` is not specified, demangling is performed on those platforms that support it&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; Any frames previously contained in the stack&hyphen;trace object are discarded&period; The behavior is undefined unless `addresses` contains at least `numAddresses` addresses&period; Note that the return addresses from the stack can be obtained by calling `bsls&colon;&colon;StackAddressUtil&colon;&colon;getStackAddresses`, and that demangling sometimes involves calling `malloc`&period;
| xref:BloombergLP/balst/StackTraceUtil/loadStackTraceFromStack.adoc[`loadStackTraceFromStack`] 
| Populate the specified `result` object with information about the current thread&apos;s program stack&period; Optionally specify `maxFrames` to indicate the maximum number of frames to take from the top of the stack&period; If `maxFrames` is not specified, the default limit is at least 1024&period; Optionally specify `demanglingPreferredFlag` to indicate whether to attempt to perform demangling, if possible&period; 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`&period; Any frames previously contained in the `stackTrace` object are discarded&period; Return 0 on success, and a non&hyphen;zero value otherwise&period; The behavior is undefined unless `maxFrames` (if specified) is greater than 0&period; Note that demangling may involve calling `malloc`&period;
| 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`&period; Optionally specify `delimiter`, that is to be written between stack addresses&period; If `delimiter` is not specified, the addresses are separated by a single space&period; 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&period; Optionally specify `additionalIgnoreFrames` to be added to the number of frames from the stack top to be ignored and not printed&period; Optionally specify `allocator` to be used for temporary storage&semi; if none is specified, a locally created heap bypass allocator will be used&period; The behavior is undefined unless `delimiter !&equals; 0` and `additionalIgnoreFrames &gt;&equals; 0`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
