LLDB mainline
lldb_private::ModuleSpec Class Reference

#include <ModuleSpec.h>

Public Member Functions

 ModuleSpec ()=default
 ModuleSpec (const FileSpec &file_spec, const UUID &uuid=UUID(), lldb::DataExtractorSP extractor_sp=lldb::DataExtractorSP())
 If the extractor_sp argument is passed, its contents will be used as the module contents instead of trying to read them from file_spec .
 ModuleSpec (const FileSpec &file_spec, const ArchSpec &arch)
FileSpecGetFileSpecPtr ()
const FileSpecGetFileSpecPtr () const
FileSpecGetFileSpec ()
const FileSpecGetFileSpec () const
FileSpecGetPlatformFileSpecPtr ()
const FileSpecGetPlatformFileSpecPtr () const
FileSpecGetPlatformFileSpec ()
const FileSpecGetPlatformFileSpec () const
FileSpecGetSymbolFileSpecPtr ()
const FileSpecGetSymbolFileSpecPtr () const
FileSpecGetSymbolFileSpec ()
const FileSpecGetSymbolFileSpec () const
ArchSpecGetArchitecturePtr ()
const ArchSpecGetArchitecturePtr () const
ArchSpecGetArchitecture ()
const ArchSpecGetArchitecture () const
UUIDGetUUIDPtr ()
const UUIDGetUUIDPtr () const
UUIDGetUUID ()
const UUIDGetUUID () const
ConstStringGetObjectName ()
ConstString GetObjectName () const
uint64_t GetObjectOffset () const
void SetObjectOffset (uint64_t object_offset)
uint64_t GetObjectSize () const
void SetObjectSize (uint64_t object_size)
std::optional< lldb::addr_tGetLoadAddress () const
 Get the load address of a module in process memory.
void SetLoadAddress (lldb::addr_t addr)
 Set the load address of a module in process memory.
void ClearLoadAddress ()
llvm::sys::TimePoint & GetObjectModificationTime ()
const llvm::sys::TimePoint & GetObjectModificationTime () const
PathMappingListGetSourceMappingList () const
lldb::DataExtractorSP GetExtractor () const
lldb::TargetSP GetTargetSP () const
void SetTarget (lldb::TargetSP target)
 Set the target to be used when resolving a module.
lldb::PlatformSP GetPlatformSP () const
void SetPlatform (lldb::PlatformSP platform)
 Set the platform to be used when resolving a module.
void Clear ()
 operator bool () const
void Dump (Stream &strm) const
bool Matches (const ModuleSpec &match_module_spec, bool exact_arch_match) const

Protected Attributes

FileSpec m_file
FileSpec m_platform_file
FileSpec m_symbol_file
ArchSpec m_arch
UUID m_uuid
ConstString m_object_name
std::weak_ptr< Targetm_target_wp
 The target used when resolving a module.
std::weak_ptr< Platformm_platform_wp
 The platform used when resolving a module.
uint64_t m_object_offset = 0
uint64_t m_object_size = 0
llvm::sys::TimePoint m_object_mod_time
PathMappingList m_source_mappings
lldb::DataExtractorSP m_extractor_sp = {}
std::optional< lldb::addr_tm_load_addr = std::nullopt
 The load address of the module in a process.

Detailed Description

Definition at line 30 of file ModuleSpec.h.

Constructor & Destructor Documentation

◆ ModuleSpec() [1/3]

lldb_private::ModuleSpec::ModuleSpec ( )
default

Referenced by Matches().

◆ ModuleSpec() [2/3]

lldb_private::ModuleSpec::ModuleSpec ( const FileSpec & file_spec,
const UUID & uuid = UUID(),
lldb::DataExtractorSP extractor_sp = lldb::DataExtractorSP() )
inline

If the extractor_sp argument is passed, its contents will be used as the module contents instead of trying to read them from file_spec .

Definition at line 37 of file ModuleSpec.h.

References lldb_private::FileSystem::Instance(), m_extractor_sp, m_file, m_object_offset, m_object_size, and m_uuid.

◆ ModuleSpec() [3/3]

lldb_private::ModuleSpec::ModuleSpec ( const FileSpec & file_spec,
const ArchSpec & arch )
inline

Definition at line 47 of file ModuleSpec.h.

References m_arch, m_file, m_object_offset, and m_object_size.

Member Function Documentation

◆ Clear()

◆ ClearLoadAddress()

void lldb_private::ModuleSpec::ClearLoadAddress ( )
inline

