mlpack  master
Classes | Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
mlpack::Backtrace Class Reference

Provides a backtrace. More...

Classes

struct  Frames
 Backtrace datastructure. More...
 

Public Member Functions

 Backtrace ()
 Constructor initialize fields and call GetAddress to retrieve addresses for each frame of backtrace. More...
 
std::string ToString ()
 Returns string of backtrace. More...
 

Static Private Member Functions

static void DecodeAddress (long address)
 Decodes file name, function & line number. More...
 
static void DemangleFunction ()
 Demangles function name. More...
 
static void GetAddress (int maxDepth)
 Gets addresses of each called function from the stack. More...
 

Private Attributes

struct mlpack::Backtrace::Frames frame
 

Static Private Attributes

static std::vector< Framesstack
 A vector for all the backtrace information. More...
 

Detailed Description

Provides a backtrace.

The Backtrace class retrieve addresses of each called function from the stack and decode file name, function & line number. Retrieved information can be printed in form:

[b]: (count) /directory/to/file.cpp:function(args):line_number

Backtrace is printed always when Log::Assert failed. An example is given below.

if (!someImportantCondition())
{
Log::Fatal << "someImportantCondition() is not satisfied! Terminating.";
Log::Fatal << std::endl;
}
Note
Log::Assert will not be shown when compiling in non-debug mode.
See also
PrefixedOutStream, Log

Definition at line 46 of file backtrace.hpp.

Constructor & Destructor Documentation

mlpack::Backtrace::Backtrace ( )

Constructor initialize fields and call GetAddress to retrieve addresses for each frame of backtrace.

Parameters
maxDepthMaximum depth of backtrace. Default 32 steps.

Member Function Documentation

static void mlpack::Backtrace::DecodeAddress ( long  address)
staticprivate

Decodes file name, function & line number.

Parameters
addressAddress of traced frame.
static void mlpack::Backtrace::DemangleFunction ( )
staticprivate

Demangles function name.

static void mlpack::Backtrace::GetAddress ( int  maxDepth)
staticprivate

Gets addresses of each called function from the stack.

Parameters
maxDepthMaximum depth of backtrace. Default 32 steps.
std::string mlpack::Backtrace::ToString ( )

Returns string of backtrace.

Member Data Documentation

struct mlpack::Backtrace::Frames mlpack::Backtrace::frame
private
std::vector<Frames> mlpack::Backtrace::stack
staticprivate

A vector for all the backtrace information.

Definition at line 91 of file backtrace.hpp.


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