LLDB mainline
lldb_private::Symtab Class Reference

#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 &regex, lldb::SymbolType symbol_type, std::vector< uint32_t > &indexes, Mangled::NamePreference name_preference=Mangled::ePreferDemangled)
uint32_t 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)
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 &regex, 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

Detailed Description

Definition at line 24 of file Symtab.h.

Member Typedef Documentation

◆ collection

typedef std::vector<Symbol> lldb_private::Symtab::collection
protected

Definition at line 283 of file Symtab.h.

◆ const_iterator

typedef collection::const_iterator lldb_private::Symtab::const_iterator
protected

Definition at line 285 of file Symtab.h.

◆ FileRangeToIndexMap

◆ IndexCollection

typedef std::vector<uint32_t> lldb_private::Symtab::IndexCollection

Definition at line 26 of file Symtab.h.

◆ iterator

typedef collection::iterator lldb_private::Symtab::iterator
protected

Definition at line 284 of file Symtab.h.

◆ NameToIndexMap

Definition at line 27 of file Symtab.h.

Member Enumeration Documentation

◆ Debug

Enumerator
eDebugNo 
eDebugYes 
eDebugAny 

Definition at line 29 of file Symtab.h.

◆ Visibility

Enumerator
eVisibilityAny 
eVisibilityExtern 
eVisibilityPrivate 

Definition at line 35 of file Symtab.h.

Constructor & Destructor Documentation

◆ Symtab() [1/2]

◆ ~Symtab()

Symtab::~Symtab ( )
default

◆ Symtab() [2/2]

lldb_private::Symtab::Symtab ( const Symtab & )
privatedelete

References Symtab().

Member Function Documentation

◆ AddSymbol()

◆ AppendSymbolIndexesMatchingRegExAndType() [1/2]

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 )

◆ AppendSymbolIndexesMatchingRegExAndType() [2/2]

uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType ( const RegularExpression & regex,
lldb::SymbolType symbol_type,
std::vector< uint32_t > & indexes,
Mangled::NamePreference name_preference = Mangled::ePreferDemangled )

◆ AppendSymbolIndexesWithName() [1/2]

uint32_t Symtab::AppendSymbolIndexesWithName ( ConstString symbol_name,
Debug symbol_debug_type,
Visibility symbol_visibility,
std::vector< uint32_t > & matches )

◆ AppendSymbolIndexesWithName() [2/2]

uint32_t Symtab::AppendSymbolIndexesWithName ( ConstString symbol_name,
std::vector< uint32_t > & matches )

◆ AppendSymbolIndexesWithNameAndType() [1/2]

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.

◆ AppendSymbolIndexesWithNameAndType() [2/2]

uint32_t Symtab::AppendSymbolIndexesWithNameAndType ( ConstString symbol_name,
lldb::SymbolType symbol_type,
std::vector< uint32_t > & matches )

◆ AppendSymbolIndexesWithType() [1/2]

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.

◆ AppendSymbolIndexesWithType() [2/2]

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

◆ AppendSymbolIndexesWithTypeAndFlagsValue()

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

◆ CalculateHasSourceFiles()

void Symtab::CalculateHasSourceFiles ( ) const
protected

◆ CheckSymbolAtIndex()

bool lldb_private::Symtab::CheckSymbolAtIndex ( size_t idx,
Debug symbol_debug_type,
Visibility symbol_visibility ) const
inlineprivate

◆ Decode()

bool Symtab::Decode ( const DataExtractor & data,
lldb::offset_t * offset_ptr )

Decode a serialized version of this object from data.

Parameters
dataThe decoder object that references the serialized data.
offset_ptrA pointer that contains the offset from which the data will be decoded from that gets updated as data gets decoded.
Returns
True if the symbol table is successfully decoded and can be used, false otherwise.

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().

◆ Dump() [1/2]

◆ Dump() [2/2]

◆ DumpSymbolHeader()

void Symtab::DumpSymbolHeader ( Stream * s)
static

Definition at line 231 of file Symtab.cpp.

References lldb_private::Stream::Indent().

