|
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 | SetHasDebugMap (bool has_debug_map) |
| Set whether this symbol table has a debug map. | |
| bool | HasDebugMap () const |
| Check if this symbol table has a debug map, see SetHasDebugMap(). | |
| void | SetHasSourceFiles (bool has_source_files) |
| Set whether this symbol table contains any source file symbols. | |
| bool | HasSourceFiles () const |
| Check if this symbol table contains any source file symbols. | |
| 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 () |
| ObjectFile * | GetObjectFile () const |
| bool | Decode (const DataExtractor &data, lldb::offset_t *offset_ptr) |
| 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. | |
| uint32_t | GetState () const |
| Returns a bitmask of lldb::SymtabState flags describing the state of this symbol table. | |
| void | SetWasParsedFromObjectFile () |
| void | SetSymbolFileAddedSymbols () |
| void | SetWasLoadedFromCache () |
| Accessors for the bool that indicates if the debug info index was loaded from, or saved to the module index cache. | |
| 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 () |
| void | CalculateHasSourceFiles () const |
Protected Attributes | |
| std::recursive_mutex | m_mutex |
| Provide thread safety for this symbol table. | |
| 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) | |
| bool | m_file_addr_to_index_computed = false |
| bool | m_name_indexes_computed = false |
| bool | m_has_debug_map = false |
| Set by the object file plug-in, see SetHasDebugMap(). | |
| std::optional< bool > | m_has_source_files |
| Set by the object file plug-in, or calculated and cached by HasSourceFiles(). | |
| std::atomic< uint32_t > | m_state = lldb::eSymtabStateNone |
| A bitmask of lldb::SymtabState flags. | |
Private Member Functions | |
| void | SetStateFlags (lldb::SymtabState state) |
| 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, const Mangled::FunctionNameParts &parts, std::set< const char * > &class_contexts, std::vector< std::pair< NameToIndexMap::Entry, const char * > > &backlog) |
| 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 35 of file Symtab.cpp.
References m_file_addr_to_index, m_name_to_symbol_indices, and m_objfile.
Referenced by lldb_private::Symtab::FileRangeToIndexMapCompare::FileRangeToIndexMapCompare(), operator=(), and Symtab().
|
default |
References lldb_private::Mangled::ePreferDemangled.
| uint32_t Symtab::AddSymbol | ( | const Symbol & | symbol | ) |
Definition at line 68 of file Symtab.cpp.
References lldb::eSymbolTypeSourceFile, GetNameToSymbolIndexMap(), lldb_private::Symbol::GetType(), m_file_addr_to_index, m_file_addr_to_index_computed, m_has_source_files, m_name_indexes_computed, and m_symbols.
Referenced by lldb_private::breakpad::SymbolFileBreakpad::AddOrModifySymbols(), lldb_private::npdb::SymbolFileNativePDB::AddOrModifySymbols(), lldb_private::plugin::dwarf::SymbolFileWasm::AddOrModifySymbols(), lldb_private::SymbolFileJSON::AddOrModifySymbols(), SymbolFilePDB::AddOrModifySymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), ObjectFilePECOFF::AppendFromExportTable(), ParsePLTRelocations(), ObjectFileELF::ParseSymbols(), lldb_private::ObjectFileJSON::ParseSymtab(), lldb_private::wasm::ObjectFileWasm::ParseSymtab(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), ObjectFileXCOFF::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 758 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 736 of file Symtab.cpp.
References lldb::eSymbolTypeAny, lldb_private::RegularExpression::Execute(), m_mutex, and m_symbols.
Referenced by FindAllSymbolsMatchingRexExAndType(), lldb_private::Module::FindFunctions(), lldb_private::SymbolFileOnDemand::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 681 of file Symtab.cpp.
References CheckSymbolAtIndex(), GetNameIndexes(), InitNameIndexes(), LLDB_SCOPED_TIMER, and m_mutex.
| uint32_t Symtab::AppendSymbolIndexesWithName | ( | ConstString | symbol_name, |
| std::vector< uint32_t > & | matches ) |
Definition at line 669 of file Symtab.cpp.
References GetNameIndexes(), InitNameIndexes(), and m_mutex.
Referenced by AppendSymbolIndexesWithNameAndType(), 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 720 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 706 of file Symtab.cpp.
References AppendSymbolIndexesWithName(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by FindAllSymbolsWithNameAndType(), 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 524 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 486 of file Symtab.cpp.
References lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by SymbolFileSymtab::InitializeSymbolIndexes(), 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 504 of file Symtab.cpp.
References lldb::eSymbolTypeAny, m_mutex, and m_symbols.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
|
protected |
Definition at line 88 of file Symtab.cpp.
References lldb::eSymbolTypeSourceFile, lldb_private::Symbol::GetType(), m_has_source_files, and m_symbols.
Referenced by HasSourceFiles().
|
inlineprivate |
Definition at line 345 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 ) |
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. |
Definition at line 1311 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::DataExtractor::GetU32(), lldb_private::DataExtractor::GetU8(), kIdentifierSymbolTable(), kSymtabFlagHasDebugMap, kSymtabFlagHasSourceFiles, m_has_debug_map, m_has_source_files, m_name_indexes_computed, m_name_to_symbol_indices, 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 121 of file Symtab.cpp.
References lldb_private::Symbol::Dump(), DumpSymbolHeader(), lldb_private::eSortOrderByAddress, lldb_private::eSortOrderByName, lldb_private::eSortOrderBySize, lldb_private::eSortOrderNone, lldb_private::Stream::Format(), lldb_private::FileSpec::GetPath(), 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 205 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 231 of file Symtab.cpp.
References lldb_private::Stream::Indent().
| 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; uint8_t flags; // kSymtabFlagHasDebugMap, kSymtabFlagHasSourceFiles 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::CacheSignature::Encode(), lldb_private::ConstStringTable::Encode(), EncodeCStrMap(), lldb_private::DataEncoder::GetAddressByteSize(), lldb_private::DataEncoder::GetByteOrder(), lldb_private::DataEncoder::GetByteSize(), lldb_private::DataEncoder::GetData(), HasSourceFiles(), kIdentifierSymbolTable(), kSymtabFlagHasDebugMap, kSymtabFlagHasSourceFiles, m_has_debug_map, 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 998 of file Symtab.cpp.
References InitAddressIndexes(), m_mutex, m_symbols, and SaveToCache().
Referenced by lldb_private::breakpad::SymbolFileBreakpad::AddOrModifySymbols(), lldb_private::SymbolFileJSON::AddOrModifySymbols(), SymbolFilePDB::AddOrModifySymbols(), lldb_private::ObjectFile::GetSymtab(), lldb_private::ObjectFileJSON::ParseSymtab(), and lldb_private::wasm::ObjectFileWasm::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 838 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 820 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), InitNameIndexes(), LLDB_SCOPED_TIMER, and m_mutex.
| void Symtab::FindAllSymbolsWithNameAndType | ( | ConstString | name, |
| lldb::SymbolType | symbol_type, | ||
| std::vector< uint32_t > & | symbol_indexes ) |
Definition at line 804 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), InitNameIndexes(), and m_mutex.
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 850 of file Symtab.cpp.
References AppendSymbolIndexesWithNameAndType(), lldb_private::Symbol::Compare(), InitNameIndexes(), LLDB_SCOPED_TIMER, m_mutex, 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(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetObjCClassSymbol(), and lldb_private::DynamicLoaderWindowsDYLD::GetTlsIndexAddressForModule().
| void Symtab::FindFunctionSymbols | ( | ConstString | name, |
| uint32_t | name_type_mask, | ||
| SymbolContextList & | sc_list ) |
Definition at line 1079 of file Symtab.cpp.
References lldb::eSymbolTypeAbsolute, lldb::eSymbolTypeAny, lldb::eSymbolTypeCode, lldb::eSymbolTypeReExported, lldb::eSymbolTypeResolver, FindAllSymbolsWithNameAndType(), GetNameToSymbolIndexMap(), lldb_private::Symbol::GetType(), InitNameIndexes(), m_mutex, 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 1007 of file Symtab.cpp.
References lldb_private::RangeData< B, S, T >::data, lldb_private::Symbol::GetFileAddress(), InitAddressIndexes(), m_file_addr_to_index, m_file_addr_to_index_computed, m_mutex, and SymbolAtIndex().
Referenced by lldb_private::plugin::dwarf::SymbolFileWasm::AddOrModifySymbols(), GetNameIndexes(), ObjectFileELF::ParseUnwindSymbols(), and lldb_private::Module::ResolveSymbolContextForAddress().
| Symbol * Symtab::FindSymbolByID | ( | lldb::user_id_t | uid | ) | const |
Definition at line 253 of file Symtab.cpp.
References CompareSymbolID(), m_mutex, and m_symbols.
Referenced by ApplyELF32ABS32RelRelocation(), ApplyELF64ABS32Relocation(), ApplyELF64ABS64Relocation(), ObjectFileELF::ApplyRelocations(), and ObjectFileMachO::ParseSymtab().
| Symbol * Symtab::FindSymbolContainingFileAddress | ( | lldb::addr_t | file_addr | ) |
Definition at line 1022 of file Symtab.cpp.
References lldb_private::Symbol::ContainsFileAddress(), lldb_private::RangeData< B, S, T >::data, 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 784 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 1038 of file Symtab.cpp.
References lldb_private::Symbol::ContainsFileAddress(), 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 1150 of file Symtab.cpp.
References m_objfile.
Referenced by LoadFromCache(), and SaveToCache().
| uint32_t Symtab::GetIndexForSymbol | ( | const Symbol * | symbol | ) | const |
Definition at line 547 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 95 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 637 of file Symtab.cpp.
References FindSymbolAtFileAddress(), GetIndexForSymbol(), GetNameToSymbolIndexMap(), lldb_private::ConstString::GetStringRef(), lldb_private::Symbol::GetSyntheticSymbolPrefix(), and UINT32_MAX.
Referenced by AppendSymbolIndexesWithName(), and AppendSymbolIndexesWithName().
|
inlineprivate |
Definition at line 340 of file Symtab.h.
References m_name_to_symbol_indices.
Referenced by AddSymbol(), FindFunctionSymbols(), GetNameIndexes(), InitNameIndexes(), RegisterBacklogEntry(), and RegisterMangledNameEntry().
| size_t Symtab::GetNumSymbols | ( | ) | const |
Definition at line 83 of file Symtab.cpp.
References m_mutex, and m_symbols.
Referenced by lldb_private::npdb::SymbolFileNativePDB::AddOrModifySymbols(), lldb_private::plugin::dwarf::SymbolFileWasm::AddOrModifySymbols(), lldb_private::SymbolFileJSON::AddOrModifySymbols(), SymbolFilePDB::AddOrModifySymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), ObjectFilePECOFF::AppendFromExportTable(), BuildDemangledCodeSymbolIndex(), SymbolFileSymtab::CalculateAbilities(), Dump(), findSymbolAddress(), ObjectFileCOFF::ParseSymtab(), ObjectFileELF::ParseSymtab(), ObjectFileMachO::ParseSymtab(), ObjectFileELF::ParseUnwindSymbols(), and lldb_private::DebuggerStats::ReportStatistics().
|
inline |
Definition at line 177 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 1137 of file Symtab.cpp.
References GetIndexForSymbol(), lldb_private::Symbol::GetSiblingIndex(), SymbolAtIndex(), and UINT32_MAX.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE().
|
inline |
Returns a bitmask of lldb::SymtabState flags describing the state of this symbol table.
This doesn't take the symbol table's mutex, so it doesn't wait for a parse on another thread to finish.
Definition at line 274 of file Symtab.h.
References m_state.
Referenced by lldb_private::DebuggerStats::ReportStatistics().
| bool Symtab::HasDebugMap | ( | ) | const |
Check if this symbol table has a debug map, see SetHasDebugMap().
Definition at line 99 of file Symtab.cpp.
References m_has_debug_map, and m_mutex.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
| bool Symtab::HasSourceFiles | ( | ) | const |
Check if this symbol table contains any source file symbols.
If the object file plug-in didn't set this value with SetHasSourceFiles(), it is calculated the first time it is requested and then cached. AddSymbol() updates the value, and Resize() clears it so it is calculated again. Modifying symbols directly, through the pointer returned by Resize() or SymbolAtIndex(), does not update the value.
Definition at line 109 of file Symtab.cpp.
References CalculateHasSourceFiles(), m_has_source_files, and m_mutex.
Referenced by SymbolFileSymtab::CalculateAbilities(), SymbolFileSymtab::CalculateNumCompileUnits(), and Encode().
|
protected |
Definition at line 915 of file Symtab.cpp.
References AddSectionsToRangeMap(), lldb_private::RangeData< B, S, T >::data, lldb_private::RangeVector< B, S, N >::FindEntryThatContains(), lldb_private::Range< B, S >::GetByteSize(), lldb_private::Range< B, S >::GetRangeBase(), m_file_addr_to_index, m_file_addr_to_index_computed, m_objfile, m_symbols, lldb_private::Range< B, S >::SetByteSize(), lldb_private::Symbol::SetByteSize(), lldb_private::Range< B, S >::SetRangeBase(), lldb_private::Symbol::SetSizeIsSynthesized(), and lldb_private::RangeVector< B, S, N >::Sort().
Referenced by Dump(), Finalize(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), and ForEachSymbolContainingFileAddress().
|
protected |
Definition at line 278 of file Symtab.cpp.
References lldb_private::Symbol::ContainsLinkerAnnotations(), lldb_private::Continue, elapsed(), lldb::eSymbolTypeCode, lldb::eSymbolTypeResolver, lldb_private::Language::FindPluginForManglingScheme(), lldb_private::Language::ForEach(), lldb_private::Mangled::g_num_mangling_schemes, lldb_private::Mangled::GetDemangledName(), lldb_private::Symbol::GetMangled(), lldb_private::Mangled::GetMangledName(), lldb_private::Mangled::GetManglingScheme(), GetNameToSymbolIndexMap(), lldb_private::Symbol::GetType(), lldb_private::Symbol::IsSyntheticWithAutoGeneratedName(), lldb_private::Symbol::IsTrampoline(), l, LLDB_SCOPED_TIMER, m_name_indexes_computed, m_objfile, m_symbols, RegisterBacklogEntry(), and RegisterMangledNameEntry().
Referenced by AppendSymbolIndexesWithName(), AppendSymbolIndexesWithName(), FindAllSymbolsWithNameAndType(), 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 serialized cache file.
Definition at line 1379 of file Symtab.cpp.
References Decode(), lldb_private::Module::eLLDBIndexTypeMemoryModuleSymtab, lldb_private::Module::eLLDBIndexTypeSymtab, lldb_private::DataFileCache::GetCachedData(), GetCacheKey(), lldb_private::Module::GetIndexCache(), m_objfile, lldb_private::DataFileCache::RemoveCacheFile(), and SetWasLoadedFromCache().
Referenced by lldb_private::ObjectFile::GetSymtab().
References Symtab().
| void Symtab::PreloadSymbols | ( | ) |
Definition at line 481 of file Symtab.cpp.
References InitNameIndexes(), and m_mutex.
|
private |
Definition at line 463 of file Symtab.cpp.
References GetNameToSymbolIndexMap().
Referenced by InitNameIndexes().
|
private |
Definition at line 410 of file Symtab.cpp.
References lldb_private::UniqueCStringMap< T >::Append(), lldb_private::Mangled::FunctionNameParts::basename, lldb_private::Mangled::ConstructorOrDestructor, lldb_private::Mangled::FunctionNameParts::decl_context, lldb_private::ConstString::GetCString(), GetNameToSymbolIndexMap(), lldb_private::Mangled::InNamespace, lldb_private::Mangled::FunctionNameParts::kind, lldb_private::Mangled::Method, lldb_private::Mangled::TopLevel, and lldb_private::Mangled::Unknown.
Referenced by InitNameIndexes().
| void Symtab::Reserve | ( | size_t | count | ) |
Definition at line 49 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 55 of file Symtab.cpp.
References m_has_source_files, and 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 1161 of file Symtab.cpp.
References lldb_private::Module::eLLDBIndexTypeMemoryModuleSymtab, lldb_private::Module::eLLDBIndexTypeSymtab, Encode(), GetCacheKey(), lldb_private::DataEncoder::GetData(), lldb_private::Module::GetIndexCache(), InitNameIndexes(), lldb_private::endian::InlHostByteOrder(), m_objfile, lldb_private::DataFileCache::SetCachedData(), and SetWasSavedToCache().
Referenced by Finalize().
| void Symtab::SectionFileAddressesChanged | ( | ) |
Definition at line 116 of file Symtab.cpp.
References m_file_addr_to_index, and m_file_addr_to_index_computed.
| void Symtab::SetHasDebugMap | ( | bool | has_debug_map | ) |
Set whether this symbol table has a debug map.
A debug map is a set of symbols that refer to object files containing the debug information, such as the N_OSO entries in a Mach-O symbol table. Object file plug-ins whose formats have debug maps set this when they parse the symbol table, so clients can find out if it is worth searching the symbol table for those symbols without needing to iterate over all of the symbols themselves. This value is saved in the symbol table cache.
AddSymbol() doesn't change this value, so code that adds debug map symbols after the symbol table is parsed, such as a SymbolFile's AddOrModifySymbols(), must call this as well.
Definition at line 94 of file Symtab.cpp.
References m_has_debug_map, and m_mutex.
Referenced by ObjectFileMachO::ParseSymtab().
| void Symtab::SetHasSourceFiles | ( | bool | has_source_files | ) |
Set whether this symbol table contains any source file symbols.
Object file plug-ins that know this when they parse the symbol table can set it, so HasSourceFiles() doesn't need to iterate over all of the symbols. This value is saved in the symbol table cache.
Definition at line 104 of file Symtab.cpp.
References m_has_source_files, and m_mutex.
Referenced by ObjectFileMachO::ParseSymtab().
|
inlineprivate |
Definition at line 338 of file Symtab.h.
References m_state.
Referenced by SetSymbolFileAddedSymbols(), SetWasLoadedFromCache(), SetWasParsedFromObjectFile(), and SetWasSavedToCache().
|
inline |
Definition at line 278 of file Symtab.h.
References SetStateFlags().
|
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 263 of file Symtab.h.
References SetStateFlags().
Referenced by LoadFromCache().
|
inline |
Definition at line 275 of file Symtab.h.
References SetStateFlags().
Referenced by lldb_private::ObjectFile::GetSymtab().
|
inline |
| void Symtab::SortSymbolIndexesByValue | ( | std::vector< uint32_t > & | indexes, |
| bool | remove_duplicates ) const |
Definition at line 612 of file Symtab.cpp.
References LLDB_INVALID_ADDRESS, LLDB_SCOPED_TIMER, m_mutex, and m_symbols.
Referenced by SymbolFileSymtab::InitializeSymbolIndexes(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().
| Symbol * Symtab::SymbolAtIndex | ( | size_t | idx | ) |
Definition at line 262 of file Symtab.cpp.
References m_symbols.
Referenced by lldb_private::npdb::SymbolFileNativePDB::AddOrModifySymbols(), lldb_private::plugin::dwarf::SymbolFileWasm::AddOrModifySymbols(), lldb_private::SymbolFileJSON::AddOrModifySymbols(), SymbolFilePDB::AddOrModifySymbols(), ObjectFilePECOFF::AppendFromCOFFSymbolTable(), BuildDemangledCodeSymbolIndex(), 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::Module::SymbolIndicesToSymbolContextList(), and SymbolIndicesToSymbolContextList().
| const Symbol * Symtab::SymbolAtIndex | ( | size_t | idx | ) | const |
Definition at line 270 of file Symtab.cpp.
References m_symbols.
|
private |
Definition at line 1061 of file Symtab.cpp.
References lldb_private::SymbolContextList::AppendIfUnique(), m_objfile, lldb_private::SymbolContext::module_sp, lldb_private::SymbolContext::symbol, and SymbolAtIndex().
Referenced by FindFunctionSymbols().
|
protected |
Definition at line 319 of file Symtab.h.
Referenced by AddSymbol(), Dump(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), ForEachSymbolContainingFileAddress(), InitAddressIndexes(), SectionFileAddressesChanged(), and Symtab().
|
protected |
Definition at line 324 of file Symtab.h.
Referenced by AddSymbol(), Dump(), FindSymbolAtFileAddress(), FindSymbolContainingFileAddress(), ForEachSymbolContainingFileAddress(), InitAddressIndexes(), and SectionFileAddressesChanged().
|
protected |
Set by the object file plug-in, see SetHasDebugMap().
Definition at line 328 of file Symtab.h.
Referenced by Decode(), Encode(), HasDebugMap(), and SetHasDebugMap().
|
mutableprotected |
Set by the object file plug-in, or calculated and cached by HasSourceFiles().
Unset when neither has happened yet.
Definition at line 332 of file Symtab.h.
Referenced by AddSymbol(), CalculateHasSourceFiles(), Decode(), HasSourceFiles(), Resize(), and SetHasSourceFiles().
|
mutableprotected |
Provide thread safety for this symbol table.
Definition at line 315 of file Symtab.h.
Referenced by AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesWithName(), AppendSymbolIndexesWithName(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithTypeAndFlagsValue(), Dump(), Dump(), Finalize(), FindAllSymbolsMatchingRexExAndType(), FindAllSymbolsWithNameAndType(), FindAllSymbolsWithNameAndType(), FindFirstSymbolWithNameAndType(), FindFunctionSymbols(), FindSymbolAtFileAddress(), FindSymbolByID(), FindSymbolContainingFileAddress(), FindSymbolWithType(), ForEachSymbolContainingFileAddress(), GetMutex(), GetNumSymbols(), HasDebugMap(), HasSourceFiles(), PreloadSymbols(), SetHasDebugMap(), SetHasSourceFiles(), and SortSymbolIndexesByValue().
|
protected |
Definition at line 325 of file Symtab.h.
Referenced by AddSymbol(), Decode(), Encode(), and InitNameIndexes().
|
protected |
|
protected |
Definition at line 317 of file Symtab.h.
Referenced by Decode(), Dump(), Encode(), GetCacheKey(), GetObjectFile(), InitAddressIndexes(), InitNameIndexes(), LoadFromCache(), SaveToCache(), SymbolIndicesToSymbolContextList(), and Symtab().
|
protected |
A bitmask of lldb::SymtabState flags.
Definition at line 335 of file Symtab.h.
Referenced by GetState(), and SetStateFlags().
|
protected |
Definition at line 318 of file Symtab.h.
Referenced by AddSymbol(), AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesMatchingRegExAndType(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithNameAndType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithType(), AppendSymbolIndexesWithTypeAndFlagsValue(), CalculateHasSourceFiles(), CheckSymbolAtIndex(), Decode(), Dump(), Dump(), Encode(), Finalize(), FindSymbolByID(), FindSymbolWithType(), GetIndexForSymbol(), GetNumSymbols(), InitAddressIndexes(), InitNameIndexes(), Reserve(), Resize(), SortSymbolIndexesByValue(), SymbolAtIndex(), and SymbolAtIndex().