1 #ifndef TSAN_INTERCEPTORS_H
2 #define TSAN_INTERCEPTORS_H
4 #include "sanitizer_common/sanitizer_stacktrace.h"
9 class ScopedInterceptor
{
11 ScopedInterceptor(ThreadState
*thr
, const char *fname
, uptr pc
);
13 void DisableIgnores();
16 ThreadState
*const thr_
;
22 LibIgnore
*libignore();
26 #define SCOPED_INTERCEPTOR_RAW(func, ...) \
27 ThreadState *thr = cur_thread(); \
28 const uptr caller_pc = GET_CALLER_PC(); \
29 ScopedInterceptor si(thr, #func, caller_pc); \
30 const uptr pc = StackTrace::GetCurrentPc(); \
34 #define SCOPED_TSAN_INTERCEPTOR(func, ...) \
35 SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \
36 if (REAL(func) == 0) { \
37 Report("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
40 if (!thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib) \
41 return REAL(func)(__VA_ARGS__); \
44 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START() \
47 #define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END() \
50 #define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
52 #endif // TSAN_INTERCEPTORS_H