• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- tsan_flags.h --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of ThreadSanitizer (TSan), a race detector.
11 // NOTE: This file may be included into user code.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef TSAN_FLAGS_H
15 #define TSAN_FLAGS_H
16 
17 // ----------- ATTENTION -------------
18 // ThreadSanitizer user may provide its implementation of weak
19 // symbol __tsan::OverrideFlags(__tsan::Flags). Therefore, this
20 // header may be included in the user code, and shouldn't include
21 // other headers from TSan or common sanitizer runtime.
22 
23 namespace __tsan {
24 
25 struct Flags {
26   // Enable dynamic annotations, otherwise they are no-ops.
27   bool enable_annotations;
28   // Supress a race report if we've already output another race report
29   // with the same stack.
30   bool suppress_equal_stacks;
31   // Supress a race report if we've already output another race report
32   // on the same address.
33   bool suppress_equal_addresses;
34   // Report thread leaks at exit?
35   bool report_thread_leaks;
36   // Report destruction of a locked mutex?
37   bool report_destroy_locked;
38   // Report violations of async signal-safety
39   // (e.g. malloc() call from a signal handler).
40   bool report_signal_unsafe;
41   // If set, all atomics are effectively sequentially consistent (seq_cst),
42   // regardless of what user actually specified.
43   bool force_seq_cst_atomics;
44   // Strip that prefix from file paths in reports.
45   const char *strip_path_prefix;
46   // Suppressions filename.
47   const char *suppressions;
48   // Override exit status if something was reported.
49   int exitcode;
50   // Log fileno (1 - stdout, 2 - stderr).
51   int log_fileno;
52   // Sleep in main thread before exiting for that many ms
53   // (useful to catch "at exit" races).
54   int atexit_sleep_ms;
55   // Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).
56   int verbosity;
57   // If set, periodically write memory profile to that file.
58   const char *profile_memory;
59   // Flush shadow memory every X ms.
60   int flush_memory_ms;
61   // Stops on start until __tsan_resume() is called (for debugging).
62   bool stop_on_start;
63   // Controls whether RunningOnValgrind() returns true or false.
64   bool running_on_valgrind;
65   // Path to external symbolizer.
66   const char *external_symbolizer_path;
67 };
68 
69 Flags *flags();
70 void InitializeFlags(Flags *flags, const char *env);
71 }
72 
73 #endif  // TSAN_FLAGS_H
74