CARMA C++
carma::util::Backtrace Class Reference

Class to hold a captured call stack backtrace. More...

#include <carma/util/Backtrace.h>

Public Member Functions

 Backtrace ()
 Constructor that sets this instance to invalid. More...
 
bool captured () const
 
bool capturedAndValid () const
 
bool captureNoThrow ()
 Method that captures a backtrace if it can and stores it in this instance. More...
 
bool captureNoThrow (size_t maxDepth)
 
bool captureNoThrow (bool convertToSymbols)
 
bool captureNoThrow (size_t maxDepth, bool convertToSymbols)
 
void convertToSymbols ()
 
::std::string formattedAsString () const
 Returns a formatted multiline string representation of any valid backtrace stored in this instance. More...
 
::std::string formattedAsString (const char *linePrefix, const char *lineSuffix) const
 Returns a formatted multiline string representation of any valid backtrace stored in this instance. More...
 
::std::string formattedAsString (const ::std::string &linePrefix, const ::std::string &lineSuffix) const
 Returns a formatted multiline string representation of any valid backtrace stored in this instance. More...
 
 ~Backtrace ()
 Destructor. More...
 

Static Public Member Functions

::std::string captureAsString ()
 Capture backtrace for the active call stack as a string. More...
 
::std::string captureAsString (const char *linePrefix, const char *lineSuffix)
 Capture backtrace for the active call stack as a string. More...
 
::std::string captureAsString (const ::std::string &linePrefix, const ::std::string &lineSuffix)
 Capture backtrace for the active call stack as a string. More...
 
::std::string demangleSymbolLine (const ::std::string &line)
 
::std::string demangleSymbolLine (const char *line)
 
static void demangleSymbolLineInPlace (::std::string &line)
 

Detailed Description

Class to hold a captured call stack backtrace.

Definition at line 16 of file Backtrace.h.

Constructor & Destructor Documentation

carma::util::Backtrace::Backtrace ( )
explicit

Constructor that sets this instance to invalid.

Construction does not implicitly capture a backtrace.

carma::util::Backtrace::~Backtrace ( )

Destructor.

Member Function Documentation

::std::string carma::util::Backtrace::captureAsString ( )
static

Capture backtrace for the active call stack as a string.

::std::string carma::util::Backtrace::captureAsString ( const char *  linePrefix,
const char *  lineSuffix 
)
static

Capture backtrace for the active call stack as a string.

Parameters
linePrefixString prefixed to each line of the result
lineSuffixString suffixed to each line of the result
::std::string carma::util::Backtrace::captureAsString ( const ::std::string &  linePrefix,
const ::std::string &  lineSuffix 
)
static

Capture backtrace for the active call stack as a string.

Parameters
linePrefixString prefixed to each line of the result
lineSuffixString suffixed to each line of the result
bool carma::util::Backtrace::captureNoThrow ( )

Method that captures a backtrace if it can and stores it in this instance.

If the capture fails then return value is false and this instance is set to invalid.

Returns
true if the capture succeeds, false otherwise.
::std::string carma::util::Backtrace::formattedAsString ( ) const

Returns a formatted multiline string representation of any valid backtrace stored in this instance.

Returns
Formatted string representation of any valid backtrace stored in this instance.
::std::string carma::util::Backtrace::formattedAsString ( const char *  linePrefix,
const char *  lineSuffix 
) const

Returns a formatted multiline string representation of any valid backtrace stored in this instance.

Parameters
linePrefixString prefixed to each line of the result
lineSuffixString suffixed to each line of the result
Returns
Formatted string representation of any valid backtrace stored in this instance.
::std::string carma::util::Backtrace::formattedAsString ( const ::std::string &  linePrefix,
const ::std::string &  lineSuffix 
) const

Returns a formatted multiline string representation of any valid backtrace stored in this instance.

Parameters
linePrefixString prefixed to each line of the result
lineSuffixString suffixed to each line of the result
Returns
Formatted string representation of any valid backtrace stored in this instance.

The documentation for this class was generated from the following file: