[llvm] r185151 - llvm-symbolizer: skip leading underscore in Mach-O symbol table entries
Alexey Samsonov
samsonov at google.com
Fri Jun 28 07:25:52 PDT 2013
Author: samsonov
Date: Fri Jun 28 09:25:52 2013
New Revision: 185151
URL: http://llvm.org/viewvc/llvm-project?rev=185151&view=rev
Log:
llvm-symbolizer: skip leading underscore in Mach-O symbol table entries
Modified:
llvm/trunk/test/DebugInfo/llvm-symbolizer.test
llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
Modified: llvm/trunk/test/DebugInfo/llvm-symbolizer.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/llvm-symbolizer.test?rev=185151&r1=185150&r2=185151&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/llvm-symbolizer.test (original)
+++ llvm/trunk/test/DebugInfo/llvm-symbolizer.test Fri Jun 28 09:25:52 2013
@@ -32,9 +32,9 @@ CHECK-NEXT: dwarfdump-inl-test.cc:
CHECK: _Z3do1v
CHECK-NEXT: dwarfdump-test3-decl.h:7
-CHECK: _main
-CHECK: __Z3inci
-CHECK: __Z3inci
+CHECK: main
+CHECK: _Z3inci
+CHECK: _Z3inci
RUN: echo "unexisting-file 0x1234" > %t.input2
RUN: llvm-symbolizer < %t.input2
Modified: llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp?rev=185151&r1=185150&r2=185151&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp (original)
+++ llvm/trunk/tools/llvm-symbolizer/LLVMSymbolize.cpp Fri Jun 28 09:25:52 2013
@@ -74,6 +74,9 @@ ModuleInfo::ModuleInfo(ObjectFile *Obj,
StringRef SymbolName;
if (error(si->getName(SymbolName)))
continue;
+ // Mach-O symbol table names have leading underscore, skip it.
+ if (Module->isMachO() && SymbolName.size() > 0 && SymbolName[0] == '_')
+ SymbolName = SymbolName.drop_front();
// FIXME: If a function has alias, there are two entries in symbol table
// with same address size. Make sure we choose the correct one.
SymbolMapTy &M = SymbolType == SymbolRef::ST_Function ? Functions : Objects;
More information about the llvm-commits
mailing list