summaryrefslogtreecommitdiff
path: root/lib/asan/asan_report.cc
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-11-01 17:02:14 +0000
committerAlexey Samsonov <samsonov@google.com>2013-11-01 17:02:14 +0000
commit2fb08720b11b4c339e191b90d85477c6a2dd74db (patch)
treeeb6edea41d09acfd47a5960ccb958907f77e0e80 /lib/asan/asan_report.cc
parent21bf90dcf562bd05df20eb55b8d0559017574ffb (diff)
downloadcompiler-rt-2fb08720b11b4c339e191b90d85477c6a2dd74db.tar.gz
compiler-rt-2fb08720b11b4c339e191b90d85477c6a2dd74db.tar.bz2
compiler-rt-2fb08720b11b4c339e191b90d85477c6a2dd74db.tar.xz
[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". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_report.cc')
-rw-r--r--lib/asan/asan_report.cc27
1 files changed, 8 insertions, 19 deletions
diff --git a/lib/asan/asan_report.cc b/lib/asan/asan_report.cc
index 5406ac02..cbd850ed 100644
--- a/lib/asan/asan_report.cc
+++ b/lib/asan/asan_report.cc
@@ -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, uptr bp, uptr addr) {
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, StackTrace *stack) {
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, StackTrace *stack) {
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, StackTrace *stack,
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 addr, StackTrace *stack) {
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(uptr addr, StackTrace *stack) {
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 ReportStringFunctionMemoryRangesOverlap(
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 bp, uptr sp,
PrintStack(&stack);
DescribeAddress(addr, access_size);
- ReportSummary(bug_descr, &stack);
+ ReportErrorSummary(bug_descr, &stack);
PrintShadowMemoryForAddress(addr);
}