tsan_flags.h revision 238901
1132718Skan//===-- tsan_flags.h --------------------------------------------*- C++ -*-===// 2169689Skan// 390075Sobrien// The LLVM Compiler Infrastructure 4132718Skan// 590075Sobrien// This file is distributed under the University of Illinois Open Source 690075Sobrien// License. See LICENSE.TXT for details. 7132718Skan// 890075Sobrien//===----------------------------------------------------------------------===// 9132718Skan// 1090075Sobrien// This file is a part of ThreadSanitizer (TSan), a race detector. 1190075Sobrien// NOTE: This file may be included into user code. 1290075Sobrien//===----------------------------------------------------------------------===// 1390075Sobrien 14132718Skan#ifndef TSAN_FLAGS_H 1590075Sobrien#define TSAN_FLAGS_H 1690075Sobrien 1790075Sobrien// ----------- ATTENTION ------------- 1890075Sobrien// ThreadSanitizer user may provide its implementation of weak 1990075Sobrien// symbol __tsan::OverrideFlags(__tsan::Flags). Therefore, this 20132718Skan// header may be included in the user code, and shouldn't include 21169689Skan// other headers from TSan or common sanitizer runtime. 22169689Skan 2390075Sobriennamespace __tsan { 2490075Sobrien 2590075Sobrienstruct Flags { 2690075Sobrien // Enable dynamic annotations, otherwise they are no-ops. 2790075Sobrien bool enable_annotations; 28132718Skan // Supress a race report if we've already output another race report 29132718Skan // with the same stack. 30132718Skan bool suppress_equal_stacks; 31132718Skan // Supress a race report if we've already output another race report 32132718Skan // on the same address. 3390075Sobrien bool suppress_equal_addresses; 34132718Skan // Report thread leaks at exit? 35132718Skan bool report_thread_leaks; 3690075Sobrien // Report violations of async signal-safety 37132718Skan // (e.g. malloc() call from a signal handler). 3890075Sobrien bool report_signal_unsafe; 3990075Sobrien // If set, all atomics are effectively sequentially consistent (seq_cst), 40132718Skan // regardless of what user actually specified. 4190075Sobrien bool force_seq_cst_atomics; 4290075Sobrien // Strip that prefix from file paths in reports. 4390075Sobrien const char *strip_path_prefix; 44132718Skan // Suppressions filename. 45169689Skan const char *suppressions; 46169689Skan // Override exit status if something was reported. 47169689Skan int exitcode; 48169689Skan // Log fileno (1 - stdout, 2 - stderr). 49132718Skan int log_fileno; 50132718Skan // Sleep in main thread before exiting for that many ms 51132718Skan // (useful to catch "at exit" races). 52132718Skan int atexit_sleep_ms; 53132718Skan // Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output). 5490075Sobrien int verbosity; 5590075Sobrien // If set, periodically write memory profile to that file. 56132718Skan const char *profile_memory; 5790075Sobrien // Flush shadow memory every X ms. 58169689Skan int flush_memory_ms; 59132718Skan // Stops on start until __tsan_resume() is called (for debugging). 60169689Skan bool stop_on_start; 61169689Skan // Controls whether RunningOnValgrind() returns true or false. 62132718Skan bool running_on_valgrind; 63132718Skan // If set, uses in-process symbolizer from common sanitizer runtime. 64132718Skan bool use_internal_symbolizer; 6590075Sobrien}; 66132718Skan 67132718SkanFlags *flags(); 68132718Skanvoid InitializeFlags(Flags *flags, const char *env); 69132718Skan} 70132718Skan 71132718Skan#endif // TSAN_FLAGS_H 72132718Skan