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>

struct StackTraceUtil;

Static Member Functions

Name

Description

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.

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.

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.

printFormatted

printFormatted overloads

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.

Created with MrDocs