[sanitizer] Move log_path to common flag and use it in MSan.
llvm-svn: 184836
This commit is contained in:
parent
866793109e
commit
982d56abb8
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue