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

A collection class for Module objects. More...

#include "lldb/Core/ModuleList.h"

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

Classes

class  Notifier
 

Public Types

typedef LockingAdaptedIterable< collection, lldb::ModuleSP, vector_adapter, std::recursive_mutex > ModuleIterable
 
typedef AdaptedIterable< collection, lldb::ModuleSP, vector_adapterModuleIterableNoLocking
 

Public Member Functions

 ModuleList ()
 Default constructor. More...
 
 ModuleList (const ModuleList &rhs)
 Copy Constructor. More...
 
 ModuleList (ModuleList::Notifier *notifier)
 
 ~ModuleList ()
 Destructor. More...
 
const ModuleListoperator= (const ModuleList &rhs)
 Assignment operator. More...
 
void Append (const lldb::ModuleSP &module_sp, bool notify=true)
 Append a module to the module list. More...
 
void ReplaceEquivalent (const lldb::ModuleSP &module_sp)
 Append a module to the module list and remove any equivalent modules. More...
 
bool AppendIfNeeded (const lldb::ModuleSP &module_sp, bool notify=true)
 Append a module to the module list, if it is not already there. More...
 
void Append (const ModuleList &module_list)
 
bool AppendIfNeeded (const ModuleList &module_list)
 
bool ReplaceModule (const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp)
 
void Clear ()
 Clear the object's state. More...
 
void Destroy ()
 Clear the object's state. More...
 
void Dump (Stream *s) const
 Dump the description of each module contained in this list. More...
 
void LogUUIDAndPaths (Log *log, const char *prefix_cstr)
 
std::recursive_mutex & GetMutex () const
 
size_t GetIndexForModule (const Module *module) const
 
lldb::ModuleSP GetModuleAtIndex (size_t idx) const
 Get the module shared pointer for the module at index idx. More...
 
lldb::ModuleSP GetModuleAtIndexUnlocked (size_t idx) const
 Get the module shared pointer for the module at index idx without acquiring the ModuleList mutex. More...
 
ModuleGetModulePointerAtIndex (size_t idx) const
 Get the module pointer for the module at index idx. More...
 
ModuleGetModulePointerAtIndexUnlocked (size_t idx) const
 Get the module pointer for the module at index idx without acquiring the ModuleList mutex. More...
 
size_t FindCompileUnits (const FileSpec &path, bool append, SymbolContextList &sc_list) const
 Find compile units by partial or full path. More...
 
size_t FindFunctions (ConstString name, lldb::FunctionNameType name_type_mask, bool include_symbols, bool include_inlines, bool append, SymbolContextList &sc_list) const
 
size_t FindFunctionSymbols (ConstString name, lldb::FunctionNameType name_type_mask, SymbolContextList &sc_list)
 
size_t FindFunctions (const RegularExpression &name, bool include_symbols, bool include_inlines, bool append, SymbolContextList &sc_list)
 
size_t FindGlobalVariables (ConstString name, size_t max_matches, VariableList &variable_list) const
 Find global and static variables by name. More...
 
size_t FindGlobalVariables (const RegularExpression &regex, size_t max_matches, VariableList &variable_list) const
 Find global and static variables by regular expression. More...
 
size_t FindModules (const ModuleSpec &module_spec, ModuleList &matching_module_list) const
 Finds the first module whose file specification matches file_spec. More...
 
lldb::ModuleSP FindModule (const Module *module_ptr) const
 
lldb::ModuleSP FindModule (const UUID &uuid) const
 
lldb::ModuleSP FindFirstModule (const ModuleSpec &module_spec) const
 
size_t FindSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list, bool append=false) const
 
size_t FindSymbolsMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list, bool append=false) const
 
size_t FindTypes (Module *search_first, ConstString name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet< SymbolFile *> &searched_symbol_files, TypeList &types) const
 Find types by name. More...
 
bool FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 
void FindAddressesForLine (const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern)
 Find addresses by file/line. More...
 
bool Remove (const lldb::ModuleSP &module_sp, bool notify=true)
 Remove a module from the module list. More...
 
size_t Remove (ModuleList &module_list)
 
bool RemoveIfOrphaned (const Module *module_ptr)
 
size_t RemoveOrphans (bool mandatory)
 
bool ResolveFileAddress (lldb::addr_t vm_addr, Address &so_addr) const
 
