1018981977
libsanitizer/ * All source files: Merge from upstream 285547. * configure.tgt (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): New variable. * configure.ac (SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS): Handle it. * asan/Makefile.am (asan_files): Add new files. * asan/Makefile.in: Regenerate. * ubsan/Makefile.in: Likewise. * lsan/Makefile.in: Likewise. * tsan/Makefile.am (tsan_files): Add new files. * tsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.am (sanitizer_common_files): Add new files. (EXTRA_libsanitizer_common_la_SOURCES): Define. (libsanitizer_common_la_LIBADD): Likewise. (libsanitizer_common_la_DEPENDENCIES): Likewise. * sanitizer_common/Makefile.in: Regenerate. * interception/Makefile.in: Likewise. * libbacktace/Makefile.in: Likewise. * Makefile.in: Likewise. * configure: Likewise. * merge.sh: Handle builtins/assembly.h merging. * builtins/assembly.h: New file. * asan/libtool-version: Bump the libasan SONAME. From-SVN: r241977
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef TSAN_INTERCEPTORS_H
|
|
#include "sanitizer_common/sanitizer_stacktrace.h"
|
|
#include "tsan_rtl.h"
|
|
|
|
namespace __tsan {
|
|
|
|
class ScopedInterceptor {
|
|
public:
|
|
ScopedInterceptor(ThreadState *thr, const char *fname, uptr pc);
|
|
~ScopedInterceptor();
|
|
void UserCallbackStart();
|
|
void UserCallbackEnd();
|
|
private:
|
|
ThreadState *const thr_;
|
|
const uptr pc_;
|
|
bool in_ignored_lib_;
|
|
};
|
|
|
|
} // namespace __tsan
|
|
|
|
#define SCOPED_INTERCEPTOR_RAW(func, ...) \
|
|
ThreadState *thr = cur_thread(); \
|
|
const uptr caller_pc = GET_CALLER_PC(); \
|
|
ScopedInterceptor si(thr, #func, caller_pc); \
|
|
const uptr pc = StackTrace::GetCurrentPc(); \
|
|
(void)pc; \
|
|
/**/
|
|
|
|
#define SCOPED_TSAN_INTERCEPTOR(func, ...) \
|
|
SCOPED_INTERCEPTOR_RAW(func, __VA_ARGS__); \
|
|
if (REAL(func) == 0) { \
|
|
Report("FATAL: ThreadSanitizer: failed to intercept %s\n", #func); \
|
|
Die(); \
|
|
} \
|
|
if (!thr->is_inited || thr->ignore_interceptors || thr->in_ignored_lib) \
|
|
return REAL(func)(__VA_ARGS__); \
|
|
/**/
|
|
|
|
#define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_START() \
|
|
si.UserCallbackStart();
|
|
|
|
#define SCOPED_TSAN_INTERCEPTOR_USER_CALLBACK_END() \
|
|
si.UserCallbackEnd();
|
|
|
|
#define TSAN_INTERCEPTOR(ret, func, ...) INTERCEPTOR(ret, func, __VA_ARGS__)
|
|
|
|
#endif // TSAN_INTERCEPTORS_H
|