llvm-symbolizer: skip leading underscore in Mach-O symbol table entries

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov 2013-06-28 14:25:52 +00:00
parent c071f89a77
commit 8c6e3248e9
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -74,6 +74,9 @@ ModuleInfo::ModuleInfo(ObjectFile *Obj, DIContext *DICtx)
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;