diff options
author | Greg Clayton <gclayton@apple.com> | 2013-10-11 22:03:48 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-10-11 22:03:48 +0000 |
commit | 93e2861b8100c91f97c0d95364ab6a368d22d9a2 (patch) | |
tree | 7e45baa987794aac8ce9bf57d0cca73815c80f72 | |
parent | a1490d616fb08179c4f67a031dd5e04c4949e63e (diff) | |
download | bcm5719-llvm-93e2861b8100c91f97c0d95364ab6a368d22d9a2.tar.gz bcm5719-llvm-93e2861b8100c91f97c0d95364ab6a368d22d9a2.zip |
<rdar://problem/15191078>
Fixed Module::ResolveSymbolContextForAddress() to be able to also look in the SymbolVendor's SymbolFile's ObjectFile for a more meaningful symbol when a symbol lookup finds a synthetic symbol from the main object file. This will help lookups on MacOSX as the main executable might be stripped, but the dSYM file always has a full symbol table.
llvm-svn: 192510
-rw-r--r-- | lldb/include/lldb/Symbol/Symtab.h | 4 | ||||
-rw-r--r-- | lldb/source/Core/Module.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/lldb/include/lldb/Symbol/Symtab.h b/lldb/include/lldb/Symbol/Symtab.h index 666c3b5686b..5dfb1c822d5 100644 --- a/lldb/include/lldb/Symbol/Symtab.h +++ b/lldb/include/lldb/Symbol/Symtab.h @@ -95,6 +95,10 @@ public: bool add_mangled, NameToIndexMap &name_to_index_map) const; + ObjectFile * GetObjectFile() + { + return m_objfile; + } protected: typedef std::vector<Symbol> collection; typedef collection::iterator iterator; diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index d96a88d533f..3f3be9360ef 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -499,7 +499,39 @@ Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve } if (sc.symbol) + { + if (sc.symbol->IsSynthetic()) + { + // We have a synthetic symbol so lets check if the object file + // from the symbol file in the symbol vendor is different than + // the object file for the module, and if so search its symbol + // table to see if we can come up with a better symbol. For example + // dSYM files on MacOSX have an unstripped symbol table inside of + // them. + ObjectFile *symtab_objfile = symtab->GetObjectFile(); + if (symtab_objfile && symtab_objfile->IsStripped()) + { + SymbolFile *symfile = sym_vendor->GetSymbolFile(); + if (symfile) + { + ObjectFile *symfile_objfile = symfile->GetObjectFile(); + if (symfile_objfile != symtab_objfile) + { + Symtab *symfile_symtab = symfile_objfile->GetSymtab(); + if (symfile_symtab) + { + Symbol *symbol = symfile_symtab->FindSymbolContainingFileAddress(so_addr.GetFileAddress()); + if (symbol && !symbol->IsSynthetic()) + { + sc.symbol = symbol; + } + } + } + } + } + } resolved_flags |= eSymbolContextSymbol; + } } } diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 87020cedb21..36652310470 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -949,7 +949,7 @@ ObjectFileMachO::IsStripped () } } if (m_dysymtab.cmd) - return m_dysymtab.nlocalsym == 0; + return m_dysymtab.nlocalsym <= 1; return false; } |