forked from OSchip/llvm-project
[Sanitizer] Specify a default value for each common runtime flag
llvm-svn: 194479
This commit is contained in:
parent
25d69507dd
commit
6345150992
|
@ -132,16 +132,9 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
|
|||
|
||||
void InitializeFlags(Flags *f, const char *env) {
|
||||
CommonFlags *cf = common_flags();
|
||||
SetCommonFlagDefaults();
|
||||
cf->external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH");
|
||||
cf->symbolize = true;
|
||||
cf->malloc_context_size = kDefaultMallocContextSize;
|
||||
cf->fast_unwind_on_fatal = false;
|
||||
cf->fast_unwind_on_malloc = true;
|
||||
cf->strip_path_prefix = "";
|
||||
cf->handle_ioctl = false;
|
||||
cf->log_path = 0;
|
||||
cf->detect_leaks = false;
|
||||
cf->leak_check_at_exit = true;
|
||||
|
||||
internal_memset(f, 0, sizeof(*f));
|
||||
f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28;
|
||||
|
|
|
@ -24,13 +24,10 @@ namespace __lsan {
|
|||
|
||||
static void InitializeCommonFlags() {
|
||||
CommonFlags *cf = common_flags();
|
||||
SetCommonFlagDefaults();
|
||||
cf->external_symbolizer_path = GetEnv("LSAN_SYMBOLIZER_PATH");
|
||||
cf->symbolize = true;
|
||||
cf->strip_path_prefix = "";
|
||||
cf->fast_unwind_on_malloc = true;
|
||||
cf->malloc_context_size = 30;
|
||||
cf->detect_leaks = true;
|
||||
cf->leak_check_at_exit = true;
|
||||
|
||||
ParseCommonFlagsFromString(GetEnv("LSAN_OPTIONS"));
|
||||
}
|
||||
|
|
|
@ -141,14 +141,10 @@ static void ParseFlagsFromString(Flags *f, const char *str) {
|
|||
|
||||
static void InitializeFlags(Flags *f, const char *options) {
|
||||
CommonFlags *cf = common_flags();
|
||||
SetCommonFlagDefaults();
|
||||
cf->external_symbolizer_path = GetEnv("MSAN_SYMBOLIZER_PATH");
|
||||
cf->symbolize = true;
|
||||
cf->strip_path_prefix = "";
|
||||
cf->fast_unwind_on_fatal = false;
|
||||
cf->fast_unwind_on_malloc = true;
|
||||
cf->malloc_context_size = 20;
|
||||
cf->handle_ioctl = true;
|
||||
cf->log_path = 0;
|
||||
|
||||
internal_memset(f, 0, sizeof(*f));
|
||||
f->poison_heap_with_zeroes = false;
|
||||
|
|
|
@ -18,16 +18,31 @@
|
|||
|
||||
namespace __sanitizer {
|
||||
|
||||
void SetCommonFlagDefaults() {
|
||||
CommonFlags *f = common_flags();
|
||||
f->symbolize = true;
|
||||
f->external_symbolizer_path = "";
|
||||
f->strip_path_prefix = "";
|
||||
f->fast_unwind_on_fatal = false;
|
||||
f->fast_unwind_on_malloc = true;
|
||||
f->handle_ioctl = false;
|
||||
f->malloc_context_size = 1;
|
||||
f->log_path = "stderr";
|
||||
f->verbosity = 0;
|
||||
f->detect_leaks = false;
|
||||
f->leak_check_at_exit = true;
|
||||
f->allocator_may_return_null = false;
|
||||
}
|
||||
|
||||
void ParseCommonFlagsFromString(const char *str) {
|
||||
CommonFlags *f = common_flags();
|
||||
ParseFlag(str, &f->symbolize, "symbolize");
|
||||
ParseFlag(str, &f->external_symbolizer_path, "external_symbolizer_path");
|
||||
ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
|
||||
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
|
||||
ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal");
|
||||
ParseFlag(str, &f->fast_unwind_on_malloc, "fast_unwind_on_malloc");
|
||||
ParseFlag(str, &f->symbolize, "symbolize");
|
||||
ParseFlag(str, &f->handle_ioctl, "handle_ioctl");
|
||||
ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
|
||||
ParseFlag(str, &f->log_path, "log_path");
|
||||
ParseFlag(str, &f->verbosity, "verbosity");
|
||||
ParseFlag(str, &f->detect_leaks, "detect_leaks");
|
||||
|
|
|
@ -58,6 +58,7 @@ inline CommonFlags *common_flags() {
|
|||
return &f;
|
||||
}
|
||||
|
||||
void SetCommonFlagDefaults();
|
||||
void ParseCommonFlagsFromString(const char *str);
|
||||
|
||||
} // namespace __sanitizer
|
||||
|
|
|
@ -91,21 +91,20 @@ void InitializeFlags(Flags *f, const char *env) {
|
|||
f->history_size = kGoMode ? 1 : 2; // There are a lot of goroutines in Go.
|
||||
f->io_sync = 1;
|
||||
|
||||
ParseCommonFlagsFromString("strip_path_prefix=");
|
||||
ParseCommonFlagsFromString("log_path=stderr");
|
||||
ParseCommonFlagsFromString("external_symbolizer_path=");
|
||||
ParseCommonFlagsFromString("allocator_may_return_null=0");
|
||||
ParseCommonFlagsFromString("verbosity=0");
|
||||
*static_cast<CommonFlags*>(f) = *common_flags();
|
||||
CommonFlags *cf = common_flags();
|
||||
SetCommonFlagDefaults();
|
||||
*static_cast<CommonFlags*>(f) = *cf;
|
||||
|
||||
// Let a frontend override.
|
||||
OverrideFlags(f);
|
||||
ParseFlags(f, __tsan_default_options());
|
||||
ParseCommonFlagsFromString(__tsan_default_options());
|
||||
|
||||
// Override from command line.
|
||||
ParseFlags(f, env);
|
||||
ParseCommonFlagsFromString(env);
|
||||
*static_cast<CommonFlags*>(f) = *cf;
|
||||
|
||||
// Sanity check.
|
||||
if (!f->report_bugs) {
|
||||
f->report_thread_leaks = false;
|
||||
f->report_destroy_locked = false;
|
||||
|
@ -123,10 +122,6 @@ void InitializeFlags(Flags *f, const char *env) {
|
|||
" (must be [0..2])\n");
|
||||
Die();
|
||||
}
|
||||
|
||||
*common_flags() = *f;
|
||||
ParseCommonFlagsFromString(env);
|
||||
*static_cast<CommonFlags*>(f) = *common_flags();
|
||||
}
|
||||
|
||||
} // namespace __tsan
|
||||
|
|
Loading…
Reference in New Issue