[compiler-rt] r184836 - [sanitizer] Move log_path to common flag and use it in MSan.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Jun 25 06:50:44 PDT 2013
Author: eugenis
Date: Tue Jun 25 08:50:44 2013
New Revision: 184836
URL: http://llvm.org/viewvc/llvm-project?rev=184836&view=rev
Log:
[sanitizer] Move log_path to common flag and use it in MSan.
Modified:
compiler-rt/trunk/lib/asan/asan_flags.h
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/msan/msan.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
Modified: compiler-rt/trunk/lib/asan/asan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_flags.h?rev=184836&r1=184835&r2=184836&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_flags.h (original)
+++ compiler-rt/trunk/lib/asan/asan_flags.h Tue Jun 25 08:50:44 2013
@@ -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;
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=184836&r1=184835&r2=184836&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Jun 25 08:50:44 2013
@@ -119,7 +119,6 @@ static void ParseFlagsFromString(Flags *
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 cha
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 cha
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);
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=184836&r1=184835&r2=184836&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Tue Jun 25 08:50:44 2013
@@ -141,6 +141,7 @@ static void InitializeFlags(Flags *f, co
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");
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=184836&r1=184835&r2=184836&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Tue Jun 25 08:50:44 2013
@@ -28,6 +28,7 @@ void ParseCommonFlagsFromString(const ch
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,
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h?rev=184836&r1=184835&r2=184836&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h Tue Jun 25 08:50:44 2013
@@ -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;
More information about the llvm-commits
mailing list