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
This commit is contained in:
Alexey Samsonov 2013-10-16 09:54:49 +00:00
parent b4a0ba1718
commit d9729ae8c5
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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;