tsan_interface.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. #include <sanitizer_common/sanitizer_internal_defs.h>
  17. // This header should NOT include any other headers.
  18. // All functions in this header are extern "C" and start with __tsan_.
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. // This function should be called at the very beginning of the process,
  23. // before any instrumented code is executed and before any call to malloc.
  24. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_init();
  25. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read1(void *addr);
  26. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read2(void *addr);
  27. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read4(void *addr);
  28. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read8(void *addr);
  29. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_read16(void *addr);
  30. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write1(void *addr);
  31. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write2(void *addr);
  32. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write4(void *addr);
  33. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write8(void *addr);
  34. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_write16(void *addr);
  35. SANITIZER_INTERFACE_ATTRIBUTE u16 __tsan_unaligned_read2(const uu16 *addr);
  36. SANITIZER_INTERFACE_ATTRIBUTE u32 __tsan_unaligned_read4(const uu32 *addr);
  37. SANITIZER_INTERFACE_ATTRIBUTE u64 __tsan_unaligned_read8(const uu64 *addr);
  38. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write2(uu16 *addr, u16 v);
  39. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write4(uu32 *addr, u32 v);
  40. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_unaligned_write8(uu64 *addr, u64 v);
  41. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_vptr_read(void **vptr_p);
  42. SANITIZER_INTERFACE_ATTRIBUTE
  43. void __tsan_vptr_update(void **vptr_p, void *new_val);
  44. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_entry(void *call_pc);
  45. SANITIZER_INTERFACE_ATTRIBUTE void __tsan_func_exit();
  46. SANITIZER_INTERFACE_ATTRIBUTE
  47. void __tsan_read_range(void *addr, unsigned long size); // NOLINT
  48. SANITIZER_INTERFACE_ATTRIBUTE
  49. void __tsan_write_range(void *addr, unsigned long size); // NOLINT
  50. #ifdef __cplusplus
  51. } // extern "C"
  52. #endif
  53. #endif // TSAN_INTERFACE_H