* testsuite/26_numerics/headers/cmath/hypot.cc: XFAIL on AIX.
[official-gcc.git] / libsanitizer / tsan / tsan_interceptors.h
blob97fa5085a789d75aafc2d23d9d4681d266069826
1 #ifndef TSAN_INTERCEPTORS_H
2 #include "sanitizer_common/sanitizer_stacktrace.h"
3 #include "tsan_rtl.h"
5 namespace __tsan {
7 class ScopedInterceptor {
8 public:
9 ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc);
10 ~ScopedInterceptor();
11 void UserCallbackStart();
12 void UserCallbackEnd();
13 private:
14 ThreadState *const thr_;
15 const uptr pc_;
16 bool in_ignored_lib_;
19 } // namespace __tsan
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 /**/
29 #define SCOPED_TSAN_INTERCEPTOR(func, ...) \
30 SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \
31 if (REAL(func) == 0) { \
32 Report("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
33 Die(); \
34 } \
35 if (!thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib) \
36 return REAL(func)(__VA_ARGS__); \
37 /**/
39 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START() \
40 si.UserCallbackStart();
42 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END() \
43 si.UserCallbackEnd();
45 #define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
47 #endif // TSAN_INTERCEPTORS_H