1 #include "scd_exception.h"
4 scd_exception::scd_exception(const std::string& msg): _msg(msg)
10 scd_exception::scd_exception(const std::string& msg, int errn)
12 _msg = msg + ": " + std::string(strerror(errn));
17 const char* scd_exception::what() throw() { return _msg.c_str(); }
20 const char* scd_exception::stacktrace() { return _backtrace.c_str(); }
23 void scd_exception::_get_backtrace()
25 void* traces[SCD_EX_TRACES];
26 int num_traces = backtrace(traces, SCD_EX_TRACES);
27 char ** symbols = backtrace_symbols(traces, num_traces);
28 for (int i = 0; i < num_traces; i++)
30 _backtrace += std::string(symbols[i]);
35 } // _obtain_backtrace()