X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fexperimental%2Fexception_tracer%2FExceptionTracerLib.cpp;h=8643623d176b70da70efc541389ddf99d2e4af85;hp=61803e7ddd8493ac96558736d2996cadad6b57c4;hb=ce64f0f685111ac24c7a321ea56d0c3524621df1;hpb=22afce906d7e98d95f8c45c3301072d9fd891d41 diff --git a/folly/experimental/exception_tracer/ExceptionTracerLib.cpp b/folly/experimental/exception_tracer/ExceptionTracerLib.cpp index 61803e7d..8643623d 100644 --- a/folly/experimental/exception_tracer/ExceptionTracerLib.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracerLib.cpp @@ -20,19 +20,19 @@ #include -#include "folly/Portability.h" -#include "folly/experimental/exception_tracer/StackTrace.h" -#include "folly/experimental/exception_tracer/ExceptionAbi.h" -#include "folly/experimental/exception_tracer/ExceptionTracer.h" -#include "folly/experimental/symbolizer/Symbolizer.h" +#include +#include +#include +#include +#include namespace __cxxabiv1 { extern "C" { -void __cxa_throw(void* thrownException, std::type_info* type, - void (*destructor)(void)) FOLLY_NORETURN; +FOLLY_NORETURN void __cxa_throw(void* thrownException, + std::type_info* type, void (*destructor)(void)); void* __cxa_begin_catch(void* excObj); -void __cxa_rethrow(void) FOLLY_NORETURN; +FOLLY_NORETURN void __cxa_rethrow(void); void __cxa_end_catch(void); } @@ -42,17 +42,16 @@ using namespace folly::exception_tracer; namespace { -__thread bool invalid; -__thread StackTraceStack activeExceptions; -__thread StackTraceStack caughtExceptions; +FOLLY_TLS bool invalid; +FOLLY_TLS StackTraceStack activeExceptions; +FOLLY_TLS StackTraceStack caughtExceptions; pthread_once_t initialized = PTHREAD_ONCE_INIT; extern "C" { -typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void)) - FOLLY_NORETURN; +FOLLY_NORETURN typedef void (*CxaThrowType)(void*, std::type_info*, + void (*)(void)); typedef void* (*CxaBeginCatchType)(void*); -typedef void (*CxaRethrowType)(void) - FOLLY_NORETURN; +FOLLY_NORETURN typedef void (*CxaRethrowType)(void); typedef void (*CxaEndCatchType)(void); CxaThrowType orig_cxa_throw; @@ -61,8 +60,7 @@ CxaRethrowType orig_cxa_rethrow; CxaEndCatchType orig_cxa_end_catch; } // extern "C" -typedef void (*RethrowExceptionType)(std::exception_ptr) - FOLLY_NORETURN; +FOLLY_NORETURN typedef void (*RethrowExceptionType)(std::exception_ptr); RethrowExceptionType orig_rethrow_exception; void initialize() { @@ -96,7 +94,7 @@ extern "C" StackTraceStack* getExceptionStackTraceStack() { namespace { // Make sure we're counting stack frames correctly, don't inline. -void addActiveException() __attribute__((noinline)); +FOLLY_NOINLINE void addActiveException(); void addActiveException() { pthread_once(&initialized, initialize);