| #ifndef THIRD_PARTY_GBMCWEB_INCLUDE_EXCEPTION_STACK_TRACER_HPP_ | |
| #define THIRD_PARTY_GBMCWEB_INCLUDE_EXCEPTION_STACK_TRACER_HPP_ | |
| // Installs a std::terminate handler that prints the ORIGINAL throw-site stack | |
| // of the uncaught exception, recorded at throw time by a __cxa_throw | |
| // interposer (folly exception_tracer mechanism). Exceptions captured into a | |
| // std::exception_ptr and rethrown later (asio scheduler | |
| // rethrow_pending_exception, sdbusplus do_unpack posted rethrow) otherwise | |
| // terminate with a stack that only shows the rethrow site. | |
| // | |
| // The terminate path never allocates, takes no locks, and guards against | |
| // re-entry; see src/exception_stack_tracer.cpp for the full constraints. | |
| // | |
| // The interposer is active as soon as its TU is linked in; this call installs | |
| // the terminate handler and snapshots the module table used to symbolize | |
| // frames. Call it first thing in run() so nothing on the crash path | |
| // allocates, dlopens, or takes the loader lock. | |
| // | |
| // With enable == false (--exception_stack_tracer=false kill switch), | |
| // recording becomes a no-op and the default terminate handler is kept. | |
| void installExceptionStackTracer(bool enable = true); | |
| #endif // THIRD_PARTY_GBMCWEB_INCLUDE_EXCEPTION_STACK_TRACER_HPP_ |