tsan_flags.h revision c78773e8c3db9e191e736acdc608e7d81ac42513
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 23namespace __tsan { 24 25struct 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 // 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 // Strip that prefix from file paths in reports. 52 const char *strip_path_prefix; 53 // Suppressions filename. 54 const char *suppressions; 55 // Print matched suppressions at exit. 56 bool print_suppressions; 57 // Print matched "benign" races at exit. 58 bool print_benign; 59 // Override exit status if something was reported. 60 int exitcode; 61 // Exit after first reported error. 62 bool halt_on_error; 63 // Write logs to "log_path.pid". 64 // The special values are "stdout" and "stderr". 65 // The default is "stderr". 66 const char *log_path; 67 // Sleep in main thread before exiting for that many ms 68 // (useful to catch "at exit" races). 69 int atexit_sleep_ms; 70 // Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output). 71 int verbosity; 72 // If set, periodically write memory profile to that file. 73 const char *profile_memory; 74 // Flush shadow memory every X ms. 75 int flush_memory_ms; 76 // Flush symbolizer caches every X ms. 77 int flush_symbolizer_ms; 78 // Stops on start until __tsan_resume() is called (for debugging). 79 bool stop_on_start; 80 // Controls whether RunningOnValgrind() returns true or false. 81 bool running_on_valgrind; 82 // Path to external symbolizer. 83 const char *external_symbolizer_path; 84 // Per-thread history size, controls how many previous memory accesses 85 // are remembered per thread. Possible values are [0..7]. 86 // history_size=0 amounts to 32K memory accesses. Each next value doubles 87 // the amount of memory accesses, up to history_size=7 that amounts to 88 // 4M memory accesses. The default value is 2 (128K memory accesses). 89 int history_size; 90 // Controls level of synchronization implied by IO operations. 91 // 0 - no synchronization 92 // 1 - reasonable level of synchronization (write->read) 93 // 2 - global synchronization of all IO operations 94 int io_sync; 95 // If false, the allocator will crash instead of returning 0 on out-of-memory. 96 bool allocator_may_return_null; 97}; 98 99Flags *flags(); 100void InitializeFlags(Flags *flags, const char *env); 101} // namespace __tsan 102 103#endif // TSAN_FLAGS_H 104