Referenced by Dump(), and Dump().

◆ Encode()

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.

Parameters
encoderA data encoder object that serialized bytes will be encoded into.
Returns
True if the symbol table's object file can generate a valid signature and all data for the symbol table was encoded, false otherwise.

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().

◆ Finalize()

◆ FindAllSymbolsMatchingRexExAndType()

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.

◆ FindAllSymbolsWithNameAndType() [1/2]

void Symtab::FindAllSymbolsWithNameAndType ( ConstString name,
lldb::SymbolType symbol_type,
Debug symbol_debug_type,
Visibility symbol_visibility,
std::vector< uint32_t > & symbol_indexes )

◆ FindAllSymbolsWithNameAndType() [2/2]

void Symtab::FindAllSymbolsWithNameAndType ( ConstString name,
lldb::SymbolType symbol_type,
std::vector< uint32_t > & symbol_indexes )

◆ FindFirstSymbolWithNameAndType()

◆ FindFunctionSymbols()

◆ FindSymbolAtFileAddress()

◆ FindSymbolByID()

◆ FindSymbolContainingFileAddress()

◆ FindSymbolWithType()

Symbol * Symtab::FindSymbolWithType ( lldb::SymbolType symbol_type,
Debug symbol_debug_type,
Visibility symbol_visibility,
uint32_t & start_idx )

◆ ForEachSymbolContainingFileAddress()

void Symtab::ForEachSymbolContainingFileAddress ( lldb::addr_t file_addr,
std::function< bool(Symbol *)> const & callback )

◆ GetCacheKey()

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.

Returns
The unique cache key used to save and retrieve data from the index cache.

Definition at line 1150 of file Symtab.cpp.

References m_objfile.

Referenced by LoadFromCache(), and SaveToCache().

◆ GetIndexForSymbol()

uint32_t Symtab::GetIndexForSymbol ( const Symbol * symbol) const

◆ GetMutex()

std::recursive_mutex & lldb_private::Symtab::GetMutex ( )
inline

Definition at line 95 of file Symtab.h.

References m_mutex.

Referenced by lldb_private::ObjectFile::GetSymtab().

◆ GetNameIndexes()

uint32_t Symtab::GetNameIndexes ( ConstString symbol_name,
std::vector< uint32_t > & indexes )
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.

Parameters
[in]symbol_nameThe symbol name to search for.
[out]indexesThe vector if symbol indexes to update with results.
Returns
The number of indexes added to the index vector. Zero if no matches were found.

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().

◆ GetNameToSymbolIndexMap()

UniqueCStringMap< uint32_t > & lldb_private::Symtab::GetNameToSymbolIndexMap ( lldb::FunctionNameType type)
inlineprivate

◆ GetNumSymbols()

◆ GetObjectFile()

ObjectFile * lldb_private::Symtab::GetObjectFile ( ) const
inline

◆ GetParent()

const Symbol * Symtab::GetParent ( Symbol * symbol) const

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().

◆ GetState()

uint32_t lldb_private::Symtab::GetState ( ) const
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().

◆ HasDebugMap()

bool Symtab::HasDebugMap ( ) const

Check if this symbol table has a debug map, see SetHasDebugMap().

Returns
True if the object file plug-in found a debug map when it parsed this symbol table, false otherwise.

Definition at line 99 of file Symtab.cpp.

References m_has_debug_map, and m_mutex.

Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::InitOSO().

◆ HasSourceFiles()

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.

Returns
True if any symbol is an eSymbolTypeSourceFile symbol, false otherwise.

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().

◆ InitAddressIndexes()

◆ InitNameIndexes()

◆ LoadFromCache()

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.

Returns
True if the symbol table was successfully loaded from the index cache, false if the symbol table wasn't cached or was out of date.

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().

◆ operator=()

const Symtab & lldb_private::Symtab::operator= ( const Symtab & )
privatedelete

References Symtab().

◆ PreloadSymbols()

void Symtab::PreloadSymbols ( )

Definition at line 481 of file Symtab.cpp.

References InitNameIndexes(), and m_mutex.

