diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-25 23:03:29 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-10-25 23:03:29 +0000 |
commit | c1a1ed62228288155459d39194995a36aca4a8a6 (patch) | |
tree | 4bb3144d74f7d3db0bcfcecc867ed7b13e83e3f0 /lib/lsan | |
parent | 8f0c5bdd9650256501bad9fc5dedc977f4ca2247 (diff) | |
download | compiler-rt-c1a1ed62228288155459d39194995a36aca4a8a6.tar.gz |
Overhaul the symbolizer interface.
This moves away from creating the symbolizer object and initializing the
external symbolizer as separate steps. Those steps now always take place
together.
Sanitizers with a legacy requirement to specify their own symbolizer path
should use InitSymbolizer to initialize the symbolizer with the desired
path, and GetSymbolizer to access the symbolizer. Sanitizers with no
such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for
initialization.
The symbolizer interface has been made thread-safe (as far as I can
tell) by protecting its member functions with mutexes.
Finally, the symbolizer interface no longer relies on weak externals, the
introduction of which was probably a mistake on my part.
Differential Revision: http://llvm-reviews.chandlerc.com/D1985
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan')
-rw-r--r-- | lib/lsan/lsan.cc | 5 | ||||
-rw-r--r-- | lib/lsan/lsan_common.cc | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/lsan/lsan.cc b/lib/lsan/lsan.cc index 7f37da6c3..3006f04f3 100644 --- a/lib/lsan/lsan.cc +++ b/lib/lsan/lsan.cc @@ -53,8 +53,9 @@ void Init() { // Start symbolizer process if necessary. if (common_flags()->symbolize) { - getSymbolizer() - ->InitializeExternal(common_flags()->external_symbolizer_path); + Symbolizer::Init(common_flags()->external_symbolizer_path); + } else { + Symbolizer::Disable(); } InitCommonLsan(); diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc index 8a4ec7a31..8a3bc2e36 100644 --- a/lib/lsan/lsan_common.cc +++ b/lib/lsan/lsan_common.cc @@ -413,8 +413,8 @@ static Suppression *GetSuppressionForAddr(uptr addr) { static const uptr kMaxAddrFrames = 16; InternalScopedBuffer<AddressInfo> addr_frames(kMaxAddrFrames); for (uptr i = 0; i < kMaxAddrFrames; i++) new (&addr_frames[i]) AddressInfo(); - uptr addr_frames_num = - getSymbolizer()->SymbolizeCode(addr, addr_frames.data(), kMaxAddrFrames); + uptr addr_frames_num = Symbolizer::Get()->SymbolizeCode( + addr, addr_frames.data(), kMaxAddrFrames); for (uptr i = 0; i < addr_frames_num; i++) { Suppression* s; if (suppression_ctx->Match(addr_frames[i].function, SuppressionLeak, &s) || |