__sanitizer_report_error_summary is the replaceable interface for reporting
an error. This patch changes asan a tiny bit to always emit a summary
whenever it encounters an error. This is important, otherwise a library
user of asan will not be aware of errors that were merely printed.
Also, all these summaries are redundant with the non-summarized printouts.
Make the default weak implementation of report error summary not do
anything. This means we need to remove the check for SUMMARY lines from the
tests. This is suboptimal for testing, but printing out these redundant
lines is just bad UI.
Please review!
Nick
Index: lib/tsan/lit_tests/signal_errno.cc
===================================================================
--- lib/tsan/lit_tests/signal_errno.cc (revision 193211)
+++ lib/tsan/lit_tests/signal_errno.cc (working copy)
@@ -39,5 +39,3 @@
// CHECK: WARNING: ThreadSanitizer: signal handler spoils errno
// CHECK: #0 MyHandler(int, siginfo{{(_t)?}}*, void*) {{.*}}signal_errno.cc
-// CHECK: SUMMARY: ThreadSanitizer: signal handler spoils errno{{.*}}MyHandler
-
Index: lib/tsan/lit_tests/mutex_destroy_locked.cc
===================================================================
--- lib/tsan/lit_tests/mutex_destroy_locked.cc (revision 193211)
+++ lib/tsan/lit_tests/mutex_destroy_locked.cc (working copy)
@@ -19,4 +19,3 @@
// CHECK: Mutex {{.*}} created at:
// CHECK: #0 pthread_mutex_init
// CHECK: #1 main
-// CHECK: SUMMARY: ThreadSanitizer: destroy of a locked mutex{{.*}}main
Index: lib/tsan/lit_tests/signal_malloc.cc
===================================================================
--- lib/tsan/lit_tests/signal_malloc.cc (revision 193211)
+++ lib/tsan/lit_tests/signal_malloc.cc (working copy)
@@ -8,8 +8,7 @@
static void handler(int, siginfo_t*, void*) {
// CHECK: WARNING: ThreadSanitizer: signal-unsafe call inside of a signal
// CHECK: #0 malloc
- // CHECK: #{{(1|2)}} handler(int, siginfo{{(_t)?}}*, void*) {{.*}}signal_malloc.cc:[[@LINE+2]]
- // CHECK: SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal{{.*}}handler
+ // CHECK: #{{(1|2)}} handler(int, siginfo{{(_t)?}}*, void*) {{.*}}signal_malloc.cc:[[@LINE+1]]
volatile char *p = (char*)malloc(1);
p[0] = 0;
free((void*)p);
@@ -23,4 +22,3 @@
sleep(1);
return 0;
}
-
Index: lib/tsan/lit_tests/thread_leak3.c
===================================================================
--- lib/tsan/lit_tests/thread_leak3.c (revision 193211)
+++ lib/tsan/lit_tests/thread_leak3.c (working copy)
@@ -14,4 +14,4 @@
}
// CHECK: WARNING: ThreadSanitizer: thread leak
-// CHECK: SUMMARY: ThreadSanitizer: thread leak{{.*}}main
+// CHECK: main
Index: lib/tsan/lit_tests/free_race.c
===================================================================
--- lib/tsan/lit_tests/free_race.c (revision 193211)
+++ lib/tsan/lit_tests/free_race.c (working copy)
@@ -44,6 +44,5 @@
// CHECK-NOZUPP: Previous write of size 8 at {{.*}} by thread T1{{.*}}:
// CHECK-NOZUPP: #0 free
// CHECK-NOZUPP: #{{(1|2)}} Thread1
-// CHECK-NOZUPP: SUMMARY: ThreadSanitizer: heap-use-after-free{{.*}}Thread2
// CHECK-SUPP: ThreadSanitizer: Matched 1 suppressions
// CHECK-SUPP: 1 race:^Thread2$
Index: lib/tsan/lit_tests/simple_race.cc
===================================================================
--- lib/tsan/lit_tests/simple_race.cc (revision 193211)
+++ lib/tsan/lit_tests/simple_race.cc (working copy)
@@ -23,4 +23,3 @@
}
// CHECK: WARNING: ThreadSanitizer: data race
-// CHECK: SUMMARY: ThreadSanitizer: data race{{.*}}Thread
Index: lib/msan/lit_tests/dso-origin.cc
===================================================================
--- lib/msan/lit_tests/dso-origin.cc (revision 193211)
+++ lib/msan/lit_tests/dso-origin.cc (working copy)
@@ -20,6 +20,5 @@
// CHECK: {{#0 0x.* in .*malloc}}
// CHECK: {{#1 0x.* in my_alloc .*dso-origin-so.cc:}}
// CHECK: {{#2 0x.* in main .*dso-origin.cc:}}[[@LINE-10]]
- // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*dso-origin-so.cc:.* my_access}}
return 0;
}
Index: lib/msan/lit_tests/stack-origin.cc
===================================================================
--- lib/msan/lit_tests/stack-origin.cc (revision 193211)
+++ lib/msan/lit_tests/stack-origin.cc (working copy)
@@ -26,6 +26,4 @@
// CHECK-ORIGINS: Uninitialized value was created by an allocation of 'x' in the stack frame of function 'main'
// CHECK-ORIGINS: {{#0 0x.* in main .*stack-origin.cc:}}[[@LINE-8]]
-
- // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*stack-origin.cc:.* main}}
}
Index: lib/msan/lit_tests/heap-origin.cc
===================================================================
--- lib/msan/lit_tests/heap-origin.cc (revision 193211)
+++ lib/msan/lit_tests/heap-origin.cc (working copy)
@@ -26,6 +26,4 @@
// CHECK-ORIGINS: Uninitialized value was created by a heap allocation
// CHECK-ORIGINS: {{#0 0x.* in .*malloc}}
// CHECK-ORIGINS: {{#1 0x.* in main .*heap-origin.cc:}}[[@LINE-7]]
-
- // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*heap-origin.cc:.* main}}
}
Index: lib/msan/lit_tests/select.cc
===================================================================
--- lib/msan/lit_tests/select.cc (revision 193211)
+++ lib/msan/lit_tests/select.cc (working copy)
@@ -16,7 +16,5 @@
exit(0);
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
// CHECK: {{#0 0x.* in main .*select.cc:}}[[@LINE-3]]
-
- // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*select.cc:.* main}}
return 0;
}
Index: lib/sanitizer_common/sanitizer_common.cc
===================================================================
--- lib/sanitizer_common/sanitizer_common.cc (revision 193211)
+++ lib/sanitizer_common/sanitizer_common.cc (working copy)
@@ -232,7 +232,5 @@
PrepareForSandboxing();
}
-void __sanitizer_report_error_summary(const char *error_summary) {
- Printf("SUMMARY: %s\n", error_summary);
-}
+void NOINLINE __sanitizer_report_error_summary(const char *error_summary) {}
} // extern "C"
Index: lib/asan/lit_tests/TestCases/Linux/heap-overflow-large.cc
===================================================================
--- lib/asan/lit_tests/TestCases/Linux/heap-overflow-large.cc (revision 193211)
+++ lib/asan/lit_tests/TestCases/Linux/heap-overflow-large.cc (working copy)
@@ -17,7 +17,6 @@
// CHECK: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
// CHECK: #0 0x{{.*}} in main {{.*}}heap-overflow-large.cc:[[@LINE-2]]
// CHECK: AddressSanitizer can not {{(provide additional info|describe address in more detail \(wild memory access suspected\))}}
- // CHECK: SUMMARY: AddressSanitizer: {{(heap-buffer-overflow|SEGV)}}
delete[] x;
return res;
}
Index: lib/asan/asan_report.cc
===================================================================
--- lib/asan/asan_report.cc (revision 193211)
+++ lib/asan/asan_report.cc (working copy)
@@ -550,16 +550,14 @@
};
static void ReportSummary(const char *error_type, StackTrace *stack) {
- if (!stack->size) return;
+ AddressInfo ai;
if (&getSymbolizer && getSymbolizer()->IsAvailable()) {
- AddressInfo ai;
// Currently, we include the first stack frame into the report summary.
// Maybe sometimes we need to choose another frame (e.g. skip memcpy/etc).
uptr pc = StackTrace::GetPreviousInstructionPc(stack->trace[0]);
getSymbolizer()->SymbolizeCode(pc, &ai, 1);
- ReportErrorSummary(error_type, ai.file, ai.line, ai.function);
}
- // FIXME: do we need to print anything at all if there is no symbolizer?
+ ReportErrorSummary(error_type, ai.file, ai.line, ai.function);
}
void ReportSIGSEGV(uptr pc, uptr sp, uptr bp, uptr addr) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits