diff options
author | Kostya Serebryany <kcc@google.com> | 2013-02-07 08:04:56 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2013-02-07 08:04:56 +0000 |
commit | 1d333c5a34d896f239001e3fe69a660e40d15301 (patch) | |
tree | 34475e9369ec0f546b9a61d4e9517669a290edb7 /lib/msan/msan_report.cc | |
parent | cb8b91d6040f07bb42d3053bc4a44ff8e3e7f05f (diff) |
[msan] add strip_path_prefix flag; print error summary; don't crash while printing summary if debug info is missing. The tests will follow later once we establish the lit-like tests for msan.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@174595 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/msan/msan_report.cc')
-rw-r--r-- | lib/msan/msan_report.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc index 648cd8167..804c8ae1c 100644 --- a/lib/msan/msan_report.cc +++ b/lib/msan/msan_report.cc @@ -17,6 +17,7 @@ #include "sanitizer_common/sanitizer_mutex.h" #include "sanitizer_common/sanitizer_report_decorator.h" #include "sanitizer_common/sanitizer_stackdepot.h" +#include "sanitizer_common/sanitizer_symbolizer.h" using namespace __sanitizer; @@ -63,10 +64,19 @@ static void DescribeOrigin(u32 origin) { const uptr *trace = StackDepotGet(origin, &size); Printf(" %sUninitialised value was created by a heap allocation%s\n", d.Origin(), d.End()); - StackTrace::PrintStack(trace, size, true, "", 0); + StackTrace::PrintStack(trace, size, true, flags()->strip_path_prefix, 0); } } +static void ReportSummary(const char *error_type, StackTrace *stack) { + if (!stack->size || !IsSymbolizerAvailable()) return; + AddressInfo ai; + SymbolizeCode(stack->trace[0], &ai, 1); + ReportErrorSummary(error_type, + StripPathPrefix(ai.file, flags()->strip_path_prefix), + ai.line, ai.function); +} + void ReportUMR(StackTrace *stack, u32 origin) { if (!__msan::flags()->report_umrs) return; @@ -76,17 +86,20 @@ void ReportUMR(StackTrace *stack, u32 origin) { Printf("%s", d.Warning()); Report(" WARNING: Use of uninitialized value\n"); Printf("%s", d.End()); - StackTrace::PrintStack(stack->trace, stack->size, true, "", 0); + StackTrace::PrintStack(stack->trace, stack->size, true, + flags()->strip_path_prefix, 0); if (origin) { DescribeOrigin(origin); } + ReportSummary("use-of-uninitialized-value", stack); } void ReportExpectedUMRNotFound(StackTrace *stack) { GenericScopedLock<StaticSpinMutex> lock(&report_mu); Printf(" WARNING: Expected use of uninitialized value not found\n"); - StackTrace::PrintStack(stack->trace, stack->size, true, "", 0); + StackTrace::PrintStack(stack->trace, stack->size, true, + flags()->strip_path_prefix, 0); } void ReportAtExitStatistics() { |