2016-02-08 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libsanitizer / tsan / tsan_interface.h
blob4ff6fa1831ee6459d1c91bb2c7ea9dfe6f0bf9c0
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
17 #include <sanitizer_common/sanitizer_internal_defs.h>
19 // This header should NOT include any other headers.
20 // All functions in this header are extern "C" and start with __tsan_.
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
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 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_init();
30 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read1(void *addr);
31 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read2(void *addr);
32 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read4(void *addr);
33 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read8(void *addr);
34 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read16(void *addr);
36 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write1(void *addr);
37 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write2(void *addr);
38 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write4(void *addr);
39 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write8(void *addr);
40 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write16(void *addr);
42 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_read2(const void *addr);
43 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_read4(const void *addr);
44 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_read8(const void *addr);
45 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_read16(const void *addr);
47 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write2(void *addr);
48 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write4(void *addr);
49 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write8(void *addr);
50 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write16(void *addr);
52 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read1_pc(void *addr, void *pc);
53 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read2_pc(void *addr, void *pc);
54 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read4_pc(void *addr, void *pc);
55 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read8_pc(void *addr, void *pc);
56 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read16_pc(void *addr, void *pc);
58 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write1_pc(void *addr, void *pc);
59 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write2_pc(void *addr, void *pc);
60 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write4_pc(void *addr, void *pc);
61 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write8_pc(void *addr, void *pc);
62 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write16_pc(void *addr, void *pc);
64 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_vptr_read(void **vptr_p);
65 SANITIZER_INTERFACE_ATTRIBUTE
66 void __tsan_vptr_update(void **vptr_p, void *new_val);
68 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_entry(void *call_pc);
69 SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_exit();
71 SANITIZER_INTERFACE_ATTRIBUTE
72 void __tsan_read_range(void *addr, unsigned long size); // NOLINT
73 SANITIZER_INTERFACE_ATTRIBUTE
74 void __tsan_write_range(void *addr, unsigned long size); // NOLINT
76 #ifdef __cplusplus
77 } // extern "C"
78 #endif
80 #endif // TSAN_INTERFACE_H