ttg::detail::Backtrace Class Reference
Documentation
Creates a backtrace of a running program/thread. Example of use:
void make_omelet(int num_eggs) {
if (num_eggs < 1) {
ttg::detail::Backtrace bt("breakfast fail:");
throw std::runtime_error(bt.str());
}
stove.on();
// etc.
}
Definition: backtrace.h:50
Definition at line 50 of file backtrace.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 |
Constructor & Destructor Documentation
◆ Backtrace() [1/2]
ttg::detail::Backtrace::Backtrace | ( | const std::string & | prefix = std::string("") | ) |
- Parameters
-
prefix will be prepended to each line
Definition at line 51 of file backtrace.cpp.
◆ Backtrace() [2/2]
ttg::detail::Backtrace::Backtrace | ( | const Backtrace & | other | ) |
Definition at line 152 of file backtrace.cpp.
Member Function Documentation
◆ empty()
|
inline |
- Returns
- true if did not get a backtrace
Definition at line 61 of file backtrace.h.
◆ str()
std::string ttg::detail::Backtrace::str | ( | const size_t | nframes_to_skip = 0 | ) | const |
converts to a string
- Parameters
-
nframes_to_skip how many frames to skip
- Returns
- string representation of Backtrace, with each frame on a separate line, from bottom to top
Definition at line 154 of file backtrace.cpp.
The documentation for this class was generated from the following files:
- ttg/ttg/util/backtrace.h
- ttg/ttg/util/backtrace.cpp