[compiler-rt] r198000 - [Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
Alexey Samsonov
samsonov at google.com
Tue Dec 24 23:09:44 PST 2013
Author: samsonov
Date: Wed Dec 25 01:09:44 2013
New Revision: 198000
URL: http://llvm.org/viewvc/llvm-project?rev=198000&view=rev
Log:
[Sanitizer] Replace Symbolizer::IsAvailable and Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo.
Remove now redundant checks in symbolizer initialization in TSan and MSan.
Modified:
compiler-rt/trunk/lib/msan/msan.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Wed Dec 25 01:09:44 2013
@@ -300,12 +300,7 @@ void __msan_init() {
Die();
}
- const char *external_symbolizer = common_flags()->external_symbolizer_path;
- bool external_symbolizer_started =
- Symbolizer::Init(external_symbolizer)->IsExternalAvailable();
- if (external_symbolizer && external_symbolizer[0]) {
- CHECK(external_symbolizer_started);
- }
+ Symbolizer::Init(common_flags()->external_symbolizer_path);
Symbolizer::Get()->AddHooks(EnterSymbolizer, ExitSymbolizer);
GetThreadStackAndTls(/* main */ true, &msan_stack_bounds.stack_addr,
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=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.cc Wed Dec 25 01:09:44 2013
@@ -202,7 +202,7 @@ void ReportErrorSummary(const char *erro
return;
AddressInfo ai;
#if !SANITIZER_GO
- if (stack->size > 0 && Symbolizer::Get()->IsAvailable()) {
+ if (stack->size > 0 && Symbolizer::Get()->CanReturnFileLineInfo()) {
// 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]);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer.h Wed Dec 25 01:09:44 2013
@@ -95,10 +95,7 @@ class Symbolizer {
virtual bool SymbolizeData(uptr address, DataInfo *info) {
return false;
}
- virtual bool IsAvailable() {
- return false;
- }
- virtual bool IsExternalAvailable() {
+ virtual bool CanReturnFileLineInfo() {
return false;
}
// Release internal caches (if any).
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc Wed Dec 25 01:09:44 2013
@@ -473,14 +473,10 @@ class POSIXSymbolizer : public Symbolize
return true;
}
- bool IsAvailable() {
+ bool CanReturnFileLineInfo() {
return internal_symbolizer_ != 0 || external_symbolizer_ != 0;
}
- bool IsExternalAvailable() {
- return external_symbolizer_ != 0;
- }
-
void Flush() {
BlockingMutexLock l(&mu_);
if (internal_symbolizer_ != 0) {
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_win.cc Wed Dec 25 01:09:44 2013
@@ -74,7 +74,7 @@ class WinSymbolizer : public Symbolizer
return 1;
}
- bool IsAvailable() {
+ bool CanReturnFileLineInfo() {
return true;
}
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Wed Dec 25 01:09:44 2013
@@ -241,16 +241,7 @@ void Initialize(ThreadState *thr) {
InitializeSuppressions();
#ifndef TSAN_GO
InitializeLibIgnore();
- // Initialize external symbolizer before internal threads are started.
- const char *external_symbolizer = flags()->external_symbolizer_path;
- bool external_symbolizer_started =
- Symbolizer::Init(external_symbolizer)->IsExternalAvailable();
- if (external_symbolizer != 0 && external_symbolizer[0] != '\0' &&
- !external_symbolizer_started) {
- Printf("Failed to start external symbolizer: '%s'\n",
- external_symbolizer);
- Die();
- }
+ Symbolizer::Init(common_flags()->external_symbolizer_path);
Symbolizer::Get()->AddHooks(EnterSymbolizer, ExitSymbolizer);
#endif
internal_start_thread(&BackgroundThread, 0);
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc?rev=198000&r1=197999&r2=198000&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_symbolize.cc Wed Dec 25 01:09:44 2013
@@ -105,7 +105,7 @@ ReportStack *SymbolizeCode(uptr addr) {
ent->col = col;
return ent;
}
- if (!Symbolizer::Get()->IsAvailable())
+ if (!Symbolizer::Get()->CanReturnFileLineInfo())
return SymbolizeCodeAddr2Line(addr);
static const uptr kMaxAddrFrames = 16;
InternalScopedBuffer<AddressInfo> addr_frames(kMaxAddrFrames);
@@ -131,8 +131,6 @@ ReportStack *SymbolizeCode(uptr addr) {
}
ReportLocation *SymbolizeData(uptr addr) {
- if (!Symbolizer::Get()->IsAvailable())
- return 0;
DataInfo info;
if (!Symbolizer::Get()->SymbolizeData(addr, &info))
return 0;
@@ -150,8 +148,6 @@ ReportLocation *SymbolizeData(uptr addr)
}
void SymbolizeFlush() {
- if (!Symbolizer::Get()->IsAvailable())
- return;
Symbolizer::Get()->Flush();
}
More information about the llvm-commits
mailing list