uint32_t ResolveSymbolContextForAddress (const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const
 Resolve the symbol context for the given address. (const Address More...
 
uint32_t ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const
 Resolve items in the symbol context for a given file and line. (const char More...
 
uint32_t ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const
 Resolve items in the symbol context for a given file and line. (const FileSpec More...
 
size_t GetSize () const
 Gets the size of the module list. More...
 
bool LoadScriptingResourcesInTarget (Target *target, std::list< Status > &errors, Stream *feedback_stream=nullptr, bool continue_on_error=true)
 
void ForEach (std::function< bool(const lldb::ModuleSP &module_sp)> const &callback) const
 
ModuleIterable Modules ()
 
ModuleIterableNoLocking ModulesNoLocking ()
 

Static Public Member Functions

static ModuleListPropertiesGetGlobalModuleListProperties ()
 
static bool ModuleIsInCache (const Module *module_ptr)
 
static Status GetSharedModule (const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr, bool always_create=false)
 
static bool RemoveSharedModule (lldb::ModuleSP &module_sp)
 
static size_t FindSharedModules (const ModuleSpec &module_spec, ModuleList &matching_module_list)
 
static size_t RemoveOrphanSharedModules (bool mandatory)
 
static bool RemoveSharedModuleIfOrphaned (const Module *module_ptr)
 

Protected Types

typedef std::vector< lldb::ModuleSP > collection
 The module collection type. More...
 

Protected Member Functions

void AppendImpl (const lldb::ModuleSP &module_sp, bool use_notifier=true)
 
bool RemoveImpl (const lldb::ModuleSP &module_sp, bool use_notifier=true)
 
collection::iterator RemoveImpl (collection::iterator pos, bool use_notifier=true)
 
void ClearImpl (bool use_notifier=true)
 

Protected Attributes

collection m_modules
 The collection of modules. More...
 
std::recursive_mutex m_modules_mutex
 
Notifierm_notifier
 

Detailed Description

A collection class for Module objects.

Modules in the module collection class are stored as reference counted shared pointers to Module objects.

Definition at line 91 of file ModuleList.h.

Member Typedef Documentation

◆ collection

typedef std::vector<lldb::ModuleSP> lldb_private::ModuleList::collection
protected

The module collection type.

Definition at line 538 of file ModuleList.h.

◆ ModuleIterable

Definition at line 558 of file ModuleList.h.

◆ ModuleIterableNoLocking

Definition at line 562 of file ModuleList.h.

Constructor & Destructor Documentation

◆ ModuleList() [1/3]

ModuleList::ModuleList ( )

Default constructor.

Creates an empty list of Module objects.

Definition at line 118 of file ModuleList.cpp.

◆ ModuleList() [2/3]

ModuleList::ModuleList ( const ModuleList rhs)

Copy Constructor.

Creates a new module list object with a copy of the modules from rhs.

Parameters
[in]rhsAnother module list object.

Definition at line 121 of file ModuleList.cpp.

References m_modules, and m_modules_mutex.

◆ ModuleList() [3/3]

ModuleList::ModuleList ( ModuleList::Notifier notifier)

Definition at line 128 of file ModuleList.cpp.

◆ ~ModuleList()

ModuleList::~ModuleList ( )
default

Destructor.

Referenced by operator=().

Member Function Documentation

◆ Append() [1/2]

void lldb_private::ModuleList::Append ( const lldb::ModuleSP &  module_sp,
bool  notify = true 
)

Append a module to the module list.

Parameters
[in]module_spA shared pointer to a module to add to this collection.
[in]notifyIf true, and a notifier function is set, the notifier function will be called. Defaults to true.

When this ModuleList is the Target's ModuleList, the notifier function is Target::ModulesDidLoad – the call to ModulesDidLoad may be deferred when adding multiple Modules to the Target, but it must be called at the end, before resuming execution.

Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos(), CommandObjectTargetSymbolsAdd::AddModuleSymbols(), Append(), AppendImpl(), lldb::SBTarget::ClearModuleLoadAddress(), lldb::SBTarget::ClearSectionLoadAddress(), DynamicLoaderHexagonDYLD::DidAttach(), lldb_private::DynamicLoaderWindowsDYLD::DidAttach(), DynamicLoaderPOSIXDYLD::DidAttach(), lldb_private::DynamicLoaderWindowsDYLD::DidLaunch(), DynamicLoaderPOSIXDYLD::DidLaunch(), FindModules(), lldb_private::Target::GetOrCreateModule(), DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos(), lldb_private::ClangUtilityFunction::Install(), DynamicLoaderHexagonDYLD::LoadAllCurrentModules(), DynamicLoaderPOSIXDYLD::LoadAllCurrentModules(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), lldb_private::Breakpoint::ModuleReplaced(), lldb_private::Target::NotifyModuleAdded(), lldb_private::Target::NotifyModuleRemoved(), lldb_private::ProcessWindows::OnExitProcess(), lldb_private::DynamicLoaderWindowsDYLD::OnLoadModule(), lldb_private::DynamicLoaderWindowsDYLD::OnUnloadModule(), lldb_private::ClangUserExpression::Parse(), DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(), DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(), lldb_private::minidump::ProcessMinidump::ReadModuleList(), DynamicLoaderHexagonDYLD::RefreshModules(), DynamicLoaderPOSIXDYLD::RefreshModules(), ReplaceEquivalent(), lldb_private::Symbol::ResolveReExportedSymbolInModuleSpec(), lldb::SBModule::SBModule(), lldb_private::Target::SetExecutableModule(), lldb::SBTarget::SetModuleLoadAddress(), lldb::SBTarget::SetSectionLoadAddress(), lldb_private::DynamicLoaderDarwin::UnloadAllImages(), updateSectionLoadAddress(), and lldb_private::FunctionCaller::WriteFunctionWrapper().

◆ Append() [2/2]

void ModuleList::Append ( const ModuleList module_list)

Definition at line 197 of file ModuleList.cpp.

References Append(), and m_modules.

◆ AppendIfNeeded() [1/2]

bool lldb_private::ModuleList::AppendIfNeeded ( const lldb::ModuleSP &  module_sp,
bool  notify = true 
)

Append a module to the module list, if it is not already there.

Parameters
[in]module_sp
[in]notifyIf true, and a notifier function is set, the notifier function will be called. Defaults to true.

When this ModuleList is the Target's ModuleList, the notifier function is Target::ModulesDidLoad – the call to ModulesDidLoad may be deferred when adding multiple Modules to the Target, but it must be called at the end, before resuming execution.

Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos(), AppendIfNeeded(), DynamicLoaderStatic::DidLaunch(), FindModulesByName(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), lldb_private::DynamicLoader::LoadModuleAtAddress(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), DynamicLoaderPOSIXDYLD::LoadVDSO(), lldb_private::Breakpoint::ModulesChanged(), DynamicLoaderDarwinKernel::ParseKextSummaries(), DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(), DynamicLoaderHexagonDYLD::RefreshModules(), DynamicLoaderPOSIXDYLD::RefreshModules(), DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(), ReplaceEquivalent(), lldb_private::Symbol::ResolveReExportedSymbolInModuleSpec(), lldb_private::Target::SetExecutableModule(), lldb_private::DynamicLoaderDarwin::UnloadImages(), lldb_private::DynamicLoaderDarwin::UpdateDYLDImageInfoFromNewImageInfo(), DynamicLoaderMacOSXDYLD::UpdateImageInfosHeaderAndLoadCommands(), updateSectionLoadAddress(), and lldb_private::DynamicLoaderDarwin::UpdateSpecialBinariesFromNewImageInfos().

◆ AppendIfNeeded() [2/2]

bool ModuleList::AppendIfNeeded ( const ModuleList module_list)

◆ AppendImpl()

void ModuleList::AppendImpl ( const lldb::ModuleSP &  module_sp,
bool  use_notifier = true 
)
protected

◆ Clear()

void ModuleList::Clear ( )

Clear the object's state.

Clears the list of modules and releases a reference to each module object and if the reference count goes to zero, the module will be deleted.

Definition at line 304 of file ModuleList.cpp.

References ClearImpl().

Referenced by lldb_private::Target::ClearModules(), CommandObjectSourceList::DoExecute(), CommandObjectSourceList::FindMatchingFunctions(), and CommandObjectSourceList::FindMatchingFunctionSymbols().

◆ ClearImpl()

void ModuleList::ClearImpl ( bool  use_notifier = true)
protected

◆ Destroy()

void ModuleList::Destroy ( )

Clear the object's state.

Clears the list of modules and releases a reference to each module object and if the reference count goes to zero, the module will be deleted. Also release all memory that might be held by any collection classes (like std::vector)

Definition at line 306 of file ModuleList.cpp.

References ClearImpl().

◆ Dump()

void ModuleList::Dump ( Stream s) const

Dump the description of each module contained in this list.

Dump the description of each module contained in this list to the supplied stream s.

Parameters
[in]sThe stream to which to dump the object description.
See also
Module::Dump(Stream *) const

Definition at line 620 of file ModuleList.cpp.

References m_modules, and m_modules_mutex.

Referenced by lldb_private::Target::Dump().

◆ FindAddressesForLine()

void ModuleList::FindAddressesForLine ( const lldb::TargetSP  target_sp,
const FileSpec file,
uint32_t  line,
Function function,
std::vector< Address > &  output_local,
std::vector< Address > &  output_extern 
)

Find addresses by file/line.

Parameters
[in]target_spThe target the addresses are desired for.
[in]fileSource file to locate.
[in]lineSource line to locate.
[in]functionOptional filter function. Addresses within this function will be added to the 'local' list. All others will be added to the 'extern' list.
[out]output_localAll matching addresses within 'function'
[out]output_externAll matching addresses not within 'function'

Definition at line 586 of file ModuleList.cpp.

References m_modules, and m_modules_mutex.

Referenced by lldb_private::Thread::JumpToLine().

◆ FindCompileUnits()

size_t ModuleList::FindCompileUnits ( const FileSpec path,
bool  append,
SymbolContextList sc_list 
) const

Find compile units by partial or full path.

Finds all compile units that match path in all of the modules and returns the results in sc_list.

Parameters
[in]pathThe name of the compile unit we are looking for.
[in]appendIf true, then append any compile units that were found to sc_list. If false, then the sc_list is cleared and the contents of sc_list are replaced.
[out]sc_listA symbol context list that gets filled in with all of the matches.
Returns
The number of matches added to sc_list.

Definition at line 419 of file ModuleList.cpp.

References lldb_private::SymbolContextList::Clear(), lldb_private::SymbolContextList::GetSize(), m_modules, and m_modules_mutex.

Referenced by CommandObjectTargetVariable::DoExecute().

◆ FindFirstModule()

ModuleSP ModuleList::FindFirstModule ( const ModuleSpec module_spec) const

◆ FindFunctions() [1/2]

size_t lldb_private::ModuleList::FindFunctions ( ConstString  name,
lldb::FunctionNameType  name_type_mask,
bool  include_symbols,
bool  include_inlines,
bool  append,
SymbolContextList sc_list 
) const

◆ FindFunctions() [2/2]

size_t ModuleList::FindFunctions ( const RegularExpression name,
bool  include_symbols,
bool  include_inlines,
bool  append,
SymbolContextList sc_list 
)

◆ FindFunctionSymbols()

size_t ModuleList::FindFunctionSymbols ( ConstString  name,
lldb::FunctionNameType  name_type_mask,
SymbolContextList sc_list 
)

◆ FindGlobalVariables() [1/2]

size_t ModuleList::FindGlobalVariables ( ConstString  name,
size_t  max_matches,
VariableList variable_list 
) const

Find global and static variables by name.

Parameters
[in]nameThe name of the global or static variable we are looking for.
[in]max_matchesAllow the number of matches to be limited to max_matches. Specify UINT32_MAX to get all possible matches.
[in]variable_listA list of variables that gets the matches appended to.
Returns
The number of matches added to variable_list.

Definition at line 433 of file ModuleList.cpp.

References lldb_private::VariableList::GetSize(), m_modules, and m_modules_mutex.

Referenced by CommandObjectTargetVariable::DoExecute(), lldb_private::ClangExpressionDeclMap::GetSymbolAddress(), CommandObjectTargetVariable::GetVariableCallback(), and CommandObjectWatchpointSetVariable::GetVariableCallback().

◆ FindGlobalVariables() [2/2]

size_t ModuleList::FindGlobalVariables ( const RegularExpression regex,
size_t  max_matches,
VariableList variable_list 
) const

Find global and static variables by regular expression.

Parameters
[in]regexA regular expression to use when matching the name.
[in]max_matchesAllow the number of matches to be limited to max_matches. Specify UINT32_MAX to get all possible matches.
[in]variable_listA list of variables that gets the matches appended to.
Returns
The number of matches added to variable_list.

Definition at line 445 of file ModuleList.cpp.

References lldb_private::VariableList::GetSize(), m_modules, and m_modules_mutex.

◆ FindModule() [1/2]

ModuleSP ModuleList::FindModule ( const Module module_ptr) const

◆ FindModule() [2/2]

ModuleSP ModuleList::FindModule ( const UUID uuid) const

Definition at line 518 of file ModuleList.cpp.

References lldb_private::UUID::IsValid(), m_modules, and m_modules_mutex.

◆ FindModules()

size_t ModuleList::FindModules ( const ModuleSpec module_spec,
ModuleList matching_module_list 
) const

Finds the first module whose file specification matches file_spec.

Parameters
[in]file_spec_ptrA file specification object to match against the Module's file specifications. If file_spec does not have directory information, matches will occur by matching only the basename of any modules in this list. If this value is NULL, then file specifications won't be compared when searching for matching modules.
[in]arch_ptrThe architecture to search for if non-NULL. If this value is NULL no architecture matching will be performed.
[in]uuid_ptrThe uuid to search for if non-NULL. If this value is NULL no uuid matching will be performed.
[in]object_nameAn optional object name that must match as well. This value can be NULL.
[out]matching_module_listA module list that gets filled in with any modules that match the search criteria.
Returns
The number of matching modules found by the search.

Definition at line 486 of file ModuleList.cpp.

References Append(), GetSize(), m_modules, and m_modules_mutex.

Referenced by CommandObjectTargetSymbolsAdd::AddModuleSymbols(), CommandObjectSourceInfo::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectSourceList::FindMatchingFunctions(), CommandObjectSourceList::FindMatchingFunctionSymbols(), FindModulesByName(), FindSharedModules(), lldb_private::Target::GetOrCreateModule(), lldb_private::DynamicLoaderDarwin::GetPThreadLibraryModule(), GetSharedModule(), and lldb_private::Target::ModuleIsExcludedForUnconstrainedSearches().

◆ FindSharedModules()

size_t ModuleList::FindSharedModules ( const ModuleSpec module_spec,
ModuleList matching_module_list 
)
static

Definition at line 756 of file ModuleList.cpp.

References FindModules(), and GetSharedModuleList().

◆ FindSourceFile()

bool ModuleList::FindSourceFile ( const FileSpec orig_spec,
FileSpec new_spec 
) const

Definition at line 575 of file ModuleList.cpp.

References m_modules, and m_modules_mutex.

Referenced by lldb_private::SourceManager::File::File().

◆ FindSymbolsMatchingRegExAndType()

size_t ModuleList::FindSymbolsMatchingRegExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
SymbolContextList sc_list,
bool  append = false 
) const

◆ FindSymbolsWithNameAndType()

size_t ModuleList::FindSymbolsWithNameAndType ( ConstString  name,
lldb::SymbolType  symbol_type,
SymbolContextList sc_list,
bool  append = false 
) const

◆ FindTypes()

size_t ModuleList::FindTypes ( Module search_first,
ConstString  name,
bool  name_is_fully_qualified,
size_t  max_matches,
llvm::DenseSet< SymbolFile *> &  searched_symbol_files,
TypeList types 
) const

Find types by name.

Parameters
[in]search_firstIf non-null, this module will be searched before any other modules.
[in]nameThe name of the type we are looking for.
[in]appendIf true, any matches will be appended to variable_list, else matches replace the contents of variable_list.
[in]max_matchesAllow the number of matches to be limited to max_matches. Specify UINT32_MAX to get all possible matches.
[in]encodingLimit the search to specific types, or get all types if set to Type::invalid.
[in]udt_nameIf the encoding is a user defined type, specify the name of the user defined type ("struct", "union", "class", etc).
[out]type_listA type list gets populated with any matches.
Returns
The number of matches added to type_list.

Definition at line 536 of file ModuleList.cpp.

References lldb_private::Module::FindTypes(), m_modules, and m_modules_mutex.

Referenced by lldb_private::ItaniumABILanguageRuntime::CouldHaveDynamicValue(), CommandObjectMemoryRead::DoExecute(), lldb_private::ClangASTSource::FindExternalVisibleDeclsByName(), and lldb::SBTarget::FindTypes().

◆ ForEach()

void ModuleList::ForEach ( std::function< bool(const lldb::ModuleSP &module_sp)> const &  callback) const

◆ GetGlobalModuleListProperties()

ModuleListProperties & ModuleList::GetGlobalModuleListProperties ( )
static

◆ GetIndexForModule()

size_t ModuleList::GetIndexForModule ( const Module module) const

◆ GetModuleAtIndex()

ModuleSP ModuleList::GetModuleAtIndex ( size_t  idx) const

◆ GetModuleAtIndexUnlocked()

ModuleSP ModuleList::GetModuleAtIndexUnlocked ( size_t  idx) const

◆ GetModulePointerAtIndex()

Module * ModuleList::GetModulePointerAtIndex ( size_t  idx) const

◆ GetModulePointerAtIndexUnlocked()

Module * ModuleList::GetModulePointerAtIndexUnlocked ( size_t  idx) const

Get the module pointer for the module at index idx without acquiring the ModuleList mutex.

This MUST already have been acquired with ModuleList::GetMutex and locked for this call to be safe.

Parameters
[in]idxAn index into this module collection.
Returns
A pointer to a Module which can by nullptr if idx is out of range.
See also
ModuleList::GetSize()

Definition at line 320 of file ModuleList.cpp.

References m_modules.

Referenced by DynamicLoaderMacOS::CanLoadImage(), lldb_private::MemoryHistoryASan::CreateInstance(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), DumpModuleObjfileHeaders(), GetModulePointerAtIndex(), lldb_private::SearchFilterByModule::Search(), and lldb_private::SearchFilterByModuleList::Search().

◆ GetMutex()

std::recursive_mutex& lldb_private::ModuleList::GetMutex ( ) const
inline

◆ GetSharedModule()

Status ModuleList::GetSharedModule ( const ModuleSpec module_spec,
lldb::ModuleSP &  module_sp,
const FileSpecList *  module_search_paths_ptr,
lldb::ModuleSP *  old_module_sp_ptr,
bool *  did_create_ptr,
bool  always_create = false 
)
static

◆ GetSize()

size_t ModuleList::GetSize ( ) const

Gets the size of the module list.

Returns
The number of modules in the module list.

Definition at line 611 of file ModuleList.cpp.

References m_modules, and m_modules_mutex.

Referenced by lldb_private::DynamicLoaderDarwin::AddModulesUsingImageInfos(), DynamicLoaderMacOS::CanLoadImage(), lldb_private::Process::CompleteAttach(), lldb_private::ClangASTSource::CompleteNamespaceMap(), lldb_private::MemoryHistoryASan::CreateInstance(), DynamicLoaderStatic::DidLaunch(), CommandObjectSourceInfo::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTargetModulesDumpClangAST::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesList::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), lldb_private::SearchFilter::DoModuleIteration(), lldb_private::Target::TargetEventData::Dump(), CommandObjectSourceInfo::DumpLinesForFile(), CommandObjectSourceInfo::DumpLinesInSymbolContexts(), DumpModuleObjfileHeaders(), lldb_private::ClangASTSource::FindExternalVisibleDecls(), lldb::SBTarget::FindFirstType(), FindModules(), FindModulesByName(), lldb_private::Target::GetExecutableModule(), lldb_private::AppleObjCRuntime::GetFoundationVersion(), lldb::SBTarget::GetNumModulesFromEvent(), lldb_private::AppleObjCRuntime::GetObjCModule(), lldb_private::AppleObjCRuntime::GetObjCVersion(), lldb_private::DynamicLoaderDarwin::GetPThreadLibraryModule(), CommandObjectSourceInfo::GetSymbolContextsForAddress(), DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos(), lldb_private::Target::Install(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), lldb_private::Breakpoint::ModulesChanged(), lldb_private::StructuredDataDarwinLog::ModulesDidLoad(), lldb_private::RenderScriptRuntime::ModulesDidLoad(), lldb_private::Target::ModulesDidLoad(), lldb_private::Target::ModulesDidUnload(), lldb_private::AppleObjCRuntime::ReadObjCLibraryIfNeeded(), DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(), lldb_private::SearchFilterByModule::Search(), lldb_private::SearchFilterByModuleList::Search(), lldb_private::SearchFilterByModuleListAndCU::Search(), lldb_private::SearchFilter::SearchInModuleList(), lldb_private::Target::SymbolsDidLoad(), lldb_private::DynamicLoaderDarwin::UnloadAllImages(), lldb_private::DynamicLoaderDarwin::UnloadImages(), lldb_private::Target::UnloadModuleSections(), and lldb_private::AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler().

◆ LoadScriptingResourcesInTarget()

bool ModuleList::LoadScriptingResourcesInTarget ( Target target,
std::list< Status > &  errors,
Stream feedback_stream = nullptr,
bool  continue_on_error = true 
)

◆ LogUUIDAndPaths()

void ModuleList::LogUUIDAndPaths ( Log log,
const char *  prefix_cstr 
)

◆ ModuleIsInCache()

bool ModuleList::ModuleIsInCache ( const Module module_ptr)
static

Definition at line 748 of file ModuleList.cpp.

References FindModule(), and GetSharedModuleList().

◆ Modules()

ModuleIterable lldb_private::ModuleList::Modules ( )
inline

◆ ModulesNoLocking()

ModuleIterableNoLocking lldb_private::ModuleList::ModulesNoLocking ( )
inline

Definition at line 563 of file ModuleList.h.

Referenced by lldb_private::Breakpoint::ModulesChanged().

◆ operator=()

const ModuleList & ModuleList::operator= ( const ModuleList rhs)

Assignment operator.

Copies the module list from rhs into this list.

Parameters
[in]rhsAnother module list object.
Returns
A const reference to this object.

Definition at line 131 of file ModuleList.cpp.

References m_modules, m_modules_mutex, and ~ModuleList().

◆ Remove() [1/2]

bool lldb_private::ModuleList::Remove ( const lldb::ModuleSP &  module_sp,
bool  notify = true 
)

Remove a module from the module list.

Parameters
[in]module_spA shared pointer to a module to remove from this collection.
[in]notifyIf true, and a notifier function is set, the notifier function will be called. Defaults to true.

When this ModuleList is the Target's ModuleList, the notifier function is Target::ModulesDidUnload – the call to ModulesDidUnload may be deferred when removing multiple Modules from the Target, but it must be called at the end, before resuming execution.

Referenced by AppendIfNeeded(), GetSharedModule(), DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule(), lldb_private::minidump::ProcessMinidump::ReadModuleList(), DynamicLoaderHexagonDYLD::RefreshModules(), DynamicLoaderPOSIXDYLD::RefreshModules(), Remove(), DynamicLoaderMacOSXDYLD::RemoveModulesUsingImageInfosAddress(), RemoveSharedModule(), lldb_private::DynamicLoaderDarwin::UnloadAllImages(), lldb_private::DynamicLoaderDarwin::UnloadImages(), updateSectionLoadAddress(), and lldb_private::LLVMUserExpression::~LLVMUserExpression().

◆ Remove() [2/2]

size_t ModuleList::Remove ( ModuleList module_list)

◆ RemoveIfOrphaned()

bool ModuleList::RemoveIfOrphaned ( const Module module_ptr)

Definition at line 251 of file ModuleList.cpp.

References m_modules, m_modules_mutex, and RemoveImpl().

Referenced by RemoveSharedModuleIfOrphaned().

◆ RemoveImpl() [1/2]

bool lldb_private::ModuleList::RemoveImpl ( const lldb::ModuleSP &  module_sp,
bool  use_notifier = true 
)
protected

◆ RemoveImpl() [2/2]

collection::iterator lldb_private::ModuleList::RemoveImpl ( collection::iterator  pos,
bool  use_notifier = true 
)
protected

◆ RemoveOrphans()

size_t ModuleList::RemoveOrphans ( bool  mandatory)

Definition at line 268 of file ModuleList.cpp.

References m_modules, m_modules_mutex, and RemoveImpl().

Referenced by RemoveOrphanSharedModules().

◆ RemoveOrphanSharedModules()

size_t ModuleList::RemoveOrphanSharedModules ( bool  mandatory)
static

Definition at line 761 of file ModuleList.cpp.

References GetSharedModuleList(), and RemoveOrphans().

◆ RemoveSharedModule()

bool ModuleList::RemoveSharedModule ( lldb::ModuleSP &  module_sp)
static

Definition at line 1008 of file ModuleList.cpp.

References GetSharedModuleList(), and Remove().

◆ RemoveSharedModuleIfOrphaned()

bool ModuleList::RemoveSharedModuleIfOrphaned ( const Module module_ptr)
static

Definition at line 1012 of file ModuleList.cpp.

References GetSharedModuleList(), and RemoveIfOrphaned().

Referenced by lldb_private::Target::GetOrCreateModule().

◆ ReplaceEquivalent()

void ModuleList::ReplaceEquivalent ( const lldb::ModuleSP &  module_sp)

Append a module to the module list and remove any equivalent modules.

Equivalent modules are ones whose file, platform file and architecture matches.

Replaces the module to the collection.

Parameters
[in]module_spA shared pointer to a module to replace in this collection.

Definition at line 158 of file ModuleList.cpp.

References Append(), AppendIfNeeded(), lldb_private::ModuleSpec::GetPlatformFileSpec(), m_modules, m_modules_mutex, and RemoveImpl().

Referenced by GetSharedModule().

◆ ReplaceModule()

bool ModuleList::ReplaceModule ( const lldb::ModuleSP &  old_module_sp,
const lldb::ModuleSP &  new_module_sp 
)

◆ ResolveFileAddress()

bool ModuleList::ResolveFileAddress ( lldb::addr_t  vm_addr,
Address so_addr 
) const

◆ ResolveSymbolContextForAddress()

uint32_t ModuleList::ResolveSymbolContextForAddress ( const Address so_addr,
lldb::SymbolContextItem  resolve_scope,
SymbolContext sc 
) const

Resolve the symbol context for the given address. (const Address

Tries to resolve the matching symbol context based on a lookup from the current symbol vendor. If the lazy lookup fails, an attempt is made to parse the eh_frame section to handle stripped symbols. If this fails, an attempt is made to resolve the symbol to the previous address to handle the case of a function with a tail call.

Use properties of the modified SymbolContext to inspect any resolved target, module, compilation unit, symbol, function, function block or line entry. Use the return value to determine which of these properties have been modified.

Parameters
[in]so_addrA load address to resolve.
[in]resolve_scopeThe scope that should be resolved (see SymbolContext::Scope). A combination of flags from the enumeration SymbolContextItem requesting a resolution depth. Note that the flags that are actually resolved may be a superset of the requested flags. For instance, eSymbolContextSymbol requires resolution of eSymbolContextModule, and eSymbolContextFunction requires eSymbolContextSymbol.
[out]scThe SymbolContext that is modified based on symbol resolution.
[in]resolve_tail_call_addressDetermines if so_addr should resolve to a symbol in the case of a function whose last instruction is a call. In this case, the PC can be one past the address range of the function.
Returns
The scope that has been resolved (see SymbolContext::Scope).
See also
SymbolContext::Scope (const Address &,uint32_t,SymbolContext&)

Definition at line 662 of file ModuleList.cpp.

References lldb_private::Address::GetModule(), m_modules, and m_modules_mutex.

Referenced by lldb_private::ItaniumABILanguageRuntime::CouldHaveDynamicValue(), lldb_private::Address::Dump(), and lldb_private::CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo().

◆ ResolveSymbolContextForFilePath()

uint32_t ModuleList::ResolveSymbolContextForFilePath ( const char *  file_path,
uint32_t  line,
bool  check_inlines,
lldb::SymbolContextItem  resolve_scope,
SymbolContextList sc_list 
) const

Resolve items in the symbol context for a given file and line. (const char

Tries to resolve file_path and line to a list of matching symbol contexts.

The line table entries contains addresses that can be used to further resolve the values in each match: the function, block, symbol. Care should be taken to minimize the amount of information that is requested to only what is needed – typically the module, compile unit, line table and line table entry are sufficient.

Parameters
[in]file_pathA path to a source file to match. If file_path does not specify a directory, then this query will match all files whose base filename matches. If file_path does specify a directory, the fullpath to the file must match.
[in]lineThe source line to match, or zero if just the compile unit should be resolved.
[in]check_inlinesCheck for inline file and line number matches. This option should be used sparingly as it will cause all line tables for every compile unit to be parsed and searched for matching inline file entries.
[in]resolve_scopeThe scope that should be resolved (see SymbolContext::Scope).
[out]sc_listA symbol context list that gets matching symbols contexts appended to.
Returns
The number of matches that were added to sc_list.
See also
SymbolContext::Scope (const char *,uint32_t,bool,uint32_t,SymbolContextList&)

Definition at line 685 of file ModuleList.cpp.

References ResolveSymbolContextsForFileSpec().

Referenced by CommandObjectSourceList::DoExecute(), and lldb_private::SourceManager::File::File().

◆ ResolveSymbolContextsForFileSpec()

uint32_t ModuleList::ResolveSymbolContextsForFileSpec ( const FileSpec file_spec,
uint32_t  line,
bool  check_inlines,
lldb::SymbolContextItem  resolve_scope,
SymbolContextList sc_list 
) const

Resolve items in the symbol context for a given file and line. (const FileSpec

Tries to resolve file_spec and line to a list of matching symbol contexts.

The line table entries contains addresses that can be used to further resolve the values in each match: the function, block, symbol. Care should be taken to minimize the amount of information that is requested to only what is needed – typically the module, compile unit, line table and line table entry are sufficient.

Parameters
[in]file_specA file spec to a source file to match. If file_path does not specify a directory, then this query will match all files whose base filename matches. If file_path does specify a directory, the fullpath to the file must match.
[in]lineThe source line to match, or zero if just the compile unit should be resolved.
[in]check_inlinesCheck for inline file and line number matches. This option should be used sparingly as it will cause all line tables for every compile unit to be parsed and searched for matching inline file entries.
[in]resolve_scopeThe scope that should be resolved (see SymbolContext::Scope).
[out]sc_listA symbol context list that gets filled in with all of the matches.
Returns
A integer that contains SymbolContext::Scope bits set for each item that was successfully resolved.
See also
SymbolContext::Scope (const FileSpec &,uint32_t,bool,uint32_t,SymbolContextList&)

Definition at line 693 of file ModuleList.cpp.

References lldb_private::SymbolContextList::GetSize(), m_modules, and m_modules_mutex.

Referenced by ResolveSymbolContextForFilePath().

Member Data Documentation

◆ m_modules

collection lldb_private::ModuleList::m_modules
protected

◆ m_modules_mutex

std::recursive_mutex lldb_private::ModuleList::m_modules_mutex
mutableprotected

◆ m_notifier

Notifier* lldb_private::ModuleList::m_notifier
protected

Definition at line 553 of file ModuleList.h.

Referenced by AppendIfNeeded(), AppendImpl(), ClearImpl(), Remove(), and ReplaceModule().


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