[llvm] r192781 - llvm-symbolizer: don't always run demangler on global object names
Alexey Samsonov
samsonov at google.com
Wed Oct 16 02:54:50 PDT 2013
Author: samsonov
Date: Wed Oct 16 04:54:49 2013
New Revision: 192781
URL: http://llvm.org/viewvc/llvm-project?rev=192781&view=rev
Log:
llvm-symbolizer: don't always run demangler on global object names
Modified:
llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h
Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp?rev=192781&r1=192780&r2=192781&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp Wed Oct 16 04:54:49 2013
@@ -196,7 +196,7 @@ std::string LLVMSymbolizer::symbolizeDat
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
#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
Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h?rev=192781&r1=192780&r2=192781&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.h Wed Oct 16 04:54:49 2013
@@ -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;
More information about the llvm-commits
mailing list