Page MenuHomePhabricator

Add empty symbols to symtab for skipped symbols
AbandonedPublic

Authored by tberghammer on Nov 10 2015, 3:33 AM.

Details

Reviewers
clayborg
Summary

Add empty symbols to symtab for skipped symbols

LLDB skips several special purpose symbols during symtab parsing (e.g.:
arm/aarch64 mapping symbols) because we don't use them in later stages.
This CL changes the behavior to add an empty symbol to the symtab for
each skipped symbol to preserve the symbol indexes between the symtab in
the object file and LLDBs representation (it is needed because the
relocations are referencing the symbols by index).

Diff Detail

Event Timeline

tberghammer retitled this revision from to Add empty symbols to symtab for skipped symbols.
tberghammer updated this object.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.
clayborg requested changes to this revision.Nov 11 2015, 10:18 AM
clayborg edited edge metadata.

Symbols are the #1 most expensive item memory wise in LLDB right now. We remove many symbols in Mach-O and we set the m_uid of each symbol to the original symbol table index. There is a binary search for a symbol by lldb::user_id_t that is efficient:

Symbol *
Symtab::FindSymbolByID (lldb::user_id_t symbol_uid) const
{

Mutex::Locker locker (m_mutex);

Symbol *symbol = (Symbol*)::bsearch (&symbol_uid, 
                                     &m_symbols[0], 
                                     m_symbols.size(), 
                                     sizeof(m_symbols[0]),
                                     CompareSymbolID);
return symbol;

}

So just make sure to make your symbols have the correct lldb::user_id_t (the original symbol table index) and don't add empty useless symbols.

This revision now requires changes to proceed.Nov 11 2015, 10:18 AM
tberghammer abandoned this revision.Nov 12 2015, 2:39 AM

I haven't noticed we already store the symbol index. Abandon it in favor of the API you suggested