From 70c6e3fb6dfddb9c4d26ac133beb5f53b71e47d9 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Wed, 13 Feb 2013 07:19:47 +0000 Subject: [msan] don't check shadow inside interceptors if we are inside symbolizer; add weak function __msan_default_options that overrides default options git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@175040 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/msan/msan_report.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'lib/msan/msan_report.cc') diff --git a/lib/msan/msan_report.cc b/lib/msan/msan_report.cc index d4a6d3018..16b13f6c0 100644 --- a/lib/msan/msan_report.cc +++ b/lib/msan/msan_report.cc @@ -44,6 +44,16 @@ class Decorator: private __sanitizer::AnsiColorDecorator { const char *End() { return Default(); } }; +struct SymbolizerScope { + SymbolizerScope() { EnterSymbolizer(); } + ~SymbolizerScope() { ExitSymbolizer(); } +}; + +static void PrintStack(const uptr *trace, uptr size) { + SymbolizerScope sym_scope; + StackTrace::PrintStack(trace, size, true, flags()->strip_path_prefix, 0); +} + static void DescribeOrigin(u32 origin) { Decorator d; if (flags()->verbosity) @@ -64,7 +74,7 @@ static void DescribeOrigin(u32 origin) { const uptr *trace = StackDepotGet(origin, &size); Printf(" %sUninitialized value was created by a heap allocation%s\n", d.Origin(), d.End()); - StackTrace::PrintStack(trace, size, true, flags()->strip_path_prefix, 0); + PrintStack(trace, size); } } @@ -72,7 +82,10 @@ static void ReportSummary(const char *error_type, StackTrace *stack) { if (!stack->size || !IsSymbolizerAvailable()) return; AddressInfo ai; uptr pc = StackTrace::GetPreviousInstructionPc(stack->trace[0]); - SymbolizeCode(pc, &ai, 1); + { + SymbolizerScope sym_scope; + SymbolizeCode(pc, &ai, 1); + } ReportErrorSummary(error_type, StripPathPrefix(ai.file, flags()->strip_path_prefix), ai.line, ai.function); @@ -87,8 +100,7 @@ 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, - flags()->strip_path_prefix, 0); + PrintStack(stack->trace, stack->size); if (origin) { DescribeOrigin(origin); } @@ -99,8 +111,7 @@ void ReportExpectedUMRNotFound(StackTrace *stack) { GenericScopedLock lock(&report_mu); Printf(" WARNING: Expected use of uninitialized value not found\n"); - StackTrace::PrintStack(stack->trace, stack->size, true, - flags()->strip_path_prefix, 0); + PrintStack(stack->trace, stack->size); } void ReportAtExitStatistics() { -- cgit v1.2.3