MPQC  3.0.0-alpha
sc::Debugger::Backtrace Class Reference

Creates a backtrace of a running program/thread. More...

#include <util/misc/bug.h>

Public Member Functions

 Backtrace (const std::string &prefix=std::string(""))
 
 Backtrace (const Backtrace &)
 
bool empty () const
 
std::string str (const size_t nframes_to_skip=0) const
 converts to a string More...
 

Detailed Description

Creates a backtrace of a running program/thread.

Example of use:

void make_omelet(int num_eggs) {
if (num_eggs < 1) {
sc::Debugger::Backtrace bt("breakfast fail:");
throw std::runtime_error(bt.str());
}
stove.on();
// etc.
}

Constructor & Destructor Documentation

◆ Backtrace()

sc::Debugger::Backtrace::Backtrace ( const std::string &  prefix = std::string(""))
Parameters
prefixwill be prepended to each line

Member Function Documentation

◆ empty()

bool sc::Debugger::Backtrace::empty ( ) const
inline
Returns
true is did not get a backtrace

◆ str()

std::string sc::Debugger::Backtrace::str ( const size_t  nframes_to_skip = 0) const

converts to a string

Parameters
nframes_to_skiphow many frames to skip
Returns
string representation of Backtrace, with each frame on a separate line, from bottom to top

The documentation for this class was generated from the following file:
sc::Debugger::Backtrace
Creates a backtrace of a running program/thread.
Definition: bug.h:123

Generated at Sun Jan 26 2020 23:24:04 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.