#include <mexcept.h>
Definition at line 32 of file mexcept.h.
◆ mexception() [1/2]
| mexception::mexception |
( |
const std::string & |
arg, |
|
|
bool |
stack_trace, |
|
|
const char * |
file, |
|
|
int |
line |
|
) |
| |
|
inline |
Definition at line 35 of file mexcept.h.
35 :
36 std::runtime_error(arg) {
37 std::stringstream trace_buf;
39 trace_buf <<
file <<
":" << line <<
": " << arg;
40 else
41 trace_buf << arg;
42
43 if (stack_trace) {
44
45 trace_buf << std::endl << "Stack trace:" << std::endl;
46 void *callstack[128];
47 char buf[1024];
48 int n = backtrace(callstack,
sizeof(callstack) /
sizeof(callstack[0]));
49 char **symbols = backtrace_symbols(callstack,
n);
50 for (
int i = 1;
i <
n;
i++) {
52 if (dladdr(callstack[
i], &
info)) {
53 char *demangled = nullptr;
55 demangled = abi::__cxa_demangle(
info.dli_sname,
nullptr, 0, &
status);
56 snprintf(buf, sizeof(buf), "%-3d 0x%018lX %s + %zd\n",
57 i, (
long unsigned int) callstack[
i],
59 (char *) callstack[
i] - (char *)
info.dli_saddr);
60 free(demangled);
61 } else {
62 snprintf(buf, sizeof(buf), "%-3d 0x%018lX\n",
63 i, (
long unsigned int) callstack[
i]);
64 }
65 trace_buf << buf;
66 }
67 free(symbols);
68 }
69
70 msg = trace_buf.str();
71 }
◆ ~mexception()
| mexception::~mexception |
( |
| ) |
|
| throw | ( | |
| ) | | |
|
inline |
◆ mexception() [2/2]
◆ what()
| const char * mexception::what |
( |
| ) |
const |
| throw | ( | |
| ) | | |
|
inline |
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & |
output, |
|
|
mexception & |
m |
|
) |
| |
|
friend |
Definition at line 79 of file mexcept.h.
79 {
82 };
const char * what() const
static void output(code_int code)
◆ msg
| std::string mexception::msg |
|
private |
The documentation for this class was generated from the following file: