diff options
| author | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-12 22:07:48 +0000 |
|---|---|---|
| committer | Alexey Samsonov <vonosmas@gmail.com> | 2014-08-12 22:07:48 +0000 |
| commit | d2d2457823a2f1b90e907708c5bd54ac66b6d8dd (patch) | |
| tree | dc7a1c25eff04a5154caf352a9eeb7817bd28358 | |
| parent | 3d4eae74e7555c9bf61f07f9207ec26eaf4e6977 (diff) | |
| download | bcm5719-llvm-d2d2457823a2f1b90e907708c5bd54ac66b6d8dd.tar.gz bcm5719-llvm-d2d2457823a2f1b90e907708c5bd54ac66b6d8dd.zip | |
[Sanitizer] Make disable_coredump a common flag and use it in TSan
llvm-svn: 215479
| -rw-r--r-- | compiler-rt/lib/asan/asan_flags.h | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_rtl.cc | 8 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_flags.cc | 5 | ||||
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_flags.h | 1 | ||||
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc | 3 |
5 files changed, 8 insertions, 10 deletions
diff --git a/compiler-rt/lib/asan/asan_flags.h b/compiler-rt/lib/asan/asan_flags.h index 803b19ff707..789519e91db 100644 --- a/compiler-rt/lib/asan/asan_flags.h +++ b/compiler-rt/lib/asan/asan_flags.h @@ -52,7 +52,6 @@ struct Flags { bool print_stats; bool print_legend; bool atexit; - bool disable_core; bool allow_reexec; bool print_full_thread_history; bool poison_heap; diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index bf3aa74fe48..ae229ea98b7 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -173,11 +173,6 @@ static void ParseFlagsFromString(Flags *f, const char *str) { "If set, prints ASan exit stats even after program terminates " "successfully."); - ParseFlag(str, &f->disable_core, "disable_core", - "Disable core dumping. By default, disable_core=1 on 64-bit to avoid " - "dumping a 16T+ core file. " - "Ignored on OSes that don't dump core by default."); - ParseFlag(str, &f->allow_reexec, "allow_reexec", "Allow the tool to re-exec the program. This may interfere badly with " "the debugger."); @@ -271,7 +266,6 @@ void InitializeFlags(Flags *f, const char *env) { f->print_stats = false; f->print_legend = true; f->atexit = false; - f->disable_core = (SANITIZER_WORDSIZE == 64); f->allow_reexec = true; f->print_full_thread_history = true; f->poison_heap = true; @@ -617,7 +611,7 @@ static void AsanInitInternal() { if (common_flags()->verbosity) PrintAddressSpaceLayout(); - if (flags()->disable_core) { + if (common_flags()->disable_coredump) { DisableCoreDumper(); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc index 617fd0e8d91..881cc3e7faa 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc @@ -65,6 +65,7 @@ void SetCommonFlagsDefaults(CommonFlags *f) { f->full_address_space = false; f->suppressions = ""; f->print_suppressions = true; + f->disable_coredump = (SANITIZER_WORDSIZE == 64); } void ParseCommonFlagsFromString(CommonFlags *f, const char *str) { @@ -149,6 +150,10 @@ void ParseCommonFlagsFromString(CommonFlags *f, const char *str) { ParseFlag(str, &f->suppressions, "suppressions", "Suppressions file name."); ParseFlag(str, &f->print_suppressions, "print_suppressions", "Print matched suppressions at exit."); + ParseFlag(str, &f->disable_coredump, "disable_coredump", + "Disable core dumping. By default, disable_core=1 on 64-bit to avoid " + "dumping a 16T+ core file. Ignored on OSes that don't dump core by" + "default and for sanitizers that don't reserve lots of virtual memory."); // Do a sanity check for certain flags. if (f->malloc_context_size < 1) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h index e03a2da6e79..97641a6c49f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_flags.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_flags.h @@ -59,6 +59,7 @@ struct CommonFlags { bool full_address_space; const char *suppressions; bool print_suppressions; + bool disable_coredump; }; inline CommonFlags *common_flags() { diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc index 3457096965a..a2c836ba9ff 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc @@ -347,8 +347,7 @@ static void setlim(int res, rlim_t lim) { } const char *InitializePlatform() { - void *p = 0; - if (sizeof(p) == 8) { + if (common_flags()->disable_coredump) { // Disable core dumps, dumping of 16TB usually takes a bit long. setlim(RLIMIT_CORE, 0); } |

