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/ubsan | |
parent | 8f0c5bdd9650256501bad9fc5dedc977f4ca2247 (diff) |
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/ubsan')
-rw-r--r-- | lib/ubsan/lit_tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/ubsan/lit_tests/TypeCheck/Function/function.cpp | 2 | ||||
-rw-r--r-- | lib/ubsan/lit_tests/lit.cfg | 3 | ||||
-rw-r--r-- | lib/ubsan/ubsan_diag.cc | 4 |
4 files changed, 3 insertions, 7 deletions
diff --git a/lib/ubsan/lit_tests/CMakeLists.txt b/lib/ubsan/lit_tests/CMakeLists.txt index 6abc8a01e..7e1a13c78 100644 --- a/lib/ubsan/lit_tests/CMakeLists.txt +++ b/lib/ubsan/lit_tests/CMakeLists.txt @@ -8,7 +8,6 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS) # working binaries. set(UBSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} - asan ${UBSAN_RUNTIME_LIBRARIES}) set(UBSAN_TEST_PARAMS ubsan_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg diff --git a/lib/ubsan/lit_tests/TypeCheck/Function/function.cpp b/lib/ubsan/lit_tests/TypeCheck/Function/function.cpp index feff0f5aa..8106ae47e 100644 --- a/lib/ubsan/lit_tests/TypeCheck/Function/function.cpp +++ b/lib/ubsan/lit_tests/TypeCheck/Function/function.cpp @@ -1,4 +1,4 @@ -// RUN: %clangxx -fsanitize=address,function %s -O3 -g -o %t +// RUN: %clangxx -fsanitize=function %s -O3 -g -o %t // RUN: %t 2>&1 | FileCheck %s #include <stdint.h> diff --git a/lib/ubsan/lit_tests/lit.cfg b/lib/ubsan/lit_tests/lit.cfg index d96912fe8..4a5bc237b 100644 --- a/lib/ubsan/lit_tests/lit.cfg +++ b/lib/ubsan/lit_tests/lit.cfg @@ -54,9 +54,6 @@ config.substitutions.append( ("%clang ", (" " + config.clang + " ")) ) config.substitutions.append( ("%clangxx ", (" " + config.clang + " --driver-mode=g++ ")) ) -# Setup path to external LLVM symbolizer. -config.environment['ASAN_SYMBOLIZER_PATH'] = config.llvm_symbolizer_path - # Default test suffixes. config.suffixes = ['.c', '.cc', '.cpp'] diff --git a/lib/ubsan/ubsan_diag.cc b/lib/ubsan/ubsan_diag.cc index 968e7790d..158408b7d 100644 --- a/lib/ubsan/ubsan_diag.cc +++ b/lib/ubsan/ubsan_diag.cc @@ -34,7 +34,7 @@ Location __ubsan::getFunctionLocation(uptr Loc, const char **FName) { return Location(); AddressInfo Info; - if (!getSymbolizer()->SymbolizeCode(Loc, &Info, 1) || + if (!Symbolizer::GetOrInit()->SymbolizeCode(Loc, &Info, 1) || !Info.module || !*Info.module) return Location(Loc); @@ -117,7 +117,7 @@ static void renderText(const char *Message, const Diag::Arg *Args) { Printf("%s", A.String); break; case Diag::AK_Mangled: { - Printf("'%s'", getSymbolizer()->Demangle(A.String)); + Printf("'%s'", Symbolizer::GetOrInit()->Demangle(A.String)); break; } case Diag::AK_SInt: |