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