diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-25 13:50:44 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2013-06-25 13:50:44 +0000 |
commit | b6246066a271e3b01732d1b4381ef745152747d2 (patch) | |
tree | ba275dbc51ecc50ce6fe9c21d0b66024292f5d5a | |
parent | 6ca5bec3b518c41e60e9f2d89e458af67a38b2da (diff) | |
download | compiler-rt-b6246066a271e3b01732d1b4381ef745152747d2.tar.gz compiler-rt-b6246066a271e3b01732d1b4381ef745152747d2.tar.bz2 compiler-rt-b6246066a271e3b01732d1b4381ef745152747d2.tar.xz |
[sanitizer] Move log_path to common flag and use it in MSan.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184836 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_flags.h | 2 | ||||
-rw-r--r-- | lib/asan/asan_rtl.cc | 5 | ||||
-rw-r--r-- | lib/msan/msan.cc | 2 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_flags.cc | 1 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_flags.h | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/lib/asan/asan_flags.h b/lib/asan/asan_flags.h index 2f3bc905..d0f821a8 100644 --- a/lib/asan/asan_flags.h +++ b/lib/asan/asan_flags.h @@ -93,8 +93,6 @@ struct Flags { // but also thread creation stacks for threads that created those threads, // etc. up to main thread. bool print_full_thread_history; - // ASan will write logs to "log_path.pid" instead of stderr. - const char *log_path; // Poison (or not) the heap memory on [de]allocation. Zero value is useful // for benchmarking the allocator or instrumentator. bool poison_heap; diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index a1dc838c..7aa26e32 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -119,7 +119,6 @@ static void ParseFlagsFromString(Flags *f, const char *str) { ParseFlag(str, &f->disable_core, "disable_core"); ParseFlag(str, &f->allow_reexec, "allow_reexec"); ParseFlag(str, &f->print_full_thread_history, "print_full_thread_history"); - ParseFlag(str, &f->log_path, "log_path"); ParseFlag(str, &f->poison_heap, "poison_heap"); ParseFlag(str, &f->alloc_dealloc_mismatch, "alloc_dealloc_mismatch"); ParseFlag(str, &f->use_stack_depot, "use_stack_depot"); @@ -137,6 +136,7 @@ void InitializeFlags(Flags *f, const char *env) { cf->fast_unwind_on_malloc = true; cf->strip_path_prefix = ""; cf->handle_ioctl = false; + cf->log_path = 0; internal_memset(f, 0, sizeof(*f)); f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28; @@ -166,7 +166,6 @@ void InitializeFlags(Flags *f, const char *env) { f->disable_core = (SANITIZER_WORDSIZE == 64); f->allow_reexec = true; f->print_full_thread_history = true; - f->log_path = 0; f->poison_heap = true; // Turn off alloc/dealloc mismatch checker on Mac for now. // TODO(glider): Fix known issues and enable this back. @@ -464,7 +463,7 @@ void __asan_init() { // initialization steps look at flags(). const char *options = GetEnv("ASAN_OPTIONS"); InitializeFlags(flags(), options); - __sanitizer_set_report_path(flags()->log_path); + __sanitizer_set_report_path(common_flags()->log_path); if (flags()->verbosity && options) { Report("Parsed ASAN_OPTIONS: %s\n", options); diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc index b1589669..15730663 100644 --- a/lib/msan/msan.cc +++ b/lib/msan/msan.cc @@ -141,6 +141,7 @@ static void InitializeFlags(Flags *f, const char *options) { 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; @@ -258,6 +259,7 @@ void __msan_init() { ReplaceOperatorsNewAndDelete(); const char *msan_options = GetEnv("MSAN_OPTIONS"); InitializeFlags(&msan_flags, msan_options); + __sanitizer_set_report_path(common_flags()->log_path); if (StackSizeIsUnlimited()) { if (flags()->verbosity) Printf("Unlimited stack, doing reexec\n"); diff --git a/lib/sanitizer_common/sanitizer_flags.cc b/lib/sanitizer_common/sanitizer_flags.cc index 95c6feeb..b8b1c3b6 100644 --- a/lib/sanitizer_common/sanitizer_flags.cc +++ b/lib/sanitizer_common/sanitizer_flags.cc @@ -28,6 +28,7 @@ void ParseCommonFlagsFromString(const char *str) { 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->log_path, "log_path"); } static bool GetFlagValue(const char *env, const char *name, diff --git a/lib/sanitizer_common/sanitizer_flags.h b/lib/sanitizer_common/sanitizer_flags.h index 12c4270c..16cbc645 100644 --- a/lib/sanitizer_common/sanitizer_flags.h +++ b/lib/sanitizer_common/sanitizer_flags.h @@ -37,6 +37,8 @@ struct CommonFlags { bool handle_ioctl; // Max number of stack frames kept for each allocation/deallocation. int malloc_context_size; + // Write logs to "log_path.pid" instead of stderr. + const char *log_path; }; extern CommonFlags common_flags_dont_use_directly; |