Definition at line 128 of file ModuleSpec.h.

References m_load_addr.

◆ Dump()

◆ GetArchitecture() [1/2]

ArchSpec & lldb_private::ModuleSpec::GetArchitecture ( )
inline

Definition at line 93 of file ModuleSpec.h.

References m_arch.

Referenced by lldb::SBTarget::AddModule(), CommandObjectTargetSymbolsAdd::AddModuleSymbols(), CommandObjectTargetSymbolsAdd::AddSymbolsForFile(), CommandObjectTargetSymbolsAdd::AddSymbolsForFrame(), CommandObjectTargetSymbolsAdd::AddSymbolsForStack(), ProcessKDP::DoConnectRemote(), CommandObjectTargetModulesAdd::DoExecute(), lldb_private::SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(), ObjectFileMachO::Dump(), FileAtPathContainsArchAndUUID(), FindModulesByName(), lldb_private::SymbolLocatorDebugSymbols::FindSymbolFileInBundle(), lldb_private::DynamicLoaderDarwin::FindTargetModuleForImageInfo(), ObjectFileMachO::GetAllArchSpecs(), ObjectFileMachO::GetArchitecture(), lldb_private::ScriptedProcess::GetLoadedDynamicLibrariesInfos(), ProcessElfCore::GetMainExecutableModuleSpec(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetModuleInfo(), lldb_private::ObjectFilePDB::GetModuleSpecifications(), ObjectContainerBSDArchive::GetModuleSpecifications(), ObjectFileELF::GetModuleSpecifications(), ObjectFilePECOFF::GetModuleSpecifications(), ObjectFileXCOFF::GetModuleSpecifications(), lldb_private::Platform::GetRemoteSharedModule(), lldb_private::ModuleList::GetSharedModule(), lldb_private::PlatformMacOSX::GetSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_jModulesInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qModuleInfo(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), Matches(), lldb_private::Module::MatchesModuleSpec(), lldb_private::Module::Module(), ObjectFileMachO::ParseHeader(), ParseModuleSpec(), lldb_private::minidump::ProcessMinidump::ReadModuleList(), lldb_private::Platform::ResolveExecutable(), and lldb_private::plugin::dwarf::SymbolFileDWARF::UpdateExternalModuleListIfNeeded().

◆ GetArchitecture() [2/2]

const ArchSpec & lldb_private::ModuleSpec::GetArchitecture ( ) const
inline

Definition at line 95 of file ModuleSpec.h.

References m_arch.

◆ GetArchitecturePtr() [1/2]

◆ GetArchitecturePtr() [2/2]

const ArchSpec * lldb_private::ModuleSpec::GetArchitecturePtr ( ) const
inline

Definition at line 89 of file ModuleSpec.h.

References m_arch.

◆ GetExtractor()

lldb::DataExtractorSP lldb_private::ModuleSpec::GetExtractor ( ) const
inline

Definition at line 140 of file ModuleSpec.h.

References m_extractor_sp.

Referenced by lldb_private::Module::Module().

◆ GetFileSpec() [1/2]

FileSpec & lldb_private::ModuleSpec::GetFileSpec ( )
inline

Definition at line 57 of file ModuleSpec.h.

References m_file.

Referenced by lldb::SBTarget::AddModule(), CommandObjectTargetSymbolsAdd::AddModuleSymbols(), CommandObjectTargetSymbolsAdd::AddSymbolsForFile(), CommandObjectTargetSymbolsAdd::AddSymbolsForFrame(), CommandObjectTargetSymbolsAdd::AddSymbolsForStack(), BringInRemoteFile(), lldb_private::Platform::CallLocateModuleCallbackIfSet(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), SymbolVendorELF::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), ProcessKDP::DoConnectRemote(), CommandObjectTargetModulesAdd::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetSymbolsAdd::DoExecute(), ProcessElfCore::DoLoadCore(), lldb_private::PlatformDarwin::FindBundleBinaryInExecSearchPaths(), ProcessElfCore::FindModuleUUID(), lldb_private::DynamicLoaderDarwin::FindTargetModuleForImageInfo(), lldb_private::ModuleCache::Get(), lldb_private::ModuleCache::GetAndPut(), lldb_private::Platform::GetCachedExecutable(), lldb_private::Platform::GetCachedSharedModule(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwpSymbolFile(), getFileName(), lldb_private::ScriptedProcess::GetLoadedDynamicLibrariesInfos(), ProcessElfCore::GetMainExecutableModuleSpec(), lldb_private::PlatformDarwin::GetModuleFromSharedCaches(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetModuleInfo(), ObjectFileMachO::GetModuleSpecifications(), GetModuleSpecInfoFromUUIDDictionary(), lldb_private::Target::GetOrCreateModule(), lldb_private::DynamicLoaderDarwin::GetPThreadLibraryModule(), lldb_private::Platform::GetRemoteSharedModule(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetSeparateDebugInfoFiles(), lldb_private::ModuleList::GetSharedModule(), lldb_private::Platform::GetSharedModule(), lldb_private::PlatformAppleSimulator::GetSharedModule(), lldb_private::PlatformDarwin::GetSharedModule(), lldb_private::PlatformRemoteDarwinDevice::GetSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_jModulesInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qModuleInfo(), lldb_private::DynamicLoader::LoadBinaryWithUUIDAndAddress(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), LocateDSYMInVincinityOfExecutable(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDefault::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableSymbolFile(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), Matches(), lldb_private::Module::MatchesModuleSpec(), lldb_private::Module::Module(), lldb_private::NativeProcessWindows::OnLoadDll(), lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::ParseKernel(), lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::ParseModule(), ParseModuleSpec(), lldb_private::minidump::ProcessMinidump::ReadModuleList(), lldb_private::Platform::ResolveExecutable(), lldb_private::RemoteAwarePlatform::ResolveExecutable(), lldb_private::Symbol::ResolveReExportedSymbol(), lldb_private::Symbol::ResolveReExportedSymbolInModuleSpec(), and lldb_private::plugin::dwarf::SymbolFileDWARF::UpdateExternalModuleListIfNeeded().

◆ GetFileSpec() [2/2]

const FileSpec & lldb_private::ModuleSpec::GetFileSpec ( ) const
inline

Definition at line 59 of file ModuleSpec.h.

References m_file.

◆ GetFileSpecPtr() [1/2]

◆ GetFileSpecPtr() [2/2]

const FileSpec * lldb_private::ModuleSpec::GetFileSpecPtr ( ) const
inline

Definition at line 53 of file ModuleSpec.h.

References m_file.

◆ GetLoadAddress()

std::optional< lldb::addr_t > lldb_private::ModuleSpec::GetLoadAddress ( ) const
inline

Get the load address of a module in process memory.

If the optional has no value, there is no load address for this module spec.

Definition at line 123 of file ModuleSpec.h.

References m_load_addr.

Referenced by ProcessElfCore::FindModuleUUID(), and Matches().

◆ GetObjectModificationTime() [1/2]

llvm::sys::TimePoint & lldb_private::ModuleSpec::GetObjectModificationTime ( )
inline

◆ GetObjectModificationTime() [2/2]

const llvm::sys::TimePoint & lldb_private::ModuleSpec::GetObjectModificationTime ( ) const
inline

Definition at line 134 of file ModuleSpec.h.

References m_object_mod_time.

◆ GetObjectName() [1/2]

◆ GetObjectName() [2/2]

ConstString lldb_private::ModuleSpec::GetObjectName ( ) const
inline

Definition at line 109 of file ModuleSpec.h.

References m_object_name.

◆ GetObjectOffset()

◆ GetObjectSize()

◆ GetPlatformFileSpec() [1/2]

◆ GetPlatformFileSpec() [2/2]

const FileSpec & lldb_private::ModuleSpec::GetPlatformFileSpec ( ) const
inline

Definition at line 71 of file ModuleSpec.h.

References m_platform_file.

◆ GetPlatformFileSpecPtr() [1/2]

FileSpec * lldb_private::ModuleSpec::GetPlatformFileSpecPtr ( )
inline

Definition at line 61 of file ModuleSpec.h.

References m_platform_file.

◆ GetPlatformFileSpecPtr() [2/2]

const FileSpec * lldb_private::ModuleSpec::GetPlatformFileSpecPtr ( ) const
inline

Definition at line 65 of file ModuleSpec.h.

References m_platform_file.

◆ GetPlatformSP()

lldb::PlatformSP lldb_private::ModuleSpec::GetPlatformSP ( ) const
inline

Definition at line 152 of file ModuleSpec.h.

References m_platform_wp.

Referenced by lldb_private::ModuleList::GetSharedModule().

◆ GetSourceMappingList()

PathMappingList & lldb_private::ModuleSpec::GetSourceMappingList ( ) const
inline

◆ GetSymbolFileSpec() [1/2]

◆ GetSymbolFileSpec() [2/2]

const FileSpec & lldb_private::ModuleSpec::GetSymbolFileSpec ( ) const
inline

Definition at line 83 of file ModuleSpec.h.

References m_symbol_file.

◆ GetSymbolFileSpecPtr() [1/2]

FileSpec * lldb_private::ModuleSpec::GetSymbolFileSpecPtr ( )
inline

Definition at line 73 of file ModuleSpec.h.

References m_symbol_file.

◆ GetSymbolFileSpecPtr() [2/2]

const FileSpec * lldb_private::ModuleSpec::GetSymbolFileSpecPtr ( ) const
inline

Definition at line 77 of file ModuleSpec.h.

References m_symbol_file.

◆ GetTargetSP()

◆ GetUUID() [1/2]

UUID & lldb_private::ModuleSpec::GetUUID ( )
inline

Definition at line 103 of file ModuleSpec.h.

References m_uuid.

Referenced by lldb::SBTarget::AddModule(), CommandObjectTargetSymbolsAdd::AddModuleSymbols(), CommandObjectTargetSymbolsAdd::AddSymbolsForFile(), CommandObjectTargetSymbolsAdd::AddSymbolsForFrame(), CommandObjectTargetSymbolsAdd::AddSymbolsForStack(), CommandObjectTargetSymbolsAdd::AddSymbolsForUUID(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), SymbolVendorELF::CreateInstance(), SymbolVendorMacOSX::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), ProcessKDP::DoConnectRemote(), CommandObjectTargetModulesAdd::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::SymbolLocator::DownloadSymbolFileAsync(), FileAtPathContainsArchAndUUID(), lldb_private::Process::FindModuleUUID(), ProcessElfCore::FindModuleUUID(), lldb_private::DynamicLoader::FindModuleViaTarget(), lldb_private::SymbolLocatorDebugSymbols::FindSymbolFileInBundle(), lldb_private::DynamicLoaderDarwin::FindTargetModuleForImageInfo(), lldb_private::ModuleCache::Get(), lldb_private::ModuleCache::GetAndPut(), lldb_private::Platform::GetCachedSharedModule(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwpSymbolFile(), GetFileForModule(), lldb_private::ScriptedProcess::GetLoadedDynamicLibrariesInfos(), lldb_private::PlatformDarwin::GetModuleFromSharedCaches(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::GetModuleInfo(), lldb_private::breakpad::ObjectFileBreakpad::GetModuleSpecifications(), lldb_private::ObjectFileJSON::GetModuleSpecifications(), lldb_private::ObjectFilePDB::GetModuleSpecifications(), ObjectFileELF::GetModuleSpecifications(), ObjectFilePECOFF::GetModuleSpecifications(), lldb_private::Target::GetOrCreateModule(), lldb_private::Platform::GetRemoteSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_jModulesInfo(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qModuleInfo(), lldb_private::DynamicLoader::LoadBinaryWithUUIDAndAddress(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), lldb_private::SymbolLocatorSymStore::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), Matches(), lldb_private::Module::MatchesModuleSpec(), lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::ParseModule(), ParseModuleSpec(), lldb_private::ModuleCache::Put(), lldb_private::minidump::ProcessMinidump::ReadModuleList(), and lldb_private::Platform::ResolveExecutable().

◆ GetUUID() [2/2]

const UUID & lldb_private::ModuleSpec::GetUUID ( ) const
inline

Definition at line 105 of file ModuleSpec.h.

References m_uuid.

◆ GetUUIDPtr() [1/2]

◆ GetUUIDPtr() [2/2]

const UUID * lldb_private::ModuleSpec::GetUUIDPtr ( ) const
inline

Definition at line 99 of file ModuleSpec.h.

References m_uuid.

◆ Matches()

bool lldb_private::ModuleSpec::Matches ( const ModuleSpec & match_module_spec,
bool exact_arch_match ) const
inline

◆ operator bool()

lldb_private::ModuleSpec::operator bool ( ) const
inlineexplicit

◆ SetLoadAddress()

void lldb_private::ModuleSpec::SetLoadAddress ( lldb::addr_t addr)
inline

Set the load address of a module in process memory.

Definition at line 126 of file ModuleSpec.h.

References m_load_addr.

Referenced by ProcessElfCore::GetMainExecutableModuleSpec(), DynamicLoaderPOSIXDYLD::LoadAllCurrentModules(), and lldb_private::DynamicLoader::LoadModuleAtAddress().

◆ SetObjectOffset()

◆ SetObjectSize()

◆ SetPlatform()

void lldb_private::ModuleSpec::SetPlatform ( lldb::PlatformSP platform)
inline

Set the platform to be used when resolving a module.

This is useful when a Target is not yet available (e.g., during target creation) but a Platform is. The platform can be used to invoke locate module callbacks and other platform-specific module resolution logic.

Definition at line 159 of file ModuleSpec.h.

References m_platform_wp.

◆ SetTarget()

void lldb_private::ModuleSpec::SetTarget ( lldb::TargetSP target)
inline

Set the target to be used when resolving a module.

A target can help locate a module specified by a ModuleSpec. The target settings, like the executable and debug info search paths, can be essential. The target's platform can also be used to locate or download the specified module.

Definition at line 150 of file ModuleSpec.h.

References m_target_wp.

Referenced by ProcessElfCore::CanDebug(), ProcessMachCore::CanDebug(), lldb_private::Target::GetOrCreateModule(), lldb_private::Platform::GetRemoteSharedModule(), lldb_private::DynamicLoader::LoadBinaryWithUUIDAndAddress(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderPOSIXDYLD::ResolveExecutableModule(), and lldb_private::Target::SetArchitecture().

Member Data Documentation

◆ m_arch

ArchSpec lldb_private::ModuleSpec::m_arch
protected

◆ m_extractor_sp

lldb::DataExtractorSP lldb_private::ModuleSpec::m_extractor_sp = {}
protected

Definition at line 329 of file ModuleSpec.h.

Referenced by Clear(), GetExtractor(), and ModuleSpec().

◆ m_file

FileSpec lldb_private::ModuleSpec::m_file
protected

◆ m_load_addr

std::optional<lldb::addr_t> lldb_private::ModuleSpec::m_load_addr = std::nullopt
protected

The load address of the module in a process.

This allows for modules to be uniquely identified and created by reading an object file from memory when we can't locate the correct file on disk. Useful for post mortem debugging when we might not be able to locate symbols for the core file, but we can read the object file from memory.

Definition at line 335 of file ModuleSpec.h.

Referenced by Clear(), ClearLoadAddress(), Dump(), GetLoadAddress(), Matches(), operator bool(), and SetLoadAddress().

◆ m_object_mod_time

llvm::sys::TimePoint lldb_private::ModuleSpec::m_object_mod_time
protected

◆ m_object_name

ConstString lldb_private::ModuleSpec::m_object_name
protected

Definition at line 316 of file ModuleSpec.h.

Referenced by Clear(), Dump(), GetObjectName(), GetObjectName(), and operator bool().

◆ m_object_offset

uint64_t lldb_private::ModuleSpec::m_object_offset = 0
protected

Definition at line 325 of file ModuleSpec.h.

Referenced by Clear(), Dump(), GetObjectOffset(), ModuleSpec(), ModuleSpec(), and SetObjectOffset().

◆ m_object_size

uint64_t lldb_private::ModuleSpec::m_object_size = 0
protected

◆ m_platform_file

FileSpec lldb_private::ModuleSpec::m_platform_file
protected

◆ m_platform_wp

std::weak_ptr<Platform> lldb_private::ModuleSpec::m_platform_wp
protected

The platform used when resolving a module.

This is useful when a Target is not yet available (e.g., during target creation) but a Platform is.

Definition at line 324 of file ModuleSpec.h.

Referenced by Clear(), GetPlatformSP(), and SetPlatform().

◆ m_source_mappings

PathMappingList lldb_private::ModuleSpec::m_source_mappings
mutableprotected

Definition at line 328 of file ModuleSpec.h.

Referenced by Clear(), and GetSourceMappingList().

◆ m_symbol_file

FileSpec lldb_private::ModuleSpec::m_symbol_file
protected

◆ m_target_wp

std::weak_ptr<Target> lldb_private::ModuleSpec::m_target_wp
protected

The target used when resolving a module.

A target can help locate a module specified by a ModuleSpec. The target settings, like the executable and debug info search paths, can be essential. The target's platform can also be used to locate or download the specified module.

Definition at line 321 of file ModuleSpec.h.

Referenced by Clear(), GetTargetSP(), and SetTarget().

◆ m_uuid

UUID lldb_private::ModuleSpec::m_uuid
protected

Definition at line 315 of file ModuleSpec.h.

Referenced by Clear(), Dump(), GetUUID(), GetUUID(), GetUUIDPtr(), GetUUIDPtr(), ModuleSpec(), and operator bool().


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