Quick Links: |
#include <balst_stacktraceprintutil.h>
Static Public Member Functions | |
static bsl::ostream & | printStackTrace (bsl::ostream &stream, int maxFrames=-1, bool demanglingPreferredFlag=true, int additionalIgnoreFrames=0) |
This struct
serves as a namespace for static methods that perform and print a description of a stack trace.
See Component balst_stacktraceprintutil
static bsl::ostream& balst::StackTracePrintUtil::printStackTrace | ( | bsl::ostream & | stream, | |
int | maxFrames = -1 , |
|||
bool | demanglingPreferredFlag = true , |
|||
int | additionalIgnoreFrames = 0 | |||
) | [static] |
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.