1 #ifndef TSAN_INTERCEPTORS_H
2 #include "sanitizer_common/sanitizer_stacktrace.h"
7 class ScopedInterceptor
{
9 ScopedInterceptor(ThreadState
*thr
, const char *fname
, uptr pc
);
12 ThreadState
*const thr_
;
19 #define SCOPED_INTERCEPTOR_RAW(func, ...) \
20 ThreadState *thr = cur_thread(); \
21 const uptr caller_pc = GET_CALLER_PC(); \
22 ScopedInterceptor si(thr, #func, caller_pc); \
23 const uptr pc = StackTrace::GetCurrentPc(); \
27 #define SCOPED_TSAN_INTERCEPTOR(func, ...) \
28 SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \
29 if (REAL(func) == 0) { \
30 Report("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
33 if (thr->ignore_interceptors || thr->in_ignored_lib) \
34 return REAL(func)(__VA_ARGS__); \
37 #define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
40 #define __libc_free __free
41 #define __libc_malloc __malloc
44 extern "C" void __libc_free(void *ptr
);
45 extern "C" void *__libc_malloc(uptr size
);
47 #endif // TSAN_INTERCEPTORS_H