xref: /netbsd-src/external/gpl3/gcc/dist/libsanitizer/tsan/tsan_interface.h (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 //===-- tsan_interface.h ----------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 //
10 // The functions declared in this header will be inserted by the instrumentation
11 // module.
12 // This header can be included by the instrumented program or by TSan tests.
13 //===----------------------------------------------------------------------===//
14 #ifndef TSAN_INTERFACE_H
15 #define TSAN_INTERFACE_H
16 
17 #include <sanitizer_common/sanitizer_internal_defs.h>
18 
19 // This header should NOT include any other headers.
20 // All functions in this header are extern "C" and start with __tsan_.
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 // This function should be called at the very beginning of the process,
27 // before any instrumented code is executed and before any call to malloc.
28 void __tsan_init() SANITIZER_INTERFACE_ATTRIBUTE;
29 
30 void __tsan_read1(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
31 void __tsan_read2(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
32 void __tsan_read4(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
33 void __tsan_read8(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
34 void __tsan_read16(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
35 
36 void __tsan_write1(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
37 void __tsan_write2(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
38 void __tsan_write4(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
39 void __tsan_write8(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
40 void __tsan_write16(void *addr) SANITIZER_INTERFACE_ATTRIBUTE;
41 
42 void __tsan_vptr_update(void **vptr_p, void *new_val)
43     SANITIZER_INTERFACE_ATTRIBUTE;
44 
45 void __tsan_func_entry(void *call_pc) SANITIZER_INTERFACE_ATTRIBUTE;
46 void __tsan_func_exit() SANITIZER_INTERFACE_ATTRIBUTE;
47 
48 void __tsan_read_range(void *addr, unsigned long size)  // NOLINT
49     SANITIZER_INTERFACE_ATTRIBUTE;
50 void __tsan_write_range(void *addr, unsigned long size)  // NOLINT
51     SANITIZER_INTERFACE_ATTRIBUTE;
52 
53 #ifdef __cplusplus
54 }  // extern "C"
55 #endif
56 
57 #endif  // TSAN_INTERFACE_H
58