[llvm] r192781 - llvm-symbolizer: don't always run demangler on global object names
David Blaikie
dblaikie at gmail.com
Wed Oct 16 10:51:46 PDT 2013
Test case?
On Wed, Oct 16, 2013 at 2:54 AM, Alexey Samsonov <samsonov at google.com>wrote:
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131016/adecabe1/attachment.html>
More information about the llvm-commits
mailing list