[compiler-rt] r214343 - [Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
Alexey Samsonov
vonosmas at gmail.com
Wed Jul 30 14:33:05 PDT 2014
Author: samsonov
Date: Wed Jul 30 16:33:04 2014
New Revision: 214343
URL: http://llvm.org/viewvc/llvm-project?rev=214343&view=rev
Log:
[Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
No functionality change.
Modified:
compiler-rt/trunk/lib/lsan/lsan_common.cc
compiler-rt/trunk/lib/lsan/lsan_common.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h
compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc
compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Wed Jul 30 16:33:04 2014
@@ -43,8 +43,6 @@ static void InitializeFlags() {
f->resolution = 0;
f->max_leaks = 0;
f->exitcode = 23;
- f->print_suppressions = true;
- f->suppressions="";
f->use_registers = true;
f->use_globals = true;
f->use_stacks = true;
@@ -72,8 +70,6 @@ static void InitializeFlags() {
ParseFlag(options, &f->log_pointers, "log_pointers", "");
ParseFlag(options, &f->log_threads, "log_threads", "");
ParseFlag(options, &f->exitcode, "exitcode", "");
- ParseFlag(options, &f->print_suppressions, "print_suppressions", "");
- ParseFlag(options, &f->suppressions, "suppressions", "");
}
}
@@ -91,12 +87,12 @@ void InitializeSuppressions() {
SuppressionContext::Init();
char *suppressions_from_file;
uptr buffer_size;
- if (ReadFileToBuffer(flags()->suppressions, &suppressions_from_file,
+ if (ReadFileToBuffer(common_flags()->suppressions, &suppressions_from_file,
&buffer_size, 1 << 26 /* max_len */))
SuppressionContext::Get()->Parse(suppressions_from_file);
- if (flags()->suppressions[0] && !buffer_size) {
+ if (common_flags()->suppressions[0] && !buffer_size) {
Printf("LeakSanitizer: failed to read suppressions file '%s'\n",
- flags()->suppressions);
+ common_flags()->suppressions);
Die();
}
if (&__lsan_default_suppressions)
@@ -446,7 +442,7 @@ void DoLeakCheck() {
Printf("%s", d.End());
param.leak_report.ReportTopLeaks(flags()->max_leaks);
}
- if (flags()->print_suppressions)
+ if (common_flags()->print_suppressions)
PrintMatchedSuppressions();
if (unsuppressed_count > 0) {
param.leak_report.PrintSummary();
Modified: compiler-rt/trunk/lib/lsan/lsan_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.h?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.h (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.h Wed Jul 30 16:33:04 2014
@@ -51,10 +51,6 @@ struct Flags {
int max_leaks;
// If nonzero kill the process with this exit code upon finding leaks.
int exitcode;
- // Print matched suppressions after leak checking.
- bool print_suppressions;
- // Suppressions file name.
- const char* suppressions;
// Flags controlling the root set of reachable memory.
// Global variables (.data and .bss).
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=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Wed Jul 30 16:33:04 2014
@@ -63,6 +63,8 @@ void SetCommonFlagsDefaults(CommonFlags
f->coverage_direct = SANITIZER_ANDROID;
f->coverage_dir = ".";
f->full_address_space = false;
+ f->suppressions = "";
+ f->print_suppressions = true;
}
void ParseCommonFlagsFromString(CommonFlags *f, const char *str) {
@@ -144,6 +146,9 @@ void ParseCommonFlagsFromString(CommonFl
ParseFlag(str, &f->full_address_space, "full_address_space",
"Sanitize complete address space; "
"by default kernel area on 32-bit platforms will not be sanitized");
+ ParseFlag(str, &f->suppressions, "suppressions", "Suppressions file name.");
+ ParseFlag(str, &f->print_suppressions, "print_suppressions",
+ "Print matched suppressions at exit.");
// Do a sanity check for certain flags.
if (f->malloc_context_size < 1)
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=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.h Wed Jul 30 16:33:04 2014
@@ -57,6 +57,8 @@ struct CommonFlags {
bool coverage_direct;
const char *coverage_dir;
bool full_address_space;
+ const char *suppressions;
+ bool print_suppressions;
};
inline CommonFlags *common_flags() {
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.cc Wed Jul 30 16:33:04 2014
@@ -44,8 +44,6 @@ static void ParseFlags(Flags *f, const c
ParseFlag(env, &f->report_signal_unsafe, "report_signal_unsafe", "");
ParseFlag(env, &f->report_atomic_races, "report_atomic_races", "");
ParseFlag(env, &f->force_seq_cst_atomics, "force_seq_cst_atomics", "");
- ParseFlag(env, &f->suppressions, "suppressions", "");
- ParseFlag(env, &f->print_suppressions, "print_suppressions", "");
ParseFlag(env, &f->print_benign, "print_benign", "");
ParseFlag(env, &f->exitcode, "exitcode", "");
ParseFlag(env, &f->halt_on_error, "halt_on_error", "");
@@ -78,8 +76,6 @@ void InitializeFlags(Flags *f, const cha
f->report_signal_unsafe = true;
f->report_atomic_races = true;
f->force_seq_cst_atomics = false;
- f->suppressions = "";
- f->print_suppressions = false;
f->print_benign = false;
f->exitcode = 66;
f->halt_on_error = false;
@@ -101,6 +97,7 @@ void InitializeFlags(Flags *f, const cha
// Override some common flags defaults.
f->allow_addr2line = true;
f->detect_deadlocks = true;
+ f->print_suppressions = false;
// Let a frontend override.
ParseFlags(f, __tsan_default_options());
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_flags.h Wed Jul 30 16:33:04 2014
@@ -44,10 +44,6 @@ struct Flags : CommonFlags, DDFlags {
// If set, all atomics are effectively sequentially consistent (seq_cst),
// regardless of what user actually specified.
bool force_seq_cst_atomics;
- // Suppressions filename.
- const char *suppressions;
- // Print matched suppressions at exit.
- bool print_suppressions;
// Print matched "benign" races at exit.
bool print_benign;
// Override exit status if something was reported.
Modified: compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/print_suppressions.cc Wed Jul 30 16:33:04 2014
@@ -2,9 +2,9 @@
// matched. Default is print_suppressions=true.
// RUN: LSAN_BASE="use_registers=0:use_stacks=0"
// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
+// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 ASAN_OPTIONS=$ASAN_OPTIONS:print_suppressions=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
-// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
+// RUN: LSAN_OPTIONS=$LSAN_BASE:print_suppressions=0 ASAN_OPTIONS=$ASAN_OPTIONS:print_suppressions=0 %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-dont-print
// RUN: LSAN_OPTIONS=$LSAN_BASE %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-print
#include <stdio.h>
Modified: compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc?rev=214343&r1=214342&r2=214343&view=diff
==============================================================================
--- compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc (original)
+++ compiler-rt/trunk/test/lsan/TestCases/suppressions_file.cc Wed Jul 30 16:33:04 2014
@@ -2,10 +2,10 @@
// RUN: %clangxx_lsan %s -o %t
// RUN: echo "leak:*LSanTestLeakingFunc*" > %t.supp1
-// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions=%t.supp1 not %run %t 2>&1 | FileCheck %s
+// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions=%t.supp1 ASAN_OPTIONS=$ASAN_OPTIONS:suppressions=%t.supp1 not %run %t 2>&1 | FileCheck %s
// RUN: echo "leak:%t" > %t.supp2
-// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions="%t.supp2":symbolize=false %run %t
+// RUN: LSAN_OPTIONS=$LSAN_BASE:suppressions="%t.supp2":symbolize=false ASAN_OPTIONS=$ASAN_OPTIONS:suppressions="%t.supp2" %run %t
#include <stdio.h>
#include <stdlib.h>
More information about the llvm-commits
mailing list