◆ RegisterBacklogEntry()

void Symtab::RegisterBacklogEntry ( const NameToIndexMap::Entry & entry,
const char * decl_context,
const std::set< const char * > & class_contexts )
private

Definition at line 463 of file Symtab.cpp.

References GetNameToSymbolIndexMap().

Referenced by InitNameIndexes().

◆ RegisterMangledNameEntry()

◆ Reserve()

void Symtab::Reserve ( size_t count)

◆ Resize()

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().

◆ SaveToCache()

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:

  • standard symbol table
  • dynamic symbol table (ELF)
  • compressed debug info sections
  • unwind information
  • function pointers found in runtimes for global constructor/destructors
  • other sources. All of the above sources are combined and one symbol table results after all sources have been considered.

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().

◆ SectionFileAddressesChanged()

void Symtab::SectionFileAddressesChanged ( )

Definition at line 116 of file Symtab.cpp.

References m_file_addr_to_index, and m_file_addr_to_index_computed.

◆ SetHasDebugMap()

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().

◆ SetHasSourceFiles()

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().

◆ SetStateFlags()

void lldb_private::Symtab::SetStateFlags ( lldb::SymtabState state)
inlineprivate

◆ SetSymbolFileAddedSymbols()

void lldb_private::Symtab::SetSymbolFileAddedSymbols ( )
inline

Definition at line 278 of file Symtab.h.

References SetStateFlags().

◆ SetWasLoadedFromCache()

void lldb_private::Symtab::SetWasLoadedFromCache ( )
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().

◆ SetWasParsedFromObjectFile()

void lldb_private::Symtab::SetWasParsedFromObjectFile ( )
inline

Definition at line 275 of file Symtab.h.

References SetStateFlags().

Referenced by lldb_private::ObjectFile::GetSymtab().

◆ SetWasSavedToCache()

void lldb_private::Symtab::SetWasSavedToCache ( )
inline

Definition at line 266 of file Symtab.h.

References SetStateFlags().

Referenced by SaveToCache().

◆ SortSymbolIndexesByValue()

void Symtab::SortSymbolIndexesByValue ( std::vector< uint32_t > & indexes,
bool remove_duplicates ) const

◆ SymbolAtIndex() [1/2]

◆ SymbolAtIndex() [2/2]

const Symbol * Symtab::SymbolAtIndex ( size_t idx) const

Definition at line 270 of file Symtab.cpp.

References m_symbols.

◆ SymbolIndicesToSymbolContextList()

void Symtab::SymbolIndicesToSymbolContextList ( std::vector< uint32_t > & symbol_indexes,
SymbolContextList & sc_list )
private

Member Data Documentation

◆ m_file_addr_to_index

◆ m_file_addr_to_index_computed

bool lldb_private::Symtab::m_file_addr_to_index_computed = false
protected

◆ m_has_debug_map

bool lldb_private::Symtab::m_has_debug_map = false
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().

◆ m_has_source_files

std::optional<bool> lldb_private::Symtab::m_has_source_files
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().

◆ m_mutex

◆ m_name_indexes_computed

bool lldb_private::Symtab::m_name_indexes_computed = false
protected

Definition at line 325 of file Symtab.h.

Referenced by AddSymbol(), Decode(), Encode(), and InitNameIndexes().

◆ m_name_to_symbol_indices

std::map<lldb::FunctionNameType, UniqueCStringMap<uint32_t> > lldb_private::Symtab::m_name_to_symbol_indices
protected

Maps function names to symbol indices (grouped by FunctionNameTypes)

Definition at line 323 of file Symtab.h.

Referenced by Decode(), Encode(), GetNameToSymbolIndexMap(), and Symtab().

◆ m_objfile

◆ m_state

std::atomic<uint32_t> lldb_private::Symtab::m_state = lldb::eSymtabStateNone
protected

A bitmask of lldb::SymtabState flags.

Definition at line 335 of file Symtab.h.

Referenced by GetState(), and SetStateFlags().

◆ m_symbols


The documentation for this class was generated from the following files: