1 //===-- tsan_flags.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 // NOTE: This file may be included into user code. 10 //===----------------------------------------------------------------------===// 11 12 #ifndef TSAN_FLAGS_H 13 #define TSAN_FLAGS_H 14 15 // ----------- ATTENTION ------------- 16 // ThreadSanitizer user may provide its implementation of weak 17 // symbol __tsan::OverrideFlags(__tsan::Flags). Therefore, this 18 // header may be included in the user code, and shouldn't include 19 // other headers from TSan or common sanitizer runtime. 20 21 #include "sanitizer_common/sanitizer_flags.h" 22 23 namespace __tsan { 24 25 struct Flags : CommonFlags { 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 // Suppress weird race reports that can be seen if JVM is embed 35 // into the process. 36 bool suppress_java; 37 // Turns off bug reporting entirely (useful for benchmarking). 38 bool report_bugs; 39 // Report thread leaks at exit? 40 bool report_thread_leaks; 41 // Report destruction of a locked mutex? 42 bool report_destroy_locked; 43 // Report violations of async signal-safety 44 // (e.g. malloc() call from a signal handler). 45 bool report_signal_unsafe; 46 // Report races between atomic and plain memory accesses. 47 bool report_atomic_races; 48 // If set, all atomics are effectively sequentially consistent (seq_cst), 49 // regardless of what user actually specified. 50 bool force_seq_cst_atomics; 51 // Suppressions filename. 52 const char *suppressions; 53 // Print matched suppressions at exit. 54 bool print_suppressions; 55 // Print matched "benign" races at exit. 56 bool print_benign; 57 // Override exit status if something was reported. 58 int exitcode; 59 // Exit after first reported error. 60 bool halt_on_error; 61 // Sleep in main thread before exiting for that many ms 62 // (useful to catch "at exit" races). 63 int atexit_sleep_ms; 64 // If set, periodically write memory profile to that file. 65 const char *profile_memory; 66 // Flush shadow memory every X ms. 67 int flush_memory_ms; 68 // Flush symbolizer caches every X ms. 69 int flush_symbolizer_ms; 70 // Resident memory limit in MB to aim at. 71 // If the process consumes more memory, then TSan will flush shadow memory. 72 int memory_limit_mb; 73 // Stops on start until __tsan_resume() is called (for debugging). 74 bool stop_on_start; 75 // Controls whether RunningOnValgrind() returns true or false. 76 bool running_on_valgrind; 77 // Per-thread history size, controls how many previous memory accesses 78 // are remembered per thread. Possible values are [0..7]. 79 // history_size=0 amounts to 32K memory accesses. Each next value doubles 80 // the amount of memory accesses, up to history_size=7 that amounts to 81 // 4M memory accesses. The default value is 2 (128K memory accesses). 82 int history_size; 83 // Controls level of synchronization implied by IO operations. 84 // 0 - no synchronization 85 // 1 - reasonable level of synchronization (write->read) 86 // 2 - global synchronization of all IO operations 87 int io_sync; 88 }; 89 90 Flags *flags(); 91 void InitializeFlags(Flags *flags, const char *env); 92 } // namespace __tsan 93 94 #endif // TSAN_FLAGS_H 95