1 #ifndef TSAN_INTERCEPTORS_H 2 #define TSAN_INTERCEPTORS_H 3 4 #include "sanitizer_common/sanitizer_stacktrace.h" 5 #include "tsan_rtl.h" 6 7 namespace __tsan { 8 9 class ScopedInterceptor { 10 public: 11 ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc); 12 ~ScopedInterceptor(); 13 private: 14 ThreadState *const thr_; 15 const uptr pc_; 16 bool in_ignored_lib_; 17 }; 18 19 } // namespace __tsan 20 21 #define SCOPED_INTERCEPTOR_RAW(func, ...) \ 22 ThreadState *thr = cur_thread(); \ 23 const uptr caller_pc = GET_CALLER_PC(); \ 24 ScopedInterceptor si(thr, #func, caller_pc); \ 25 const uptr pc = StackTrace::GetCurrentPc(); \ 26 (void)pc; \ 27 /**/ 28 29 #if SANITIZER_FREEBSD 30 #define __libc_free __free 31 #define __libc_malloc __malloc 32 #endif 33 34 extern "C" void __libc_free(void *ptr); 35 extern "C" void *__libc_malloc(uptr size); 36 37 #endif // TSAN_INTERCEPTORS_H 38