1//===-- tsan_flags.inc ------------------------------------------*- 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// TSan runtime flags.
9//
10//===----------------------------------------------------------------------===//
11#ifndef TSAN_FLAG
12# error "Define TSAN_FLAG prior to including this file!"
13#endif
14
15// TSAN_FLAG(Type, Name, DefaultValue, Description)
16// See COMMON_FLAG in sanitizer_flags.inc for more details.
17
18TSAN_FLAG(bool, enable_annotations, true,
19          "Enable dynamic annotations, otherwise they are no-ops.")
20// Suppress a race report if we've already output another race report
21// with the same stack.
22TSAN_FLAG(bool, suppress_equal_stacks, true,
23          "Suppress a race report if we've already output another race report "
24          "with the same stack.")
25TSAN_FLAG(bool, suppress_equal_addresses, true,
26          "Suppress a race report if we've already output another race report "
27          "on the same address.")
28
29TSAN_FLAG(bool, report_bugs, true,
30          "Turns off bug reporting entirely (useful for benchmarking).")
31TSAN_FLAG(bool, report_thread_leaks, true, "Report thread leaks at exit?")
32TSAN_FLAG(bool, report_destroy_locked, true,
33          "Report destruction of a locked mutex?")
34TSAN_FLAG(bool, report_mutex_bugs, true,
35          "Report incorrect usages of mutexes and mutex annotations?")
36TSAN_FLAG(bool, report_signal_unsafe, true,
37          "Report violations of async signal-safety "
38          "(e.g. malloc() call from a signal handler).")
39TSAN_FLAG(bool, report_atomic_races, true,
40          "Report races between atomic and plain memory accesses.")
41TSAN_FLAG(
42    bool, force_seq_cst_atomics, false,
43    "If set, all atomics are effectively sequentially consistent (seq_cst), "
44    "regardless of what user actually specified.")
45TSAN_FLAG(bool, print_benign, false, "Print matched \"benign\" races at exit.")
46TSAN_FLAG(bool, halt_on_error, false, "Exit after first reported error.")
47TSAN_FLAG(int, atexit_sleep_ms, 1000,
48          "Sleep in main thread before exiting for that many ms "
49          "(useful to catch \"at exit\" races).")
50TSAN_FLAG(const char *, profile_memory, "",
51          "If set, periodically write memory profile to that file.")
52TSAN_FLAG(int, flush_memory_ms, 0, "Flush shadow memory every X ms.")
53TSAN_FLAG(int, flush_symbolizer_ms, 5000, "Flush symbolizer caches every X ms.")
54TSAN_FLAG(
55    int, memory_limit_mb, 0,
56    "Resident memory limit in MB to aim at."
57    "If the process consumes more memory, then TSan will flush shadow memory.")
58TSAN_FLAG(bool, stop_on_start, false,
59          "Stops on start until __tsan_resume() is called (for debugging).")
60TSAN_FLAG(bool, running_on_valgrind, false,
61          "Controls whether RunningOnValgrind() returns true or false.")
62// There are a lot of goroutines in Go, so we use smaller history.
63TSAN_FLAG(
64    int, history_size, SANITIZER_GO ? 1 : 3,
65    "Per-thread history size, controls how many previous memory accesses "
66    "are remembered per thread.  Possible values are [0..7]. "
67    "history_size=0 amounts to 32K memory accesses.  Each next value doubles "
68    "the amount of memory accesses, up to history_size=7 that amounts to "
69    "4M memory accesses.  The default value is 2 (128K memory accesses).")
70TSAN_FLAG(int, io_sync, 1,
71          "Controls level of synchronization implied by IO operations. "
72          "0 - no synchronization "
73          "1 - reasonable level of synchronization (write->read)"
74          "2 - global synchronization of all IO operations.")
75TSAN_FLAG(bool, die_after_fork, true,
76          "Die after multi-threaded fork if the child creates new threads.")
77TSAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
78TSAN_FLAG(bool, ignore_interceptors_accesses, false,
79          "Ignore reads and writes from all interceptors.")
80TSAN_FLAG(bool, ignore_noninstrumented_modules, SANITIZER_MAC ? true : false,
81          "Interceptors should only detect races when called from instrumented "
82          "modules.")
83TSAN_FLAG(bool, shared_ptr_interceptor, true,
84          "Track atomic reference counting in libc++ shared_ptr and weak_ptr.")
85