debug: print more extensive errors during abort_with_trace
This commit is contained in:
parent
e15f687e20
commit
cffc3bbc46
16
debug.cpp
16
debug.cpp
@ -70,7 +70,23 @@ warn (const char *msg)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static void abort_with_trace (void)
|
||||
{
|
||||
// If this is because of an exception we may as well rethrow and hope that
|
||||
// the system will print exception data during the abort process.
|
||||
//
|
||||
// But we can at least try to print anything derived from std::exception
|
||||
// (which is a likely guess) before we self-destruct.
|
||||
if (auto ptr = std::current_exception (); ptr) {
|
||||
try {
|
||||
std::rethrow_exception (ptr);
|
||||
} catch (std::exception const &x) {
|
||||
LOG_EMERGENCY ("unhandled exception: %!\n%!", x.what (), debug::backtrace {});
|
||||
} catch (...) {
|
||||
LOG_EMERGENCY ("unhandled exception: %!\n", debug::backtrace {});
|
||||
}
|
||||
} else {
|
||||
LOG_EMERGENCY ("aborting: %!", debug::backtrace {});
|
||||
}
|
||||
|
||||
std::abort ();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user