2012-11-22 23:03:11 +01:00
|
|
|
//===-- tsan_flags.h --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
// NOTE: This file may be included into user code.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef TSAN_FLAGS_H
|
|
|
|
#define TSAN_FLAGS_H
|
|
|
|
|
2013-12-05 10:18:38 +01:00
|
|
|
#include "sanitizer_common/sanitizer_flags.h"
|
2014-05-22 09:09:21 +02:00
|
|
|
#include "sanitizer_common/sanitizer_deadlock_detector_interface.h"
|
2013-12-05 10:18:38 +01:00
|
|
|
|
2012-11-22 23:03:11 +01:00
|
|
|
namespace __tsan {
|
|
|
|
|
2014-09-23 19:59:53 +02:00
|
|
|
struct Flags : DDFlags {
|
2012-11-22 23:03:11 +01:00
|
|
|
// Enable dynamic annotations, otherwise they are no-ops.
|
|
|
|
bool enable_annotations;
|
2014-05-22 09:09:21 +02:00
|
|
|
// Suppress a race report if we've already output another race report
|
2012-11-22 23:03:11 +01:00
|
|
|
// with the same stack.
|
|
|
|
bool suppress_equal_stacks;
|
2014-05-22 09:09:21 +02:00
|
|
|
// Suppress a race report if we've already output another race report
|
2012-11-22 23:03:11 +01:00
|
|
|
// on the same address.
|
|
|
|
bool suppress_equal_addresses;
|
2012-11-23 15:46:25 +01:00
|
|
|
// Turns off bug reporting entirely (useful for benchmarking).
|
|
|
|
bool report_bugs;
|
2012-11-22 23:03:11 +01:00
|
|
|
// Report thread leaks at exit?
|
|
|
|
bool report_thread_leaks;
|
|
|
|
// Report destruction of a locked mutex?
|
|
|
|
bool report_destroy_locked;
|
2014-05-22 09:09:21 +02:00
|
|
|
// Report incorrect usages of mutexes and mutex annotations?
|
|
|
|
bool report_mutex_bugs;
|
2012-11-22 23:03:11 +01:00
|
|
|
// Report violations of async signal-safety
|
|
|
|
// (e.g. malloc() call from a signal handler).
|
|
|
|
bool report_signal_unsafe;
|
2013-02-13 11:46:01 +01:00
|
|
|
// Report races between atomic and plain memory accesses.
|
|
|
|
bool report_atomic_races;
|
2012-11-22 23:03:11 +01:00
|
|
|
// If set, all atomics are effectively sequentially consistent (seq_cst),
|
|
|
|
// regardless of what user actually specified.
|
|
|
|
bool force_seq_cst_atomics;
|
2013-11-04 22:33:31 +01:00
|
|
|
// Print matched "benign" races at exit.
|
|
|
|
bool print_benign;
|
2012-11-22 23:03:11 +01:00
|
|
|
// Override exit status if something was reported.
|
|
|
|
int exitcode;
|
2013-11-04 22:33:31 +01:00
|
|
|
// Exit after first reported error.
|
|
|
|
bool halt_on_error;
|
2012-11-22 23:03:11 +01:00
|
|
|
// Sleep in main thread before exiting for that many ms
|
|
|
|
// (useful to catch "at exit" races).
|
|
|
|
int atexit_sleep_ms;
|
|
|
|
// If set, periodically write memory profile to that file.
|
|
|
|
const char *profile_memory;
|
|
|
|
// Flush shadow memory every X ms.
|
|
|
|
int flush_memory_ms;
|
2013-11-04 22:33:31 +01:00
|
|
|
// Flush symbolizer caches every X ms.
|
|
|
|
int flush_symbolizer_ms;
|
2013-12-05 10:18:38 +01: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-11-22 23:03:11 +01:00
|
|
|
// Stops on start until __tsan_resume() is called (for debugging).
|
|
|
|
bool stop_on_start;
|
|
|
|
// Controls whether RunningOnValgrind() returns true or false.
|
|
|
|
bool running_on_valgrind;
|
2012-12-05 14:19:55 +01:00
|
|
|
// Per-thread history size, controls how many previous memory accesses
|
|
|
|
// are remembered per thread. Possible values are [0..7].
|
|
|
|
// 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;
|
2013-01-10 13:44:08 +01: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;
|
2014-05-22 09:09:21 +02:00
|
|
|
// Die after multi-threaded fork if the child creates new threads.
|
|
|
|
bool die_after_fork;
|
2012-11-22 23:03:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Flags *flags();
|
|
|
|
void InitializeFlags(Flags *flags, const char *env);
|
2013-02-13 11:46:01 +01:00
|
|
|
} // namespace __tsan
|
2012-11-22 23:03:11 +01:00
|
|
|
|
|
|
|
#endif // TSAN_FLAGS_H
|