2012-05-10 21:48:04 +08:00
|
|
|
//===-- tsan_flags.h --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is a part of ThreadSanitizer (TSan), a race detector.
|
2012-06-19 16:57:53 +08:00
|
|
|
// NOTE: This file may be included into user code.
|
2012-05-10 21:48:04 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef TSAN_FLAGS_H
|
|
|
|
#define TSAN_FLAGS_H
|
|
|
|
|
2012-06-19 16:57:53 +08:00
|
|
|
// ----------- ATTENTION -------------
|
|
|
|
// ThreadSanitizer user may provide its implementation of weak
|
|
|
|
// symbol __tsan::OverrideFlags(__tsan::Flags). Therefore, this
|
|
|
|
// header may be included in the user code, and shouldn't include
|
|
|
|
// other headers from TSan or common sanitizer runtime.
|
|
|
|
|
2012-05-10 21:48:04 +08:00
|
|
|
namespace __tsan {
|
|
|
|
|
|
|
|
struct Flags {
|
|
|
|
// Enable dynamic annotations, otherwise they are no-ops.
|
|
|
|
bool enable_annotations;
|
|
|
|
// Supress a race report if we've already output another race report
|
|
|
|
// with the same stack.
|
|
|
|
bool suppress_equal_stacks;
|
|
|
|
// Supress a race report if we've already output another race report
|
|
|
|
// on the same address.
|
|
|
|
bool suppress_equal_addresses;
|
2012-12-01 01:45:53 +08:00
|
|
|
// Suppress weird race reports that can be seen if JVM is embed
|
|
|
|
// into the process.
|
|
|
|
bool suppress_java;
|
2012-11-08 00:14:12 +08:00
|
|
|
// Turns off bug reporting entirely (useful for benchmarking).
|
|
|
|
bool report_bugs;
|
2012-05-10 21:48:04 +08:00
|
|
|
// Report thread leaks at exit?
|
|
|
|
bool report_thread_leaks;
|
2012-08-16 23:12:35 +08:00
|
|
|
// Report destruction of a locked mutex?
|
|
|
|
bool report_destroy_locked;
|
2012-05-10 21:48:04 +08:00
|
|
|
// Report violations of async signal-safety
|
|
|
|
// (e.g. malloc() call from a signal handler).
|
|
|
|
bool report_signal_unsafe;
|
2013-02-01 18:06:56 +08:00
|
|
|
// Report races between atomic and plain memory accesses.
|
|
|
|
bool report_atomic_races;
|
2012-05-10 21:48:04 +08:00
|
|
|
// If set, all atomics are effectively sequentially consistent (seq_cst),
|
|
|
|
// regardless of what user actually specified.
|
|
|
|
bool force_seq_cst_atomics;
|
|
|
|
// Strip that prefix from file paths in reports.
|
|
|
|
const char *strip_path_prefix;
|
|
|
|
// Suppressions filename.
|
|
|
|
const char *suppressions;
|
2013-03-28 01:59:57 +08:00
|
|
|
// Print matched suppressions at exit.
|
|
|
|
bool print_suppressions;
|
2013-03-29 00:21:19 +08:00
|
|
|
// Print matched "benign" races at exit.
|
|
|
|
bool print_benign;
|
2012-05-10 21:48:04 +08:00
|
|
|
// Override exit status if something was reported.
|
|
|
|
int exitcode;
|
2013-08-13 23:33:00 +08:00
|
|
|
// Exit after first reported error.
|
|
|
|
bool halt_on_error;
|
2012-11-28 20:56:52 +08:00
|
|
|
// Write logs to "log_path.pid".
|
|
|
|
// The special values are "stdout" and "stderr".
|
|
|
|
// The default is "stderr".
|
2012-11-30 14:50:15 +08:00
|
|
|
const char *log_path;
|
2012-05-10 21:48:04 +08:00
|
|
|
// Sleep in main thread before exiting for that many ms
|
|
|
|
// (useful to catch "at exit" races).
|
|
|
|
int atexit_sleep_ms;
|
|
|
|
// Verbosity level (0 - silent, 1 - a bit of output, 2+ - more output).
|
|
|
|
int verbosity;
|
2012-05-22 19:33:03 +08:00
|
|
|
// If set, periodically write memory profile to that file.
|
|
|
|
const char *profile_memory;
|
2012-05-23 02:07:45 +08:00
|
|
|
// Flush shadow memory every X ms.
|
|
|
|
int flush_memory_ms;
|
2013-03-21 21:01:50 +08:00
|
|
|
// Flush symbolizer caches every X ms.
|
|
|
|
int flush_symbolizer_ms;
|
2013-10-03 22:00:46 +08:00
|
|
|
// Resident memory limit in MB to aim at.
|
|
|
|
// If the process consumes more memory, then TSan will flush shadow memory.
|
|
|
|
int memory_limit_mb;
|
2012-05-23 02:07:45 +08:00
|
|
|
// Stops on start until __tsan_resume() is called (for debugging).
|
|
|
|
bool stop_on_start;
|
2012-05-24 17:24:45 +08:00
|
|
|
// Controls whether RunningOnValgrind() returns true or false.
|
|
|
|
bool running_on_valgrind;
|
2012-09-06 16:48:43 +08:00
|
|
|
// Path to external symbolizer.
|
|
|
|
const char *external_symbolizer_path;
|
2012-11-28 20:19:50 +08:00
|
|
|
// Per-thread history size, controls how many previous memory accesses
|
2012-11-28 21:01:32 +08:00
|
|
|
// are remembered per thread. Possible values are [0..7].
|
2012-11-28 20:19:50 +08:00
|
|
|
// history_size=0 amounts to 32K memory accesses. Each next value doubles
|
|
|
|
// the amount of memory accesses, up to history_size=7 that amounts to
|
|
|
|
// 4M memory accesses. The default value is 2 (128K memory accesses).
|
|
|
|
int history_size;
|
2012-12-18 20:20:55 +08:00
|
|
|
// Controls level of synchronization implied by IO operations.
|
|
|
|
// 0 - no synchronization
|
|
|
|
// 1 - reasonable level of synchronization (write->read)
|
|
|
|
// 2 - global synchronization of all IO operations
|
|
|
|
int io_sync;
|
2013-09-27 10:31:23 +08:00
|
|
|
// If false, the allocator will crash instead of returning 0 on out-of-memory.
|
|
|
|
bool allocator_may_return_null;
|
2012-05-10 21:48:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Flags *flags();
|
|
|
|
void InitializeFlags(Flags *flags, const char *env);
|
2013-01-30 15:45:58 +08:00
|
|
|
} // namespace __tsan
|
2012-05-10 21:48:04 +08:00
|
|
|
|
|
|
|
#endif // TSAN_FLAGS_H
|