LLDB mainline
lldb_private::ExternalSymbolResolver Class Reference

"lldb/Expression/ExternalSymbolResolver.h" Finds the load addresses of symbols that an expression refers to but does not define. More...

#include <ExternalSymbolResolver.h>

Public Member Functions

 ExternalSymbolResolver (const SymbolContext &sym_ctx, bool strip_underscore)
 Constructor.
void AppendPreferredSymbolContexts (SymbolContextList const &contexts)
 Search the modules of contexts before any others, except for the module of the symbol context this resolver was constructed with.
lldb::addr_t FindSymbol (ConstString name, bool &missing_weak)
 Find the load address of name.

Private Member Functions

void CollectCandidateCNames (std::vector< ConstString > &C_names, ConstString name)
void CollectCandidateCPlusPlusNames (std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
lldb::addr_t FindInSymbols (const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
lldb::addr_t FindInRuntimes (const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
lldb::addr_t FindInUserDefinedSymbols (const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)

Private Attributes

SymbolContext m_sym_ctx
 Used for symbol lookups.
bool m_strip_underscore
 True for platforms where global symbols have a _ prefix.
ModuleList m_preferred_modules
 Any Module in this list will be used for symbol/function lookup before any other module (except for the module corresponding to the current frame).

Detailed Description

"lldb/Expression/ExternalSymbolResolver.h" Finds the load addresses of symbols that an expression refers to but does not define.

An expression's IR refers by name to functions and variables that live outside the expression's own module. Finding the address for such a name is not a simple lookup: the name may be an LLDB function call label, it may need alternate manglings tried, and it may be satisfied by the target's images, by a language runtime, or by a symbol that a previous expression defined (see Target::GetPersistentSymbol).

Definition at line 31 of file ExternalSymbolResolver.h.

Constructor & Destructor Documentation

◆ ExternalSymbolResolver()

ExternalSymbolResolver::ExternalSymbolResolver ( const SymbolContext & sym_ctx,
bool strip_underscore )

Constructor.

Parameters
[in]sym_ctxThe symbol context to search from. Its module, if any, is searched before all others.
[in]strip_underscoreTrue for platforms where global symbols have a _ prefix, in which case the name with that prefix removed is also tried.

Definition at line 28 of file ExternalSymbolResolver.cpp.

References m_preferred_modules, m_strip_underscore, and m_sym_ctx.

Member Function Documentation

◆ AppendPreferredSymbolContexts()

void lldb_private::ExternalSymbolResolver::AppendPreferredSymbolContexts ( SymbolContextList const & contexts)
inline

Search the modules of contexts before any others, except for the module of the symbol context this resolver was constructed with.

Definition at line 46 of file ExternalSymbolResolver.h.

References m_preferred_modules.

◆ CollectCandidateCNames()

void ExternalSymbolResolver::CollectCandidateCNames ( std::vector< ConstString > & C_names,
ConstString name )
private

◆ CollectCandidateCPlusPlusNames()

void ExternalSymbolResolver::CollectCandidateCPlusPlusNames ( std::vector< ConstString > & CPP_names,
const std::vector< ConstString > & C_names,
const SymbolContext & sc )
private

◆ FindInRuntimes()

lldb::addr_t ExternalSymbolResolver::FindInRuntimes ( const std::vector< ConstString > & names,
const lldb_private::SymbolContext & sc )
private

Definition at line 280 of file ExternalSymbolResolver.cpp.

References LLDB_INVALID_ADDRESS, and lldb_private::SymbolContext::target_sp.

Referenced by FindSymbol().

◆ FindInSymbols()

◆ FindInUserDefinedSymbols()

lldb::addr_t ExternalSymbolResolver::FindInUserDefinedSymbols ( const std::vector< ConstString > & names,
const lldb_private::SymbolContext & sc )
private

Definition at line 306 of file ExternalSymbolResolver.cpp.

References LLDB_INVALID_ADDRESS, and lldb_private::SymbolContext::target_sp.

Referenced by FindSymbol().

◆ FindSymbol()

lldb::addr_t ExternalSymbolResolver::FindSymbol ( lldb_private::ConstString name,
bool & missing_weak )

Find the load address of name.

Parameters
[out]missing_weakSet to true if name was only found as a weak undefined symbol, in which case the returned address is 0.
Returns
The load address, or LLDB_INVALID_ADDRESS if name was not found.

Definition at line 321 of file ExternalSymbolResolver.cpp.

References CollectCandidateCNames(), CollectCandidateCPlusPlusNames(), lldb_private::Expressions, FindInRuntimes(), FindInSymbols(), FindInUserDefinedSymbols(), lldb_private::FunctionCallLabel::fromString(), lldb_private::FunctionCallLabelPrefix, lldb_private::GetLog(), lldb_private::ConstString::GetStringRef(), LLDB_INVALID_ADDRESS, LLDB_LOG_ERROR, m_sym_ctx, ResolveFunctionCallLabel(), and lldb_private::ConstString::SetString().

Member Data Documentation

◆ m_preferred_modules

ModuleList lldb_private::ExternalSymbolResolver::m_preferred_modules
private

Any Module in this list will be used for symbol/function lookup before any other module (except for the module corresponding to the current frame).

Definition at line 88 of file ExternalSymbolResolver.h.

Referenced by AppendPreferredSymbolContexts(), ExternalSymbolResolver(), and FindInSymbols().

◆ m_strip_underscore

bool lldb_private::ExternalSymbolResolver::m_strip_underscore
private

True for platforms where global symbols have a _ prefix.

Definition at line 82 of file ExternalSymbolResolver.h.

Referenced by CollectCandidateCNames(), and ExternalSymbolResolver().

◆ m_sym_ctx

SymbolContext lldb_private::ExternalSymbolResolver::m_sym_ctx
private

Used for symbol lookups.

Definition at line 80 of file ExternalSymbolResolver.h.

Referenced by ExternalSymbolResolver(), and FindSymbol().


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