[compiler-rt] r193864 - [Sanitizer] Unify summary reporting across all sanitizers.
Alexey Samsonov
samsonov at google.com
Fri Nov 1 10:02:15 PDT 2013
Author: samsonov
Date: Fri Nov 1 12:02:14 2013
New Revision: 193864
URL: http://llvm.org/viewvc/llvm-project?rev=193864&view=rev
Log:
[Sanitizer] Unify summary reporting across all sanitizers.
This change unifies the summary printing across sanitizers:
now each tool uses specific version of ReportErrorSummary() method,
which deals with symbolization of the top frame and formatting a
summary message. This change modifies the summary line for ASan+LSan mode:
now the summary mentions "AddressSanitizer" instead of "LeakSanitizer".
Modified:
compiler-rt/trunk/lib/asan/asan_report.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/disabler.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/ignore_object.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/pointer_to_self.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_default.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_file.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/swapcontext.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_after_return.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc
compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
compiler-rt/trunk/lib/msan/msan_report.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
Modified: compiler-rt/trunk/lib/asan/asan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_report.cc Fri Nov 1 12:02:14 2013
@@ -549,17 +549,6 @@ class ScopedInErrorReport {
}
};
-static void ReportSummary(const char *error_type, StackTrace *stack) {
- AddressInfo ai;
- if (Symbolizer::Get()->IsAvailable()) {
- // 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]);
- Symbolizer::Get()->SymbolizeCode(pc, &ai, 1);
- }
- ReportErrorSummary(error_type, ai.file, ai.line, ai.function);
-}
-
void ReportSIGSEGV(uptr pc, uptr sp, uptr bp, uptr addr) {
ScopedInErrorReport in_report;
Decorator d;
@@ -572,7 +561,7 @@ void ReportSIGSEGV(uptr pc, uptr sp, upt
GET_STACK_TRACE_FATAL(pc, bp);
PrintStack(&stack);
Printf("AddressSanitizer can not provide additional info.\n");
- ReportSummary("SEGV", &stack);
+ ReportErrorSummary("SEGV", &stack);
}
void ReportDoubleFree(uptr addr, StackTrace *stack) {
@@ -589,7 +578,7 @@ void ReportDoubleFree(uptr addr, StackTr
Printf("%s", d.EndWarning());
PrintStack(stack);
DescribeHeapAddress(addr, 1);
- ReportSummary("double-free", stack);
+ ReportErrorSummary("double-free", stack);
}
void ReportFreeNotMalloced(uptr addr, StackTrace *stack) {
@@ -604,7 +593,7 @@ void ReportFreeNotMalloced(uptr addr, St
Printf("%s", d.EndWarning());
PrintStack(stack);
DescribeHeapAddress(addr, 1);
- ReportSummary("bad-free", stack);
+ ReportErrorSummary("bad-free", stack);
}
void ReportAllocTypeMismatch(uptr addr, StackTrace *stack,
@@ -623,7 +612,7 @@ void ReportAllocTypeMismatch(uptr addr,
Printf("%s", d.EndWarning());
PrintStack(stack);
DescribeHeapAddress(addr, 1);
- ReportSummary("alloc-dealloc-mismatch", stack);
+ ReportErrorSummary("alloc-dealloc-mismatch", stack);
Report("HINT: if you don't care about these warnings you may set "
"ASAN_OPTIONS=alloc_dealloc_mismatch=0\n");
}
@@ -638,7 +627,7 @@ void ReportMallocUsableSizeNotOwned(uptr
Printf("%s", d.EndWarning());
PrintStack(stack);
DescribeHeapAddress(addr, 1);
- ReportSummary("bad-malloc_usable_size", stack);
+ ReportErrorSummary("bad-malloc_usable_size", stack);
}
void ReportAsanGetAllocatedSizeNotOwned(uptr addr, StackTrace *stack) {
@@ -651,7 +640,7 @@ void ReportAsanGetAllocatedSizeNotOwned(
Printf("%s", d.EndWarning());
PrintStack(stack);
DescribeHeapAddress(addr, 1);
- ReportSummary("bad-__asan_get_allocated_size", stack);
+ ReportErrorSummary("bad-__asan_get_allocated_size", stack);
}
void ReportStringFunctionMemoryRangesOverlap(
@@ -669,7 +658,7 @@ void ReportStringFunctionMemoryRangesOve
PrintStack(stack);
DescribeAddress((uptr)offset1, length1);
DescribeAddress((uptr)offset2, length2);
- ReportSummary(bug_type, stack);
+ ReportErrorSummary(bug_type, stack);
}
// ----------------------- Mac-specific reports ----------------- {{{1
@@ -779,7 +768,7 @@ void __asan_report_error(uptr pc, uptr b
PrintStack(&stack);
DescribeAddress(addr, access_size);
- ReportSummary(bug_descr, &stack);
+ ReportErrorSummary(bug_descr, &stack);
PrintShadowMemoryForAddress(addr);
}
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/disabler.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/disabler.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/disabler.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/disabler.cc Fri Nov 1 12:02:14 2013
@@ -20,4 +20,4 @@ int main() {
fprintf(stderr, "Test alloc: %p.\n", q);
return 0;
}
-// CHECK: SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc Fri Nov 1 12:02:14 2013
@@ -32,5 +32,5 @@ int main(int argc, char *argv[]) {
return 0;
}
-// CHECK-strict: SUMMARY: LeakSanitizer: 2003 byte(s) leaked in 2 allocation(s)
-// CHECK-normal: SUMMARY: LeakSanitizer: 666 byte(s) leaked in 1 allocation(s)
+// CHECK-strict: SUMMARY: {{(Leak|Address)}}Sanitizer: 2003 byte(s) leaked in 2 allocation(s)
+// CHECK-normal: SUMMARY: {{(Leak|Address)}}Sanitizer: 666 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/ignore_object.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/ignore_object.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/ignore_object.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/ignore_object.cc Fri Nov 1 12:02:14 2013
@@ -27,4 +27,4 @@ int main() {
}
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: ignoring heap object at [[ADDR]]
-// CHECK: SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc Fri Nov 1 12:02:14 2013
@@ -15,4 +15,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 33554432 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc Fri Nov 1 12:02:14 2013
@@ -15,5 +15,5 @@ int main(int argc, char *argv[]) {
return 0;
}
-// CHECK-do: SUMMARY: LeakSanitizer:
-// CHECK-dont-NOT: SUMMARY: LeakSanitizer:
+// CHECK-do: SUMMARY: {{(Leak|Address)}}Sanitizer:
+// CHECK-dont-NOT: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/link_turned_off.cc Fri Nov 1 12:02:14 2013
@@ -21,4 +21,4 @@ int main(int argc, char *argv[]) {
return 0;
}
-// CHECK: SUMMARY: LeakSanitizer: 4 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 4 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/pointer_to_self.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/pointer_to_self.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/pointer_to_self.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/pointer_to_self.cc Fri Nov 1 12:02:14 2013
@@ -15,4 +15,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc Fri Nov 1 12:02:14 2013
@@ -38,5 +38,5 @@ void ConfirmPointerHasSurvived() {
// CHECK-sanity: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
// CHECK-sanity: Value after LSan: [[ADDR]].
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_default.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_default.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_default.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_default.cc Fri Nov 1 12:02:14 2013
@@ -26,4 +26,4 @@ int main() {
}
// CHECK: Suppressions used:
// CHECK: 1 666 *LSanTestLeakingFunc*
-// CHECK: SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_file.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_file.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_file.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/suppressions_file.cc Fri Nov 1 12:02:14 2013
@@ -26,4 +26,4 @@ int main() {
}
// CHECK: Suppressions used:
// CHECK: 1 666 *LSanTestLeakingFunc*
-// CHECK: SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 1337 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/swapcontext.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/swapcontext.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/swapcontext.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/swapcontext.cc Fri Nov 1 12:02:14 2013
@@ -39,4 +39,4 @@ int main(int argc, char *argv[]) {
return 0;
}
-// CHECK: SUMMARY: LeakSanitizer: 2664 byte(s) leaked in 1 allocation(s)
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: 2664 byte(s) leaked in 1 allocation(s)
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_after_return.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_after_return.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_after_return.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_after_return.cc Fri Nov 1 12:02:14 2013
@@ -20,4 +20,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc Fri Nov 1 12:02:14 2013
@@ -18,4 +18,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc Fri Nov 1 12:02:14 2013
@@ -18,4 +18,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_registers.cc Fri Nov 1 12:02:14 2013
@@ -48,4 +48,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks.cc Fri Nov 1 12:02:14 2013
@@ -17,4 +17,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc Fri Nov 1 12:02:14 2013
@@ -33,4 +33,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc Fri Nov 1 12:02:14 2013
@@ -30,4 +30,4 @@ int main(int argc, char *argv[]) {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc Fri Nov 1 12:02:14 2013
@@ -34,4 +34,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc Fri Nov 1 12:02:14 2013
@@ -28,4 +28,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_tls_static.cc Fri Nov 1 12:02:14 2013
@@ -18,4 +18,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
Modified: compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc (original)
+++ compiler-rt/trunk/lib/lsan/lit_tests/TestCases/use_unaligned.cc Fri Nov 1 12:02:14 2013
@@ -20,4 +20,4 @@ int main() {
// CHECK: Test alloc: [[ADDR:.*]].
// CHECK: Directly leaked 1337 byte object at [[ADDR]]
// CHECK: LeakSanitizer: detected memory leaks
-// CHECK: SUMMARY: LeakSanitizer:
+// CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer:
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=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Fri Nov 1 12:02:14 2013
@@ -509,13 +509,11 @@ void LeakReport::PrintSummary() {
bytes += leaks_[i].total_size;
allocations += leaks_[i].hit_count;
}
- const int kMaxSummaryLength = 128;
InternalScopedBuffer<char> summary(kMaxSummaryLength);
- internal_snprintf(summary.data(), kMaxSummaryLength,
- "SUMMARY: LeakSanitizer: %zu byte(s) leaked in %zu "
- "allocation(s).",
- bytes, allocations);
- __sanitizer_report_error_summary(summary.data());
+ internal_snprintf(summary.data(), summary.size(),
+ "%zu byte(s) leaked in %zu allocation(s).", bytes,
+ allocations);
+ ReportErrorSummary(summary.data());
}
uptr LeakReport::ApplySuppressions() {
Modified: compiler-rt/trunk/lib/msan/msan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_report.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan_report.cc (original)
+++ compiler-rt/trunk/lib/msan/msan_report.cc Fri Nov 1 12:02:14 2013
@@ -66,14 +66,6 @@ static void DescribeOrigin(u32 origin) {
}
}
-static void ReportSummary(const char *error_type, StackTrace *stack) {
- if (!stack->size || !Symbolizer::Get()->IsAvailable()) return;
- AddressInfo ai;
- uptr pc = StackTrace::GetPreviousInstructionPc(stack->trace[0]);
- Symbolizer::Get()->SymbolizeCode(pc, &ai, 1);
- ReportErrorSummary(error_type, ai.file, ai.line, ai.function);
-}
-
void ReportUMR(StackTrace *stack, u32 origin) {
if (!__msan::flags()->report_umrs) return;
@@ -87,7 +79,7 @@ void ReportUMR(StackTrace *stack, u32 or
if (origin) {
DescribeOrigin(origin);
}
- ReportSummary("use-of-uninitialized-value", stack);
+ ReportErrorSummary("use-of-uninitialized-value", stack);
}
void ReportExpectedUMRNotFound(StackTrace *stack) {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Fri Nov 1 12:02:14 2013
@@ -14,6 +14,8 @@
#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_libc.h"
+#include "sanitizer_stacktrace.h"
+#include "sanitizer_symbolizer.h"
namespace __sanitizer {
@@ -163,16 +165,32 @@ void PrintModuleAndOffset(const char *mo
StripPathPrefix(module, common_flags()->strip_path_prefix), offset);
}
+void ReportErrorSummary(const char *error_message) {
+ InternalScopedBuffer<char> buff(kMaxSummaryLength);
+ internal_snprintf(buff.data(), buff.size(),
+ "SUMMARY: %s: %s", SanitizerToolName, error_message);
+ __sanitizer_report_error_summary(buff.data());
+}
+
void ReportErrorSummary(const char *error_type, const char *file,
int line, const char *function) {
- const int kMaxSize = 1024; // We don't want a summary too long.
- InternalScopedBuffer<char> buff(kMaxSize);
+ InternalScopedBuffer<char> buff(kMaxSummaryLength);
internal_snprintf(
- buff.data(), kMaxSize, "SUMMARY: %s: %s %s:%d %s", SanitizerToolName,
- error_type,
+ buff.data(), buff.size(), "%s %s:%d %s", error_type,
file ? StripPathPrefix(file, common_flags()->strip_path_prefix) : "??",
line, function ? function : "??");
- __sanitizer_report_error_summary(buff.data());
+ ReportErrorSummary(buff.data());
+}
+
+void ReportErrorSummary(const char *error_type, StackTrace *stack) {
+ AddressInfo ai;
+ if (stack->size > 0 && Symbolizer::Get()->IsAvailable()) {
+ // 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]);
+ Symbolizer::Get()->SymbolizeCode(pc, &ai, 1);
+ }
+ ReportErrorSummary(error_type, ai.file, ai.line, ai.function);
}
LoadedModule::LoadedModule(const char *module_name, uptr base_address) {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=193864&r1=193863&r2=193864&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Fri Nov 1 12:02:14 2013
@@ -184,11 +184,17 @@ typedef void (*CheckFailedCallbackType)(
u64, u64);
void SetCheckFailedCallback(CheckFailedCallbackType callback);
-// Construct a one-line string like
-// SanitizerToolName: error_type file:line function
-// and call __sanitizer_report_error_summary on it.
+// We don't want a summary too long.
+const int kMaxSummaryLength = 1024;
+// Construct a one-line string:
+// SUMMARY: SanitizerToolName: error_message
+// and pass it to __sanitizer_report_error_summary.
+void ReportErrorSummary(const char *error_message);
+// Same as above, but construct error_message as:
+// error_type: file:line function
void ReportErrorSummary(const char *error_type, const char *file,
int line, const char *function);
+void ReportErrorSummary(const char *error_type, StackTrace *trace);
// Math
#if SANITIZER_WINDOWS && !defined(__clang__) && !defined(__GNUC__)
More information about the llvm-commits
mailing list