1 //===-- tsan_flags.h --------------------------------------------*- C++ -*-===//
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
6 //===----------------------------------------------------------------------===//
8 // This file is a part of ThreadSanitizer (TSan), a race detector.
9 // NOTE: This file may be included into user code.
10 //===----------------------------------------------------------------------===//
15 #include "sanitizer_common/sanitizer_flags.h"
16 #include "sanitizer_common/sanitizer_deadlock_detector_interface.h"
20 struct Flags
: CommonFlags
, DDFlags
{
21 // Enable dynamic annotations, otherwise they are no-ops.
22 bool enable_annotations
;
23 // Suppress a race report if we've already output another race report
24 // with the same stack.
25 bool suppress_equal_stacks
;
26 // Suppress a race report if we've already output another race report
27 // on the same address.
28 bool suppress_equal_addresses
;
29 // Suppress weird race reports that can be seen if JVM is embed
32 // Turns off bug reporting entirely (useful for benchmarking).
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 incorrect usages of mutexes and mutex annotations?
39 bool report_mutex_bugs
;
40 // Report violations of async signal-safety
41 // (e.g. malloc() call from a signal handler).
42 bool report_signal_unsafe
;
43 // Report races between atomic and plain memory accesses.
44 bool report_atomic_races
;
45 // If set, all atomics are effectively sequentially consistent (seq_cst),
46 // regardless of what user actually specified.
47 bool force_seq_cst_atomics
;
48 // Suppressions filename.
49 const char *suppressions
;
50 // Print matched suppressions at exit.
51 bool print_suppressions
;
52 // Print matched "benign" races at exit.
54 // Override exit status if something was reported.
56 // Exit after first reported error.
58 // Sleep in main thread before exiting for that many ms
59 // (useful to catch "at exit" races).
61 // If set, periodically write memory profile to that file.
62 const char *profile_memory
;
63 // Flush shadow memory every X ms.
65 // Flush symbolizer caches every X ms.
66 int flush_symbolizer_ms
;
67 // Resident memory limit in MB to aim at.
68 // If the process consumes more memory, then TSan will flush shadow memory.
70 // Stops on start until __tsan_resume() is called (for debugging).
72 // Controls whether RunningOnValgrind() returns true or false.
73 bool running_on_valgrind
;
74 // Per-thread history size, controls how many previous memory accesses
75 // are remembered per thread. Possible values are [0..7].
76 // history_size=0 amounts to 32K memory accesses. Each next value doubles
77 // the amount of memory accesses, up to history_size=7 that amounts to
78 // 4M memory accesses. The default value is 2 (128K memory accesses).
80 // Controls level of synchronization implied by IO operations.
81 // 0 - no synchronization
82 // 1 - reasonable level of synchronization (write->read)
83 // 2 - global synchronization of all IO operations
85 // Die after multi-threaded fork if the child creates new threads.
90 void InitializeFlags(Flags
*flags
, const char *env
);
93 #endif // TSAN_FLAGS_H