[compiler-rt] r211574 - [msan] Print stats even on successful run with atexit=1.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Tue Jun 24 02:04:07 PDT 2014
Author: eugenis
Date: Tue Jun 24 04:04:06 2014
New Revision: 211574
URL: http://llvm.org/viewvc/llvm-project?rev=211574&view=rev
Log:
[msan] Print stats even on successful run with atexit=1.
Modified:
compiler-rt/trunk/lib/msan/msan.cc
compiler-rt/trunk/lib/msan/msan_flags.h
compiler-rt/trunk/lib/msan/msan_linux.cc
compiler-rt/trunk/test/msan/print_stats.cc
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=211574&r1=211573&r2=211574&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Tue Jun 24 04:04:06 2014
@@ -144,6 +144,7 @@ static void ParseFlagsFromString(Flags *
ParseFlag(str, &f->report_umrs, "report_umrs", "");
ParseFlag(str, &f->wrap_signals, "wrap_signals", "");
ParseFlag(str, &f->print_stats, "print_stats", "");
+ ParseFlag(str, &f->atexit, "atexit", "");
// keep_going is an old name for halt_on_error,
// and it has inverse meaning.
@@ -173,6 +174,7 @@ static void InitializeFlags(Flags *f, co
f->report_umrs = true;
f->wrap_signals = true;
f->print_stats = false;
+ f->atexit = false;
f->halt_on_error = !&__msan_keep_going;
// Override from user-specified string.
Modified: compiler-rt/trunk/lib/msan/msan_flags.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_flags.h?rev=211574&r1=211573&r2=211574&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_flags.h (original)
+++ compiler-rt/trunk/lib/msan/msan_flags.h Tue Jun 24 04:04:06 2014
@@ -29,6 +29,7 @@ struct Flags {
bool wrap_signals;
bool print_stats;
bool halt_on_error;
+ bool atexit;
};
Flags *flags();
Modified: compiler-rt/trunk/lib/msan/msan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_linux.cc?rev=211574&r1=211573&r2=211574&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_linux.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_linux.cc Tue Jun 24 04:04:06 2014
@@ -90,12 +90,11 @@ void MsanDie() {
}
static void MsanAtExit(void) {
+ if (flags()->print_stats && (flags()->atexit || msan_report_count > 0))
+ ReportStats();
if (msan_report_count > 0) {
ReportAtExitStatistics();
- if (flags()->print_stats)
- ReportStats();
- if (flags()->exit_code)
- _exit(flags()->exit_code);
+ if (flags()->exit_code) _exit(flags()->exit_code);
}
}
Modified: compiler-rt/trunk/test/msan/print_stats.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/print_stats.cc?rev=211574&r1=211573&r2=211574&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/print_stats.cc (original)
+++ compiler-rt/trunk/test/msan/print_stats.cc Tue Jun 24 04:04:06 2014
@@ -3,6 +3,8 @@
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s
// RUN: MSAN_OPTIONS=print_stats=1 %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s
+// RUN: MSAN_OPTIONS=print_stats=1,atexit=1 %run %t 2>&1 | \
+// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS %s
// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -g -DPOSITIVE=1 %s -o %t
// RUN: not %run %t 2>&1 | \
@@ -30,8 +32,6 @@ int main(int argc, char **argv) {
// CHECK: TEST
-// CHECK-KEEPGOING: MemorySanitizer: 1 warnings reported.
-
// CHECK-STATS: Unique heap origins:
// CHECK-STATS: Stack depot allocated bytes:
// CHECK-STATS: Unique origin histories:
@@ -41,3 +41,5 @@ int main(int argc, char **argv) {
// CHECK-NOSTATS-NOT: Stack depot allocated bytes:
// CHECK-NOSTATS-NOT: Unique origin histories:
// CHECK-NOSTATS-NOT: History depot allocated bytes:
+
+// CHECK-KEEPGOING: MemorySanitizer: 1 warnings reported.
More information about the llvm-commits
mailing list