[Lldb-commits] [lldb] r192510 - <rdar://problem/15191078>
Greg Clayton
gclayton at apple.com
Fri Oct 11 15:03:48 PDT 2013
Author: gclayton
Date: Fri Oct 11 17:03:48 2013
New Revision: 192510
URL: http://llvm.org/viewvc/llvm-project?rev=192510&view=rev
Log:
<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.
Modified:
lldb/trunk/include/lldb/Symbol/Symtab.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Modified: lldb/trunk/include/lldb/Symbol/Symtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=192510&r1=192509&r2=192510&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symtab.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Oct 11 17:03:48 2013
@@ -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;
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=192510&r1=192509&r2=192510&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Oct 11 17:03:48 2013
@@ -499,7 +499,39 @@ Module::ResolveSymbolContextForAddress (
}
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;
+ }
}
}
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=192510&r1=192509&r2=192510&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Fri Oct 11 17:03:48 2013
@@ -949,7 +949,7 @@ ObjectFileMachO::IsStripped ()
}
}
if (m_dysymtab.cmd)
- return m_dysymtab.nlocalsym == 0;
+ return m_dysymtab.nlocalsym <= 1;
return false;
}
More information about the lldb-commits
mailing list