[PATCH] [msan] Add a keep_going msan option
Reid Kleckner
rnk at google.com
Wed Mar 13 07:02:03 PDT 2013
Hi eugenis,
This allows the user to compile everything with -mllvm -msan-keep-going
and then adjust the option at runtime.
http://llvm-reviews.chandlerc.com/D537
Files:
lib/msan/msan.cc
lib/msan/msan_flags.h
Index: lib/msan/msan.cc
===================================================================
--- lib/msan/msan.cc
+++ lib/msan/msan.cc
@@ -127,6 +127,7 @@
ParseFlag(str, &f->report_umrs, "report_umrs");
ParseFlag(str, &f->verbosity, "verbosity");
ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
+ ParseFlag(str, &f->keep_going, "keep_going");
}
static void InitializeFlags(Flags *f, const char *options) {
@@ -140,6 +141,7 @@
f->report_umrs = true;
f->verbosity = 0;
f->strip_path_prefix = "";
+ f->keep_going = -1;
// Override from user-specified string.
if (__msan_default_options)
@@ -201,7 +203,7 @@
(__msan_track_origins && OriginIsValid(origin)) ? origin : 0;
ReportUMR(&stack, report_origin);
- if (__msan_track_origins && !OriginIsValid(origin)) {
+ if (__msan_track_origins && !OriginIsValid(origin) && flags()->report_umrs) {
Printf(" ORIGIN: invalid (%x). Might be a bug in MemorySanitizer, "
"please report to MemorySanitizer developers.\n",
origin);
@@ -218,12 +220,20 @@
GET_CALLER_PC_BP_SP;
(void)sp;
PrintWarning(pc, bp);
+ if (flags()->keep_going == 0) {
+ Printf("Exiting\n");
+ Die();
+ }
}
void __msan_warning_noreturn() {
GET_CALLER_PC_BP_SP;
(void)sp;
PrintWarning(pc, bp);
+ if (flags()->keep_going > 0) {
+ Printf("Cannot keep going, rebuild with -mllvm -msan-keep-going to "
+ "continue\n");
+ }
Printf("Exiting\n");
Die();
}
Index: lib/msan/msan_flags.h
===================================================================
--- lib/msan/msan_flags.h
+++ lib/msan/msan_flags.h
@@ -21,6 +21,7 @@
int exit_code;
int num_callers;
int verbosity;
+ int keep_going; // tri-state: -1 default, 0 off, 1 on
bool poison_heap_with_zeroes; // default: false
bool poison_stack_with_zeroes; // default: false
bool poison_in_malloc; // default: true
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D537.1.patch
Type: text/x-patch
Size: 1918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130313/856add88/attachment.bin>
More information about the llvm-commits
mailing list