2 #if !defined(_WIN32) && defined(__GLIBC__)
6 #include "exceptiontrace.h"
12 #if defined(WITH_EXCEPTION_TRACE) && !defined(_WIN32) && defined(__GLIBC__)
13 typedef void CxaThrowType(void *, type_info *, void (*)(void *));
14 CxaThrowType *orig_cxa_throw;
21 HookThrow::HookThrow()
23 void *handle = dlopen(0, RTLD_LAZY);
24 orig_cxa_throw = reinterpret_cast<CxaThrowType *>(dlvsym(handle, "__cxa_throw", "CXXABI_1.3"));
31 bool trace_enabled = false;
33 Msp::Debug::Backtrace &get_thread_backtrace()
35 static thread_local Msp::Debug::Backtrace backtrace;
44 void enable_exception_trace(bool e)
49 const Backtrace &get_exception_trace()
51 return get_thread_backtrace();
57 #if defined(WITH_EXCEPTION_TRACE) && !defined(_WIN32) && defined(__GLIBC__)
58 extern "C" void __cxa_throw(void *exc, type_info *type, void (*dest) (void *))
61 get_thread_backtrace() = Msp::Debug::Backtrace::create();
62 orig_cxa_throw(exc, type, dest);