32 void* thrownException,
42 using namespace
folly::exception_tracer;
46 template <
typename Function>
47 class CallbackHolder {
49 void registerCallback(Function
f) {
50 callbacks_.wlock()->push_back(
std::move(f));
54 template <
typename...
Args>
56 auto callbacksLock = callbacks_.rlock();
57 for (
auto& cb : *callbacksLock) {
69 namespace exception_tracer {
71 #define DECLARE_CALLBACK(NAME) \ 72 CallbackHolder<NAME##Type>& get##NAME##Callbacks() { \ 73 static Indestructible<CallbackHolder<NAME##Type>> Callbacks; \ 76 void register##NAME##Callback(NAME##Type callback) { \ 77 get##NAME##Callbacks().registerCallback(callback); \ 95 #define __builtin_unreachable() 101 void* thrownException,
102 std::type_info* type,
103 void (*destructor)(
void*)) {
104 static auto orig_cxa_throw =
105 reinterpret_cast<decltype(&
__cxa_throw)
>(dlsym(RTLD_NEXT,
"__cxa_throw"));
107 orig_cxa_throw(thrownException, type, destructor);
108 __builtin_unreachable();
117 static auto orig_cxa_rethrow =
reinterpret_cast<decltype(&
__cxa_rethrow)
>(
118 dlsym(RTLD_NEXT,
"__cxa_rethrow"));
121 __builtin_unreachable();
126 static auto orig_cxa_begin_catch =
128 dlsym(RTLD_NEXT,
"__cxa_begin_catch"));
130 return orig_cxa_begin_catch(excObj);
134 static auto orig_cxa_end_catch =
reinterpret_cast<decltype(&
__cxa_end_catch)
>(
135 dlsym(RTLD_NEXT,
"__cxa_end_catch"));
137 orig_cxa_end_catch();
148 static auto orig_rethrow_exception =
151 "_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE"));
153 orig_rethrow_exception(ep);
154 __builtin_unreachable();
void * __cxa_begin_catch(void *excObj)
PUSHMI_INLINE_VAR constexpr struct folly::pushmi::invoke_fn invoke
void rethrow_exception(std::exception_ptr ep)
#define FOLLY_ALWAYS_INLINE
void __cxa_rethrow(void) __attribute__((__noreturn__))
constexpr detail::Map< Move > move
CallbackHolder< CxaEndCatchType > & getCxaEndCatchCallbacks()
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
CallbackHolder< CxaBeginCatchType > & getCxaBeginCatchCallbacks()
CallbackHolder< CxaRethrowType > & getCxaRethrowCallbacks()
CallbackHolder< CxaThrowType > & getCxaThrowCallbacks()
#define DECLARE_CALLBACK(NAME)
CallbackHolder< RethrowExceptionType > & getRethrowExceptionCallbacks()
__attribute__((noinline, noclone)) VirtualBase *makeVirtual()
void __cxa_end_catch(void)
void __cxa_throw(void *thrownException, std::type_info *type, void(*destructor)(void *)) __attribute__((__noreturn__))