LLDB  mainline
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lldb_private::Symtab Class Reference

#include <Symtab.h>

Collaboration diagram for lldb_private::Symtab:
Collaboration graph
[legend]

Public Types

enum  Debug { eDebugNo, eDebugYes, eDebugAny }
 
enum  Visibility { eVisibilityAny, eVisibilityExtern, eVisibilityPrivate }
 
typedef std::vector< uint32_tIndexCollection
 
typedef UniqueCStringMap< uint32_tNameToIndexMap
 
typedef enum lldb_private::Symtab::Debug Debug
 
typedef enum lldb_private::Symtab::Visibility Visibility
 

Public Member Functions

 Symtab (ObjectFile *objfile)
 
 ~Symtab ()
 
void PreloadSymbols ()
 
void Reserve (size_t count)
 
SymbolResize (size_t count)
 
uint32_t AddSymbol (const Symbol &symbol)
 
size_t GetNumSymbols () const
 
void SectionFileAddressesChanged ()
 
void Dump (Stream *s, Target *target, SortOrder sort_type)
 
void Dump (Stream *s, Target *target, std::vector< uint32_t > &indexes) const
 
uint32_t GetIndexForSymbol (const Symbol *symbol) const
 
std::recursive_mutex & GetMutex ()
 
SymbolFindSymbolByID (lldb::user_id_t uid) const
 
SymbolSymbolAtIndex (size_t idx)
 
const SymbolSymbolAtIndex (size_t idx) const
 
SymbolFindSymbolWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx)
 
const SymbolGetParent (Symbol *symbol) const
 Get the parent symbol for the given symbol. More...
 
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)
 
uint32_t AppendSymbolIndexesMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &indexes)
 
size_t FindAllSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
 
size_t FindAllSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &symbol_indexes)
 
size_t FindAllSymbolsMatchingRexExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector< uint32_t > &symbol_indexes)
 
SymbolFindFirstSymbolWithNameAndType (ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
 
SymbolFindSymbolAtFileAddress (lldb::addr_t file_addr)
 
SymbolFindSymbolContainingFileAddress (lldb::addr_t file_addr)
 
void ForEachSymbolContainingFileAddress (lldb::addr_t file_addr, std::function< bool(Symbol *)> const &callback)
 
size_t FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
 
void CalculateSymbolSizes ()
 
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
 
ObjectFileGetObjectFile ()
 

Static Public Member Functions

static void DumpSymbolHeader (Stream *s)
 

Protected Types

typedef std::vector< Symbolcollection
 
typedef collection::iterator iterator
 
typedef collection::const_iterator const_iterator
 
typedef RangeDataVector< lldb::addr_t, lldb::addr_t, uint32_tFileRangeToIndexMap
 

Protected Member Functions

void InitNameIndexes ()
 
void InitAddressIndexes ()
 

Protected Attributes

ObjectFilem_objfile
 
collection m_symbols
 
FileRangeToIndexMap m_file_addr_to_index
 
UniqueCStringMap< uint32_tm_name_to_index
 
UniqueCStringMap< uint32_tm_basename_to_index
 
UniqueCStringMap< uint32_tm_method_to_index
 
UniqueCStringMap< uint32_tm_selector_to_index
 
std::recursive_mutex m_mutex
 
bool m_file_addr_to_index_computed: 1
 
bool m_name_indexes_computed: 1
 

Detailed Description

Definition at line 21 of file Symtab.h.

Member Typedef Documentation

◆ collection

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

Definition at line 143 of file Symtab.h.

◆ const_iterator

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

Definition at line 145 of file Symtab.h.

◆ Debug

◆ FileRangeToIndexMap

Definition at line 147 of file Symtab.h.

◆ IndexCollection

Definition at line 23 of file Symtab.h.

◆ iterator

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

Definition at line 144 of file Symtab.h.

◆ NameToIndexMap

Definition at line 24 of file Symtab.h.

◆ Visibility

Member Enumeration Documentation

◆ Debug

Enumerator
eDebugNo 
eDebugYes 
eDebugAny 

Definition at line 26 of file Symtab.h.

◆ Visibility

Enumerator
eVisibilityAny 
eVisibilityExtern 
eVisibilityPrivate 

Definition at line 32 of file Symtab.h.

Constructor & Destructor Documentation

◆ Symtab()

Symtab::Symtab ( ObjectFile objfile)

Definition at line 31 of file Symtab.cpp.

◆ ~Symtab()

Symtab::~Symtab ( )

Definition at line 36 of file Symtab.cpp.

Member Function Documentation

◆ AddSymbol()

uint32_t Symtab::AddSymbol ( const Symbol symbol)

◆ AppendSymbolIndexesMatchingRegExAndType() [1/2]

uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
std::vector< uint32_t > &  indexes 
)

