diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-10-16 09:54:49 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-10-16 09:54:49 +0000 |
commit | d9729ae8c51707d52e437b4c61242a568324855b (patch) | |
tree | 3d99b2d061a61178b752a8ef3700e85625e010ad /tools | |
parent | b4a0ba17183e1b4aa385e81e896c2a95671a40b2 (diff) | |
download | external_llvm-d9729ae8c51707d52e437b4c61242a568324855b.zip external_llvm-d9729ae8c51707d52e437b4c61242a568324855b.tar.gz external_llvm-d9729ae8c51707d52e437b4c61242a568324855b.tar.bz2 |
llvm-symbolizer: don't always run demangler on global object names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-symbolizer/LLVMSymbolize.cpp | 8 | ||||
-rw-r--r-- | tools/llvm-symbolizer/LLVMSymbolize.h | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp index 45c8664..320ab3f 100644 --- a/tools/llvm-symbolizer/LLVMSymbolize.cpp +++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp @@ -196,7 +196,7 @@ std::string LLVMSymbolizer::symbolizeData(const std::string &ModuleName, if (Opts.UseSymbolTable) { if (ModuleInfo *Info = getOrCreateModuleInfo(ModuleName)) { if (Info->symbolizeData(ModuleOffset, Name, Start, Size) && Opts.Demangle) - Name = DemangleName(Name); + Name = DemangleGlobalName(Name); } } std::stringstream ss; @@ -436,5 +436,11 @@ std::string LLVMSymbolizer::DemangleName(const std::string &Name) { #endif } +std::string LLVMSymbolizer::DemangleGlobalName(const std::string &Name) { + // We can spoil names of globals with C linkage, so use an heuristic + // approach to check if the name should be demangled. + return (Name.substr(0, 2) == "_Z") ? DemangleName(Name) : Name; +} + } // namespace symbolize } // namespace llvm diff --git a/tools/llvm-symbolizer/LLVMSymbolize.h b/tools/llvm-symbolizer/LLVMSymbolize.h index 03c765c..eb2666a 100644 --- a/tools/llvm-symbolizer/LLVMSymbolize.h +++ b/tools/llvm-symbolizer/LLVMSymbolize.h @@ -71,6 +71,7 @@ private: ObjectFile *getObjectFileFromBinary(Binary *Bin, const std::string &ArchName); std::string printDILineInfo(DILineInfo LineInfo) const; + static std::string DemangleGlobalName(const std::string &Name); // Owns all the parsed binaries and object files. SmallVector<Binary*, 4> ParsedBinariesAndObjects; |