blob: 49b79a7c5f9e60cf52a5de6c6a8370b8881e270e [file] [log] [blame]
Pirama Arumuga Nainarcdce50b2015-07-01 12:26:56 -07001#ifndef TSAN_INTERCEPTORS_H
2#define TSAN_INTERCEPTORS_H
3
4#include "sanitizer_common/sanitizer_stacktrace.h"
5#include "tsan_rtl.h"
6
7namespace __tsan {
8
9class 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
34extern "C" void __libc_free(void *ptr);
35extern "C" void *__libc_malloc(uptr size);
36
37#endif // TSAN_INTERCEPTORS_H