◆ AppendSymbolIndexesMatchingRegExAndType() [2/2]

uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
Debug  symbol_debug_type,
Visibility  symbol_visibility,
std::vector< uint32_t > &  indexes 
)

◆ AppendSymbolIndexesWithName() [1/2]

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

◆ AppendSymbolIndexesWithName() [2/2]

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

◆ AppendSymbolIndexesWithNameAndType() [1/2]

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

◆ AppendSymbolIndexesWithNameAndType() [2/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 686 of file Symtab.cpp.

References AppendSymbolIndexesWithName(), lldb::eSymbolTypeAny, m_mutex, and m_symbols.

◆ AppendSymbolIndexesWithType() [1/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

◆ AppendSymbolIndexesWithType() [2/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 511 of file Symtab.cpp.

References lldb::eSymbolTypeAny, m_mutex, and m_symbols.

◆ 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

Definition at line 491 of file Symtab.cpp.

References lldb::eSymbolTypeAny, m_mutex, and m_symbols.

Referenced by GetMutex(), and SymbolFileDWARFDebugMap::InitOSO().

◆ AppendSymbolNamesToMap()

void Symtab::AppendSymbolNamesToMap ( const IndexCollection indexes,
bool  add_demangled,
bool  add_mangled,
NameToIndexMap name_to_index_map 
) const

◆ CalculateSymbolSizes()

void Symtab::CalculateSymbolSizes ( )

◆ Dump() [1/2]

void Symtab::Dump ( Stream s,
Target target,
SortOrder  sort_type 
)

◆ Dump() [2/2]

void Symtab::Dump ( Stream s,
Target target,
std::vector< uint32_t > &  indexes 
) const

◆ DumpSymbolHeader()

void Symtab::DumpSymbolHeader ( Stream s)
static

Definition at line 172 of file Symtab.cpp.

References lldb_private::Stream::Indent().

Referenced by Dump(), and GetMutex().

◆ Finalize()

void lldb_private::Symtab::Finalize ( )
inline

Definition at line 128 of file Symtab.h.

References AppendSymbolNamesToMap(), and m_symbols.

Referenced by SymbolFilePDB::AddSymbols().

◆ FindAllSymbolsMatchingRexExAndType()

size_t Symtab::FindAllSymbolsMatchingRexExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
Debug  symbol_debug_type,
Visibility  symbol_visibility,
std::vector< uint32_t > &  symbol_indexes 
)

◆ FindAllSymbolsWithNameAndType() [1/2]

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

◆ FindAllSymbolsWithNameAndType() [2/2]

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

◆ FindFirstSymbolWithNameAndType()

Symbol * Symtab::FindFirstSymbolWithNameAndType ( ConstString  name,
lldb::SymbolType  symbol_type,
Debug  symbol_debug_type,
Visibility  symbol_visibility 
)

◆ FindFunctionSymbols()

size_t Symtab::FindFunctionSymbols ( ConstString  name,
uint32_t  name_type_mask,
SymbolContextList sc_list 
)

◆ FindSymbolAtFileAddress()

Symbol * Symtab::FindSymbolAtFileAddress ( lldb::addr_t  file_addr)

◆ FindSymbolByID()

Symbol * Symtab::FindSymbolByID ( lldb::user_id_t  uid) const

Definition at line 194 of file Symtab.cpp.

References CompareSymbolID(), m_mutex, and m_symbols.

Referenced by GetMutex(), ParsePLTRelocations(), and ObjectFileMachO::ParseSymtab().

◆ FindSymbolContainingFileAddress()

Symbol * Symtab::FindSymbolContainingFileAddress ( lldb::addr_t  file_addr)

◆ FindSymbolWithType()

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

Definition at line 752 of file Symtab.cpp.

References lldb::eSymbolTypeAny, m_mutex, and m_symbols.

Referenced by GetMutex().

◆ ForEachSymbolContainingFileAddress()

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

◆ GetIndexForSymbol()

uint32_t Symtab::GetIndexForSymbol ( const Symbol symbol) const

Definition at line 534 of file Symtab.cpp.

References m_symbols, and UINT32_MAX.

Referenced by SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(), and GetParent().

◆ GetMutex()

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

◆ GetNumSymbols()

size_t Symtab::GetNumSymbols ( ) const

◆ GetObjectFile()

ObjectFile* lldb_private::Symtab::GetObjectFile ( )
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 1142 of file Symtab.cpp.

References GetIndexForSymbol(), lldb_private::Symbol::GetSiblingIndex(), SymbolAtIndex(), and UINT32_MAX.

Referenced by SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE(), and GetMutex().

◆ InitAddressIndexes()

void Symtab::InitAddressIndexes ( )
protected

◆ InitNameIndexes()

void Symtab::InitNameIndexes ( )
protected

◆ PreloadSymbols()

void Symtab::PreloadSymbols ( )

Definition at line 436 of file Symtab.cpp.

References InitNameIndexes(), and m_mutex.

◆ Reserve()

void Symtab::Reserve ( size_t  count)

Definition at line 38 of file Symtab.cpp.

References m_symbols.

◆ Resize()

Symbol * Symtab::Resize ( size_t  count)

Definition at line 44 of file Symtab.cpp.

References m_symbols.

Referenced by ObjectFileMachO::ParseSymtab().

◆ SectionFileAddressesChanged()

void Symtab::SectionFileAddressesChanged ( )

◆ SortSymbolIndexesByValue()

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

◆ SymbolAtIndex() [1/2]

Symbol * Symtab::SymbolAtIndex ( size_t  idx)

◆ SymbolAtIndex() [2/2]

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

Definition at line 211 of file Symtab.cpp.

References m_symbols.

Member Data Documentation

◆ m_basename_to_index

UniqueCStringMap<uint32_t> lldb_private::Symtab::m_basename_to_index
protected

Definition at line 155 of file Symtab.h.

Referenced by FindFunctionSymbols(), and InitNameIndexes().

◆ m_file_addr_to_index

FileRangeToIndexMap lldb_private::Symtab::m_file_addr_to_index
protected

◆ m_file_addr_to_index_computed

bool lldb_private::Symtab::m_file_addr_to_index_computed
protected

◆ m_method_to_index

UniqueCStringMap<uint32_t> lldb_private::Symtab::m_method_to_index
protected

Definition at line 156 of file Symtab.h.

Referenced by FindFunctionSymbols(), and InitNameIndexes().

◆ m_mutex

std::recursive_mutex lldb_private::Symtab::m_mutex
mutableprotected

◆ m_name_indexes_computed

bool lldb_private::Symtab::m_name_indexes_computed
protected

◆ m_name_to_index

UniqueCStringMap<uint32_t> lldb_private::Symtab::m_name_to_index
protected

◆ m_objfile

ObjectFile* lldb_private::Symtab::m_objfile
protected

◆ m_selector_to_index

UniqueCStringMap<uint32_t> lldb_private::Symtab::m_selector_to_index
protected

Definition at line 157 of file Symtab.h.

Referenced by FindFunctionSymbols(), and InitNameIndexes().

◆ m_symbols

collection lldb_private::Symtab::m_symbols
protected

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