LLDB mainline
|
#include <Symtab.h>
Classes | |
class | FileRangeToIndexMapCompare |
Public Types | |
enum | Debug { eDebugNo , eDebugYes , eDebugAny } |
enum | Visibility { eVisibilityAny , eVisibilityExtern , eVisibilityPrivate } |
typedef std::vector< uint32_t > | IndexCollection |
typedef UniqueCStringMap< uint32_t > | NameToIndexMap |
Public Member Functions | |
Symtab (ObjectFile *objfile) | |
~Symtab () | |
void | PreloadSymbols () |
void | Reserve (size_t count) |
Symbol * | Resize (size_t count) |
uint32_t | AddSymbol (const Symbol &symbol) |
size_t | GetNumSymbols () const |
void | SectionFileAddressesChanged () |
void | Dump (Stream *s, Target *target, SortOrder sort_type, Mangled::NamePreference name_preference=Mangled::ePreferDemangled) |
void | Dump (Stream *s, Target *target, std::vector< uint32_t > &indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled) const |
uint32_t | GetIndexForSymbol (const Symbol *symbol) const |
std::recursive_mutex & | GetMutex () |
Symbol * | FindSymbolByID (lldb::user_id_t uid) const |
Symbol * | SymbolAtIndex (size_t idx) |
const Symbol * | SymbolAtIndex (size_t idx) const |
Symbol * | FindSymbolWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx) |
const Symbol * | GetParent (Symbol *symbol) const |
Get the parent symbol for the given symbol. | |
uint32_t | AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const |
uint32_t | AppendSymbolIndexesWithTypeAndFlagsValue (lldb::SymbolType symbol_type, uint32_t flags_value, std::vector< uint32_t > &indexes, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const |
uint32_t | AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &matches, uint32_t start_idx=0, uint32_t end_index=UINT32_MAX) const |
uint32_t | AppendSymbolIndexesWithName (ConstString symbol_name, std::vector< uint32_t > &matches) |
uint32_t | AppendSymbolIndexesWithName (ConstString symbol_name, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &matches) |
uint32_t | AppendSymbolIndexesWithNameAndType (ConstString symbol_name, lldb::SymbolType symbol_type, std::vector< uint32_t > &matches) |
uint32_t | AppendSymbolIndexesWithNameAndType (ConstString symbol_name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &matches) |
uint32_t | AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled) |
uint32_t | AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &indexes, Mangled::NamePreference name_preference=Mangled::NamePreference::ePreferDemangled) |
void | FindAllSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes) |
void | FindAllSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &symbol_indexes) |
void | FindAllSymbolsMatchingRexExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &symbol_indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled) |
Symbol * | FindFirstSymbolWithNameAndType (ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility) |
Symbol * | FindSymbolAtFileAddress (lldb::addr_t file_addr) |
Symbol * | FindSymbolContainingFileAddress (lldb::addr_t file_addr) |
void | ForEachSymbolContainingFileAddress (lldb::addr_t file_addr, std::function< bool(Symbol *)> const &callback) |
void | FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list) |
void | SortSymbolIndexesByValue (std::vector< uint32_t > &indexes, bool remove_duplicates) const |
void | Finalize () |
void | AppendSymbolNamesToMap (const IndexCollection &indexes, bool add_demangled, bool add_mangled, NameToIndexMap &name_to_index_map) const |
ObjectFile * | GetObjectFile () const |
bool | Decode (const DataExtractor &data, lldb::offset_t *offset_ptr, bool &uuid_mismatch) |
Decode a serialized version of this object from data. | |
bool | Encode (DataEncoder &encoder) const |
Encode this object into a data encoder object. | |
std::string | GetCacheKey () |
Get the cache key string for this symbol table. | |
void | SaveToCache () |
Save the symbol table data out into a cache. | |
bool | LoadFromCache () |
Load the symbol table from the index cache. | |
bool | GetWasLoadedFromCache () const |
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module index cache. | |
void | SetWasLoadedFromCache () |
bool | GetWasSavedToCache () const |
void | SetWasSavedToCache () |
Static Public Member Functions | |
static void | DumpSymbolHeader (Stream *s) |
Protected Types | |
typedef std::vector< Symbol > | collection |
typedef collection::iterator | iterator |
typedef collection::const_iterator | const_iterator |
typedef RangeDataVector< lldb::addr_t, lldb::addr_t, uint32_t, 0, FileRangeToIndexMapCompare > | FileRangeToIndexMap |
Protected Member Functions | |
void | InitNameIndexes () |
void | InitAddressIndexes () |
Protected Attributes | |
ObjectFile * | m_objfile |
collection | m_symbols |
FileRangeToIndexMap | m_file_addr_to_index |
std::map< lldb::FunctionNameType, UniqueCStringMap< uint32_t > > | m_name_to_symbol_indices |
Maps function names to symbol indices (grouped by FunctionNameTypes) | |
std::recursive_mutex | m_mutex |
bool | m_file_addr_to_index_computed: 1 |
bool | m_name_indexes_computed: 1 |
bool | m_loaded_from_cache: 1 |
bool | m_saved_to_cache: 1 |
Private Member Functions | |
UniqueCStringMap< uint32_t > & | GetNameToSymbolIndexMap (lldb::FunctionNameType type) |
bool | CheckSymbolAtIndex (size_t idx, Debug symbol_debug_type, Visibility symbol_visibility) const |
uint32_t | GetNameIndexes (ConstString symbol_name, std::vector< uint32_t > &indexes) |
A helper function that looks up full function names. | |
void | SymbolIndicesToSymbolContextList (std::vector< uint32_t > &symbol_indexes, SymbolContextList &sc_list) |
void | RegisterMangledNameEntry (uint32_t value, std::set< const char * > &class_contexts, std::vector< std::pair< NameToIndexMap::Entry, const char * > > &backlog, RichManglingContext &rmc) |
void | RegisterBacklogEntry (const NameToIndexMap::Entry &entry, const char *decl_context, const std::set< const char * > &class_contexts) |
Symtab (const Symtab &)=delete | |
const Symtab & | operator= (const Symtab &)=delete |
|
protected |
|
protected |
|
protected |
typedef std::vector<uint32_t> lldb_private::Symtab::IndexCollection |
|
protected |
typedef UniqueCStringMap<uint32_t> lldb_private::Symtab::NameToIndexMap |
Symtab::Symtab | ( | ObjectFile * | objfile | ) |
Definition at line 34 of file Symtab.cpp.
References m_name_to_symbol_indices.
|
default |
|
privatedelete |
uint32_t Symtab::AddSymbol | ( | const Symbol & | symbol | ) |
Definition at line 64 of file Symtab.cpp.
References lldb_private::RangeDataVector< B, S, T, N, Compare >::Clear(), GetNameToSymbolIndexMap(), m_file_addr_to_index, m_file_addr_to_index_computed, m_name_indexes_computed, and m_symbols.
Referenced by SymbolFilePDB::AddSymbols(), lldb_private::breakpad::SymbolFileBreakpad::AddSymbols(), lldb_private::SymbolFileJSON::AddSymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), ObjectFilePECOFF::AppendFromExportTable(), ParsePLTRelocations(), ObjectFileELF::ParseSymbols(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), lldb_private::ObjectFileJSON::ParseSymtab(), and ObjectFileELF::ParseUnwindSymbols().
uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType | ( | const RegularExpression & | regex, |
lldb::SymbolType | symbol_type, | ||
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | indexes, | ||
Mangled::NamePreference | name_preference = Mangled::NamePreference::ePreferDemangled |
||
) |
Definition at line 779 of file Symtab.cpp.
References CheckSymbolAtIndex(), lldb::eSymbolTypeAny, lldb_private::RegularExpression::Execute(), m_mutex, and m_symbols.
uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType | ( | const RegularExpression & | regex, |
lldb::SymbolType | symbol_type, | ||
std::vector< uint32_t > & | indexes, | ||
Mangled::NamePreference | name_preference = Mangled::ePreferDemangled |
||
) |
Definition at line 757 of file Symtab.cpp.
References lldb::eSymbolTypeAny, lldb_private::RegularExpression::Execute(), m_mutex, and m_symbols.
Referenced by FindAllSymbolsMatchingRexExAndType(), lldb_private::SymbolFileOnDemand::FindFunctions(), lldb_private::Module::FindFunctions(), and LookupSymbolInModule().
uint32_t Symtab::AppendSymbolIndexesWithName | ( | ConstString | symbol_name, |
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | matches | ||
) |
Definition at line 693 of file Symtab.cpp.
References CheckSymbolAtIndex(), GetNameIndexes(), InitNameIndexes(), LLDB_SCOPED_TIMER, m_mutex, and m_name_indexes_computed.
uint32_t Symtab::AppendSymbolIndexesWithName | ( | ConstString | symbol_name, |
std::vector< uint32_t > & | matches | ||
) |
Definition at line 680 of file Symtab.cpp.
References GetNameIndexes(), InitNameIndexes(), m_mutex, and m_name_indexes_computed.
Referenced by AppendSymbolIndexesWithNameAndType(), and LookupSymbolInModule().
uint32_t Symtab::AppendSymbolIndexesWithNameAndType | ( | ConstString | symbol_name, |
lldb::SymbolType | symbol_type, | ||
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | matches | ||
) |
Definition at line 737 of file Symtab.cpp.
References AppendSymbolIndexesWithName(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.
uint32_t Symtab::AppendSymbolIndexesWithNameAndType | ( | ConstString | symbol_name, |
lldb::SymbolType | symbol_type, | ||
std::vector< uint32_t > & | matches | ||
) |
Definition at line 719 of file Symtab.cpp.
References AppendSymbolIndexesWithName(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by FindAllSymbolsWithNameAndType(), and FindFirstSymbolWithNameAndType().
uint32_t Symtab::AppendSymbolIndexesWithType | ( | lldb::SymbolType | symbol_type, |
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | matches, | ||
uint32_t | start_idx = 0 , |
||
uint32_t | end_index = UINT32_MAX |
||
) | const |
Definition at line 537 of file Symtab.cpp.
References CheckSymbolAtIndex(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.
uint32_t Symtab::AppendSymbolIndexesWithType | ( | lldb::SymbolType | symbol_type, |
std::vector< uint32_t > & | indexes, | ||
uint32_t | start_idx = 0 , |
||
uint32_t | end_index = UINT32_MAX |
||
) | const |
Definition at line 499 of file Symtab.cpp.
References lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by SymbolFileSymtab::CalculateAbilities(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
uint32_t Symtab::AppendSymbolIndexesWithTypeAndFlagsValue | ( | lldb::SymbolType | symbol_type, |
uint32_t | flags_value, | ||
std::vector< uint32_t > & | indexes, | ||
uint32_t | start_idx = 0 , |
||
uint32_t | end_index = UINT32_MAX |
||
) | const |
Definition at line 517 of file Symtab.cpp.
References lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
void Symtab::AppendSymbolNamesToMap | ( | const IndexCollection & | indexes, |
bool | add_demangled, | ||
bool | add_mangled, | ||
NameToIndexMap & | name_to_index_map | ||
) | const |
Definition at line 471 of file Symtab.cpp.
References lldb_private::UniqueCStringMap< T >::Append(), lldb_private::Mangled::GetDemangledName(), lldb_private::Symbol::GetMangled(), lldb_private::Mangled::GetMangledName(), LLDB_SCOPED_TIMER, m_mutex, and m_symbols.
Referenced by SymbolFileSymtab::CalculateAbilities().
|
inlineprivate |
Definition at line 292 of file Symtab.h.
References eDebugAny, eDebugNo, eDebugYes, eVisibilityAny, eVisibilityExtern, eVisibilityPrivate, and m_symbols.
Referenced by AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesWithName(), AppendSymbolIndexesWithType(), and FindSymbolWithType().
bool Symtab::Decode | ( | const DataExtractor & | data, |
lldb::offset_t * | offset_ptr, | ||
bool & | uuid_mismatch | ||
) |
Decode a serialized version of this object from data.
data | The decoder object that references the serialized data. | |
offset_ptr | A pointer that contains the offset from which the data will be decoded from that gets updated as data gets decoded. | |
[out] | uuid_mismatch | Set to true if a cache file exists but the UUID didn't match, false otherwise. |
Definition at line 1303 of file Symtab.cpp.
References CURRENT_CACHE_VERSION, lldb_private::CacheSignature::Decode(), lldb_private::StringTableReader::Decode(), Decode(), DecodeCStrMap(), elapsed(), lldb_private::DataExtractor::GetData(), lldb_private::ModuleChild::GetModule(), GetNameToSymbolIndexMap(), lldb_private::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), kIdentifierSymbolTable(), m_name_indexes_computed, m_objfile, and m_symbols.
Referenced by Decode(), and LoadFromCache().
void Symtab::Dump | ( | Stream * | s, |
Target * | target, | ||
SortOrder | sort_type, | ||
Mangled::NamePreference | name_preference = Mangled::ePreferDemangled |
||
) |
Definition at line 87 of file Symtab.cpp.
References lldb_private::RangeData< B, S, T >::data, lldb_private::Symbol::Dump(), DumpSymbolHeader(), lldb_private::eSortOrderByAddress, lldb_private::eSortOrderByName, lldb_private::eSortOrderBySize, lldb_private::eSortOrderNone, lldb_private::RangeDataVector< B, S, T, N, Compare >::GetEntryRef(), lldb_private::ObjectFile::GetFileSpec(), lldb_private::ModuleChild::GetModule(), lldb_private::FileSpec::GetPath(), lldb_private::RangeDataVector< B, S, T, N, Compare >::GetSize(), lldb_private::Stream::Indent(), InitAddressIndexes(), m_file_addr_to_index, m_file_addr_to_index_computed, m_mutex, m_objfile, m_symbols, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by ObjectFileELF::Dump().
void Symtab::Dump | ( | Stream * | s, |
Target * | target, | ||
std::vector< uint32_t > & | indexes, | ||
Mangled::NamePreference | name_preference = Mangled::ePreferDemangled |
||
) | const |
Definition at line 171 of file Symtab.cpp.
References DumpSymbolHeader(), GetNumSymbols(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_mutex, m_symbols, and lldb_private::Stream::Printf().
|
static |
Definition at line 197 of file Symtab.cpp.
References lldb_private::Stream::Indent().
Referenced by Dump().
bool Symtab::Encode | ( | DataEncoder & | encoder | ) | const |
Encode this object into a data encoder object.
The encoding format for the symbol table is as follows:
This allows this object to be serialized to disk. The object file must have a valid Signature in order to be serialized as it is used to make sure the cached information matches when cached data is loaded at a later time. If the object file doesn't have a valid signature false will be returned and it will indicate we should not cache this data.
encoder | A data encoder object that serialized bytes will be encoded into. |
Signature signature; ConstStringTable strtab; Identifier four character code: 'SYMB' uint32_t version; uint32_t num_symbols; Symbol symbols[num_symbols]; uint8_t num_cstr_maps; UniqueCStringMap<uint32_t> cstr_maps[num_cstr_maps]
Definition at line 1256 of file Symtab.cpp.
References lldb_private::DataEncoder::AppendData(), lldb_private::DataEncoder::AppendU32(), lldb_private::DataEncoder::AppendU8(), CURRENT_CACHE_VERSION, lldb_private::ConstStringTable::Encode(), lldb_private::CacheSignature::Encode(), EncodeCStrMap(), lldb_private::DataEncoder::GetAddressByteSize(), lldb_private::DataEncoder::GetByteOrder(), lldb_private::DataEncoder::GetByteSize(), lldb_private::DataEncoder::GetData(), kIdentifierSymbolTable(), m_name_indexes_computed, m_name_to_symbol_indices, m_objfile, m_symbols, and lldb_private::DataEncoder::PutU8().
Referenced by SaveToCache().
void Symtab::Finalize | ( | ) |
Definition at line 1020 of file Symtab.cpp.
References InitAddressIndexes(), m_mutex, m_symbols, and SaveToCache().
Referenced by SymbolFilePDB::AddSymbols(), lldb_private::breakpad::SymbolFileBreakpad::AddSymbols(), lldb_private::SymbolFileJSON::AddSymbols(), and lldb_private::ObjectFileJSON::ParseSymtab().
void Symtab::FindAllSymbolsMatchingRexExAndType | ( | const RegularExpression & | regex, |
lldb::SymbolType | symbol_type, | ||
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | symbol_indexes, | ||
Mangled::NamePreference | name_preference = Mangled::ePreferDemangled |
||
) |
Definition at line 861 of file Symtab.cpp.
References AppendSymbolIndexesMatchingRegExAndType(), and m_mutex.
void Symtab::FindAllSymbolsWithNameAndType | ( | ConstString | name, |
lldb::SymbolType | symbol_type, | ||
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
std::vector< uint32_t > & | symbol_indexes | ||
) |
Definition at line 842 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), InitNameIndexes(), LLDB_SCOPED_TIMER, m_mutex, and m_name_indexes_computed.
void Symtab::FindAllSymbolsWithNameAndType | ( | ConstString | name, |
lldb::SymbolType | symbol_type, | ||
std::vector< uint32_t > & | symbol_indexes | ||
) |
Definition at line 825 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), InitNameIndexes(), m_mutex, and m_name_indexes_computed.
Referenced by FindFunctionSymbols(), and lldb::SBModule::FindSymbols().
Symbol * Symtab::FindFirstSymbolWithNameAndType | ( | ConstString | name, |
lldb::SymbolType | symbol_type, | ||
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility | ||
) |
Definition at line 873 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), lldb_private::Symbol::Compare(), InitNameIndexes(), LLDB_SCOPED_TIMER, m_mutex, m_name_indexes_computed, and SymbolAtIndex().
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(), lldb_private::SymbolFileOnDemand::FindGlobalVariables(), lldb::SBModule::FindSymbol(), fixupExternalAddrZeroVariable(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), and lldb_private::plugin::dwarf::SymbolFileDWARF::GetObjCClassSymbol().
void Symtab::FindFunctionSymbols | ( | ConstString | name, |
uint32_t | name_type_mask, | ||
SymbolContextList & | sc_list | ||
) |
Definition at line 1101 of file Symtab.cpp.
References lldb::eSymbolTypeAbsolute, lldb::eSymbolTypeAny, lldb::eSymbolTypeCode, lldb::eSymbolTypeReExported, lldb::eSymbolTypeResolver, FindAllSymbolsWithNameAndType(), GetNameToSymbolIndexMap(), lldb_private::Symbol::GetType(), InitNameIndexes(), m_mutex, m_name_indexes_computed, lldb_private::SymbolContext::symbol, SymbolAtIndex(), SymbolIndicesToSymbolContextList(), and lldb_private::UniqueCStringMap< T >::Entry::value.
Referenced by lldb_private::SymbolFileOnDemand::FindFunctions().
Symbol * Symtab::FindSymbolAtFileAddress | ( | lldb::addr_t | file_addr | ) |
Definition at line 1029 of file Symtab.cpp.
References lldb_private::RangeData< B, S, T >::data, lldb_private::RangeDataVector< B, S, T, N, Compare >::FindEntryStartsAt(), lldb_private::Symbol::GetFileAddress(), InitAddressIndexes(), m_file_addr_to_index, m_file_addr_to_index_computed, m_mutex, and SymbolAtIndex().
Referenced by ObjectFileELF::ParseUnwindSymbols().
Symbol * Symtab::FindSymbolByID | ( | lldb::user_id_t | uid | ) | const |
Definition at line 219 of file Symtab.cpp.
References CompareSymbolID(), m_mutex, and m_symbols.
Referenced by ApplyELF32ABS32RelRelocation(), ApplyELF64ABS32Relocation(), ApplyELF64ABS64Relocation(), ObjectFileELF::ApplyRelocations(), GetNameIndexes(), and ObjectFileMachO::ParseSymtab().
Symbol * Symtab::FindSymbolContainingFileAddress | ( | lldb::addr_t | file_addr | ) |
Definition at line 1044 of file Symtab.cpp.
References lldb_private::Symbol::ContainsFileAddress(), lldb_private::RangeData< B, S, T >::data, lldb_private::RangeDataVector< B, S, T, N, Compare >::FindEntryThatContains(), InitAddressIndexes(), m_file_addr_to_index, m_file_addr_to_index_computed, m_mutex, and SymbolAtIndex().
Referenced by lldb_private::ObjectFile::GetAddressClass(), ObjectFileMachO::GetAddressClass(), ObjectFileELF::ParseSymtab(), and lldb_private::Module::ResolveSymbolContextForAddress().
Symbol * Symtab::FindSymbolWithType | ( | lldb::SymbolType | symbol_type, |
Debug | symbol_debug_type, | ||
Visibility | symbol_visibility, | ||
uint32_t & | start_idx | ||
) |
Definition at line 805 of file Symtab.cpp.
References CheckSymbolAtIndex(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by lldb_private::SymbolFileCTF::ParseFunctions(), and lldb_private::SymbolFileCTF::ParseObjects().
void Symtab::ForEachSymbolContainingFileAddress | ( | lldb::addr_t | file_addr, |
std::function< bool(Symbol *)> const & | callback | ||
) |
Definition at line 1060 of file Symtab.cpp.
References lldb_private::Symbol::ContainsFileAddress(), lldb_private::RangeDataVector< B, S, T, N, Compare >::FindEntryIndexesThatContain(), InitAddressIndexes(), m_file_addr_to_index, m_file_addr_to_index_computed, m_mutex, and SymbolAtIndex().
Referenced by lldb_private::Module::ResolveSymbolContextForAddress().
std::string Symtab::GetCacheKey | ( | ) |
Get the cache key string for this symbol table.
The cache key must start with the module's cache key and is followed by information that indicates this key is for caching the symbol table contents and should also include the has of the object file. A module can be represented by an ObjectFile object for the main executable, but can also have a symbol file that is from the same or a different object file. This means we might have two symbol tables cached in the index cache, one for the main executable and one for the symbol file.
Definition at line 1174 of file Symtab.cpp.
References lldb_private::ObjectFile::GetCacheHash(), lldb_private::ModuleChild::GetModule(), and m_objfile.
Referenced by LoadFromCache(), and SaveToCache().
uint32_t Symtab::GetIndexForSymbol | ( | const Symbol * | symbol | ) | const |
Definition at line 560 of file Symtab.cpp.
References m_symbols, and UINT32_MAX.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(), GetNameIndexes(), and GetParent().
|
inline |
Definition at line 51 of file Symtab.h.
References m_mutex.
Referenced by lldb_private::ObjectFile::GetSymtab().
|
private |
A helper function that looks up full function names.
We generate unique names for synthetic symbols so that users can look them up by name when needed. But because doing so is uncommon in normal debugger use, we trade off some performance at lookup time for faster symbol table building by detecting these symbols and generating their names lazily, rather than adding them to the normal symbol indexes. This function does the job of first consulting the name indexes, and if that fails it extracts the information it needs from the synthetic name and locates the symbol.
[in] | symbol_name | The symbol name to search for. |
[out] | indexes | The vector if symbol indexes to update with results. |
Definition at line 650 of file Symtab.cpp.
References FindSymbolByID(), GetIndexForSymbol(), GetNameToSymbolIndexMap(), lldb_private::ConstString::GetStringRef(), lldb_private::Symbol::GetSyntheticSymbolPrefix(), and UINT32_MAX.
Referenced by AppendSymbolIndexesWithName().
|
inlineprivate |
Definition at line 287 of file Symtab.h.
References m_name_to_symbol_indices.
Referenced by AddSymbol(), Decode(), FindFunctionSymbols(), GetNameIndexes(), InitNameIndexes(), RegisterBacklogEntry(), and RegisterMangledNameEntry().
size_t Symtab::GetNumSymbols | ( | ) | const |
Definition at line 77 of file Symtab.cpp.
References m_mutex, and m_symbols.
Referenced by SymbolFilePDB::AddSymbols(), lldb_private::SymbolFileJSON::AddSymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), ObjectFilePECOFF::AppendFromExportTable(), Dump(), findSymbolAddress(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), and ObjectFileELF::ParseUnwindSymbols().
|
inline |
Definition at line 137 of file Symtab.h.
References m_objfile.
Referenced by ObjectFileELF::GetAddressClass(), and lldb_private::Module::ResolveSymbolContextForAddress().
Get the parent symbol for the given symbol.
Many symbols in symbol tables are scoped by other symbols that contain one or more symbol. This function will look for such a containing symbol and return it if there is one.
Definition at line 1161 of file Symtab.cpp.
References GetIndexForSymbol(), lldb_private::Symbol::GetSiblingIndex(), SymbolAtIndex(), and UINT32_MAX.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE().
|
inline |
Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module index cache.
In statistics it is handy to know if a module's debug info was loaded from or saved to the cache. When the debug info index is loaded from the cache startup times can be faster. When the cache is enabled and the debug info index is saved to the cache, debug sessions can be slower. These accessors can be accessed by the statistics and emitted to help track these costs.
Definition at line 228 of file Symtab.h.
References m_loaded_from_cache.
Referenced by lldb_private::DebuggerStats::ReportStatistics().
|
inline |
Definition at line 234 of file Symtab.h.
References m_saved_to_cache.
Referenced by lldb_private::DebuggerStats::ReportStatistics().
|
protected |
Definition at line 937 of file Symtab.cpp.
References AddSectionsToRangeMap(), lldb_private::RangeDataVector< B, S, T, N, Compare >::Append(), lldb_private::RangeData< B, S, T >::data, lldb_private::RangeVector< B, S, N >::FindEntryThatContains(), lldb_private::Range< B, S >::GetByteSize(), lldb_private::RangeDataVector< B, S, T, N, Compare >::GetMutableEntryAtIndex(), lldb_private::Range< B, S >::GetRangeBase(), lldb_private::ObjectFile::GetSectionList(), lldb_private::RangeDataVector< B, S, T, N, Compare >::GetSize(), m_file_addr_to_index, m_file_addr_to_index_computed, m_objfile, m_symbols, lldb_private::Symbol::SetByteSize(), lldb_private::Range< B, S >::SetByteSize(), lldb_private::Range< B, S >::SetRangeBase(), lldb_private::Symbol::SetSizeIsSynthesized(), lldb_private::RangeVector< B, S, N >::Sort(), and lldb_private::RangeDataVector< B, S, T, N, Compare >::Sort().
Referenced by Dump(), Finalize(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), and ForEachSymbolContainingFileAddress().
|
protected |
Definition at line 281 of file Symtab.cpp.
References lldb_private::Symbol::ContainsLinkerAnnotations(), elapsed(), lldb::eSymbolTypeCode, lldb::eSymbolTypeResolver, lldb_private::Language::ForEach(), lldb_private::Mangled::GetDemangledName(), lldb_private::Symbol::GetMangled(), lldb_private::Mangled::GetMangledName(), lldb_private::ModuleChild::GetModule(), GetNameToSymbolIndexMap(), lldb_private::Mangled::GetRichManglingInfo(), lldb_private::Symbol::GetType(), lldb_private::Symbol::IsSyntheticWithAutoGeneratedName(), lldb_private::Symbol::IsTrampoline(), l, LLDB_SCOPED_TIMER, lldb_skip_name(), m_name_indexes_computed, m_objfile, m_symbols, RegisterBacklogEntry(), RegisterMangledNameEntry(), and lldb_private::ObjectFile::StripLinkerSymbolAnnotations().
Referenced by AppendSymbolIndexesWithName(), FindAllSymbolsWithNameAndType(), FindFirstSymbolWithNameAndType(), FindFunctionSymbols(), PreloadSymbols(), and SaveToCache().
bool Symtab::LoadFromCache | ( | ) |
Load the symbol table from the index cache.
Quickly load the finalized symbol table from the index cache. This saves time when the debugger starts up. The index cache file for the symbol table has the modification time set to the same time as the main module. If the cache file exists and the modification times match, we will load the symbol table from the serlized cache file.
Definition at line 1353 of file Symtab.cpp.
References Decode(), lldb_private::ObjectFile::GetAddressByteSize(), lldb_private::ObjectFile::GetByteOrder(), lldb_private::DataFileCache::GetCachedData(), GetCacheKey(), lldb_private::Module::GetIndexCache(), m_objfile, lldb_private::DataFileCache::RemoveCacheFile(), and SetWasLoadedFromCache().
void Symtab::PreloadSymbols | ( | ) |
Definition at line 466 of file Symtab.cpp.
References InitNameIndexes(), and m_mutex.
|
private |
Definition at line 448 of file Symtab.cpp.
References GetNameToSymbolIndexMap().
Referenced by InitNameIndexes().
|
private |
Definition at line 395 of file Symtab.cpp.
References lldb_private::ConstString::GetCString(), GetNameToSymbolIndexMap(), lldb_private::RichManglingContext::IsCtorOrDtor(), lldb_private::RichManglingContext::ParseFunctionBaseName(), and lldb_private::RichManglingContext::ParseFunctionDeclContextName().
Referenced by InitNameIndexes().
void Symtab::Reserve | ( | size_t | count | ) |
Definition at line 51 of file Symtab.cpp.
References m_symbols.
Referenced by ObjectFilePECOFF::AppendFromCOFFSymbolTable(), ObjectFilePECOFF::AppendFromExportTable(), and ObjectFileCOFF::ParseSymtab().
Symbol * Symtab::Resize | ( | size_t | count | ) |
Definition at line 57 of file Symtab.cpp.
References m_symbols.
Referenced by ObjectFileMachO::ParseSymtab().
void Symtab::SaveToCache | ( | ) |
Save the symbol table data out into a cache.
The symbol table will only be saved to a cache file if caching is enabled.
We cache the contents of the symbol table since symbol tables in LLDB take some time to initialize. This is due to the many sources for data that are used to create a symbol table:
Definition at line 1185 of file Symtab.cpp.
References Encode(), GetCacheKey(), lldb_private::DataEncoder::GetData(), lldb_private::Module::GetIndexCache(), InitNameIndexes(), lldb_private::endian::InlHostByteOrder(), lldb_private::DataFileCache::SetCachedData(), and SetWasSavedToCache().
Referenced by Finalize().
void Symtab::SectionFileAddressesChanged | ( | ) |
Definition at line 82 of file Symtab.cpp.
References lldb_private::RangeDataVector< B, S, T, N, Compare >::Clear(), m_file_addr_to_index, and m_file_addr_to_index_computed.
|
inline |
Definition at line 231 of file Symtab.h.
References m_loaded_from_cache.
Referenced by LoadFromCache().
|
inline |
void Symtab::SortSymbolIndexesByValue | ( | std::vector< uint32_t > & | indexes, |
bool | remove_duplicates | ||
) | const |
Definition at line 625 of file Symtab.cpp.
References LLDB_INVALID_ADDRESS, LLDB_SCOPED_TIMER, m_mutex, and m_symbols.
Referenced by SymbolFileSymtab::CalculateAbilities(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
Symbol * Symtab::SymbolAtIndex | ( | size_t | idx | ) |
Definition at line 228 of file Symtab.cpp.
References m_symbols.
Referenced by SymbolFilePDB::AddSymbols(), lldb_private::SymbolFileJSON::AddSymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CalculateFrameVariableError(), FindFirstSymbolWithNameAndType(), lldb_private::Module::FindFunctions(), FindFunctionSymbols(), findSymbolAddress(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), lldb::SBModule::FindSymbols(), ForEachSymbolContainingFileAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), GetParent(), lldb::SBModule::GetSymbolAtIndex(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO(), LookupSymbolInModule(), SymbolFileSymtab::ParseFunctions(), ObjectFileMachO::ParseSymtab(), ObjectFileELF::ParseUnwindSymbols(), lldb_private::Symtab::FileRangeToIndexMapCompare::rank(), SymbolIndicesToSymbolContextList(), and lldb_private::Module::SymbolIndicesToSymbolContextList().
const Symbol * Symtab::SymbolAtIndex | ( | size_t | idx | ) | const |
Definition at line 236 of file Symtab.cpp.
References m_symbols.
|
private |
Definition at line 1083 of file Symtab.cpp.
References lldb_private::SymbolContextList::AppendIfUnique(), lldb_private::ModuleChild::GetModule(), m_objfile, lldb_private::SymbolContext::module_sp, lldb_private::SymbolContext::symbol, and SymbolAtIndex().
Referenced by FindFunctionSymbols().
|
protected |
Definition at line 275 of file Symtab.h.
Referenced by AddSymbol(), Dump(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), ForEachSymbolContainingFileAddress(), InitAddressIndexes(), and SectionFileAddressesChanged().
|
protected |
Definition at line 282 of file Symtab.h.
Referenced by AddSymbol(), Dump(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), ForEachSymbolContainingFileAddress(), InitAddressIndexes(), and SectionFileAddressesChanged().
|
protected |
Definition at line 283 of file Symtab.h.
Referenced by GetWasLoadedFromCache(), and SetWasLoadedFromCache().
|
mutableprotected |
Definition at line 281 of file Symtab.h.
Referenced by AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesWithName(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithTypeAndFlagsValue(), AppendSymbolNamesToMap(), Dump(), Finalize(), FindAllSymbolsMatchingRexExAndType(), FindAllSymbolsWithNameAndType(), FindFirstSymbolWithNameAndType(), FindFunctionSymbols(), FindSymbolAtFileAddress(), FindSymbolByID(), FindSymbolContainingFileAddress(), FindSymbolWithType(), ForEachSymbolContainingFileAddress(), GetMutex(), GetNumSymbols(), PreloadSymbols(), and SortSymbolIndexesByValue().
|
protected |
Definition at line 282 of file Symtab.h.
Referenced by AddSymbol(), AppendSymbolIndexesWithName(), Decode(), Encode(), FindAllSymbolsWithNameAndType(), FindFirstSymbolWithNameAndType(), FindFunctionSymbols(), and InitNameIndexes().
|
protected |
Maps function names to symbol indices (grouped by FunctionNameTypes)
Definition at line 279 of file Symtab.h.
Referenced by Encode(), GetNameToSymbolIndexMap(), and Symtab().
|
protected |
Definition at line 273 of file Symtab.h.
Referenced by Decode(), Dump(), Encode(), GetCacheKey(), GetObjectFile(), InitAddressIndexes(), InitNameIndexes(), LoadFromCache(), and SymbolIndicesToSymbolContextList().
|
protected |
Definition at line 283 of file Symtab.h.
Referenced by GetWasSavedToCache(), and SetWasSavedToCache().
|
protected |
Definition at line 274 of file Symtab.h.
Referenced by AddSymbol(), AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithTypeAndFlagsValue(), AppendSymbolNamesToMap(), CheckSymbolAtIndex(), Decode(), Dump(), Encode(), Finalize(), FindSymbolByID(), FindSymbolWithType(), GetIndexForSymbol(), GetNumSymbols(), InitAddressIndexes(), InitNameIndexes(), Reserve(), Resize(), SortSymbolIndexesByValue(), and SymbolAtIndex().