LLDB mainline
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
lldb_private::Module Class Reference

A class that describes an executable image and its associated object and symbol files. More...

#include "lldb/Core/Module.h"

Inheritance diagram for lldb_private::Module:
Inheritance graph
[legend]

Classes

class  LookupInfo
 A class that encapsulates name lookup information. More...
 

Public Member Functions

 Module (const FileSpec &file_spec, const ArchSpec &arch, ConstString object_name=ConstString(), lldb::offset_t object_offset=0, const llvm::sys::TimePoint<> &object_mod_time=llvm::sys::TimePoint<>())
 Construct with file specification and architecture.
 
 Module (const ModuleSpec &module_spec)
 
 ~Module () override
 Destructor.
 
bool MatchesModuleSpec (const ModuleSpec &module_ref)
 
bool SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset, bool &changed)
 Set the load address for all sections in a module to be the file address plus slide.
 
void CalculateSymbolContext (SymbolContext *sc) override
 Reconstruct the object's symbol context into sc.
 
lldb::ModuleSP CalculateSymbolContextModule () override
 
void GetDescription (llvm::raw_ostream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
 
std::string GetSpecificationDescription () const
 Get the module path and object name.
 
void Dump (Stream *s)
 Dump a description of this object to a Stream.
 
void DumpSymbolContext (Stream *s) override
 Dump the object's symbol context to the stream s.
 
const SymbolFindFirstSymbolWithNameAndType (ConstString name, lldb::SymbolType symbol_type=lldb::eSymbolTypeAny)
 Find a symbol in the object file's symbol table.
 
void FindSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
 
void FindSymbolsMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list, Mangled::NamePreference mangling_preference=Mangled::ePreferDemangled)
 
void FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
 Find a function symbols in the object file's symbol table.
 
void FindCompileUnits (const FileSpec &path, SymbolContextList &sc_list)
 Find compile units by partial or full path.
 
void FindFunctions (const LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by lookup info.
 
void FindFunctions (ConstString name, const CompilerDeclContext &parent_decl_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by name.
 
void FindFunctions (llvm::ArrayRef< CompilerContext > compiler_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by compiler context.
 
void FindFunctions (const RegularExpression &regex, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by name.
 
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.
 
void FindGlobalVariables (ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, VariableList &variable_list)
 Find global and static variables by name.
 
void FindGlobalVariables (const RegularExpression &regex, size_t max_matches, VariableList &variable_list)
 Find global and static variables by regular expression.
 
void FindTypes (const TypeQuery &query, TypeResults &results)
 Find types using a type-matching object that contains all search parameters.
 
const ArchSpecGetArchitecture () const
 Get const accessor for the module architecture.
 
const FileSpecGetFileSpec () const
 Get const accessor for the module file specification.
 
const FileSpecGetPlatformFileSpec () const
 Get accessor for the module platform file specification.
 
void SetPlatformFileSpec (const FileSpec &file)
 
const FileSpecGetRemoteInstallFileSpec () const
 
void SetRemoteInstallFileSpec (const FileSpec &file)
 
const FileSpecGetSymbolFileFileSpec () const
 
void PreloadSymbols ()
 
void SetSymbolFileFileSpec (const FileSpec &file)
 
const llvm::sys::TimePoint & GetModificationTime () const
 
const llvm::sys::TimePoint & GetObjectModificationTime () const
 
void RegisterXcodeSDK (llvm::StringRef sdk, llvm::StringRef sysroot)
 This callback will be called by SymbolFile implementations when parsing a compile unit that contains SDK information.
 
bool IsExecutable ()
 Tells whether this module is capable of being the main executable for a process.
 
bool IsLoadedInTarget (Target *target)
 Tells whether this module has been loaded in the target passed in.
 
bool LoadScriptingResourceInTarget (Target *target, Status &error, Stream &feedback_stream)
 
size_t GetNumCompileUnits ()
 Get the number of compile units for this module.
 
lldb::CompUnitSP GetCompileUnitAtIndex (size_t idx)
 
ConstString GetObjectName () const
 
uint64_t GetObjectOffset () const
 
virtual ObjectFileGetObjectFile ()
 Get the object file representation for the current architecture.
 
virtual SectionListGetSectionList ()
 Get the unified section list for the module.
 
virtual void SectionFileAddressesChanged ()
 Notify the module that the file addresses for the Sections have been updated.
 
UnwindTableGetUnwindTable ()
 Returns a reference to the UnwindTable for this Module.
 
llvm::VersionTuple GetVersion ()
 
ObjectFileGetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Status &error, size_t size_to_read=512)
 Load an object file from memory.
 
virtual SymbolFileGetSymbolFile (bool can_create=true, Stream *feedback_strm=nullptr)
 Get the module's symbol file.
 
SymtabGetSymtab ()
 
const lldb_private::UUIDGetUUID ()
 Get a reference to the UUID value contained in this object.
 
void ParseAllDebugSymbols ()
 A debugging function that will cause everything in a module to be parsed.
 
bool ResolveFileAddress (lldb::addr_t vm_addr, Address &so_addr)
 
uint32_t ResolveSymbolContextForAddress (const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc, bool resolve_tail_call_address=false)
 Resolve the symbol context for the given address.
 
uint32_t ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
 Resolve items in the symbol context for a given file and line.
 
uint32_t ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
 Resolve items in the symbol context for a given file and line.
 
void SetFileSpecAndObjectName (const FileSpec &file, ConstString object_name)
 
bool GetIsDynamicLinkEditor ()
 
llvm::Expected< lldb::TypeSystemSPGetTypeSystemForLanguage (lldb::LanguageType language)
 
void ForEachTypeSystem (llvm::function_ref< bool(lldb::TypeSystemSP)> callback)
 Call callback for each TypeSystem in this Module.
 
template<typename... Args>
void LogMessage (Log *log, const char *format, Args &&...args)
 
template<typename... Args>
void LogMessageVerboseBacktrace (Log *log, const char *format, Args &&...args)
 
template<typename... Args>
void ReportWarning (const char *format, Args &&...args)
 
template<typename... Args>
void ReportError (const char *format, Args &&...args)
 
template<typename... Args>
void ReportErrorIfModifyDetected (const char *format, Args &&...args)
 
void ReportWarningOptimization (std::optional< lldb::user_id_t > debugger_id)
 
void ReportWarningUnsupportedLanguage (lldb::LanguageType language, std::optional< lldb::user_id_t > debugger_id)
 
bool FileHasChanged () const
 
std::recursive_mutex & GetMutex () const
 
PathMappingListGetSourceMappingList ()
 
const PathMappingListGetSourceMappingList () const
 
bool FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 Finds a source file given a file spec using the module source path remappings (if any).
 
std::optional< std::string > RemapSourceFile (llvm::StringRef path) const
 Remaps a source file given path into new_path.
 
bool RemapSourceFile (const char *, std::string &) const =delete
 
bool MergeArchitecture (const ArchSpec &arch_spec)
 Update the ArchSpec to a more specific variant.
 
StatsDurationGetSymtabParseTime ()
 Accessor for the symbol table parse time metric.
 
StatsDurationGetSymtabIndexTime ()
 Accessor for the symbol table index time metric.
 
uint32_t Hash ()
 Get a unique hash for this module.
 
std::string GetCacheKey ()
 Get a unique cache key for the current module.
 
- Public Member Functions inherited from lldb_private::SymbolContextScope
virtual ~SymbolContextScope ()=default
 
virtual void CalculateSymbolContext (SymbolContext *sc)=0
 Reconstruct the object's symbol context into sc.
 
virtual lldb::ModuleSP CalculateSymbolContextModule ()
 
virtual CompileUnitCalculateSymbolContextCompileUnit ()
 
virtual FunctionCalculateSymbolContextFunction ()
 
virtual BlockCalculateSymbolContextBlock ()
 
virtual SymbolCalculateSymbolContextSymbol ()
 
virtual void DumpSymbolContext (Stream *s)=0
 Dump the object's symbol context to the stream s.
 

Static Public Member Functions

static size_t GetNumberAllocatedModules ()
 
static ModuleGetAllocatedModuleAtIndex (size_t idx)
 
static std::recursive_mutex & GetAllocationModuleCollectionMutex ()
 
template<typename ObjFilePlugin , typename... Args>
static lldb::ModuleSP CreateModuleFromObjectFile (Args &&...args)
 
static DataFileCacheGetIndexCache ()
 Get the global index file cache.
 

Protected Member Functions

void SymbolIndicesToSymbolContextList (Symtab *symtab, std::vector< uint32_t > &symbol_indexes, SymbolContextList &sc_list)
 
bool SetArchitecture (const ArchSpec &new_arch)
 
void SetUUID (const lldb_private::UUID &uuid)
 
SectionListGetUnifiedSectionList ()
 

Protected Attributes

std::recursive_mutex m_mutex
 A mutex to keep this object happy in multi-threaded environments.
 
llvm::sys::TimePoint m_mod_time
 The modification time for this module when it was created.
 
ArchSpec m_arch
 The architecture for this module.
 
UUID m_uuid
 Each module is assumed to have a unique identifier to help match it up to debug symbols.
 
FileSpec m_file
 The file representation on disk for this module (if there is one).
 
FileSpec m_platform_file
 The path to the module on the platform on which it is being debugged.
 
FileSpec m_remote_install_file
 If set when debugging on remote platforms, this module will be installed at this location.
 
FileSpec m_symfile_spec
 If this path is valid, then this is the file that will be used as the symbol file for this module.
 
ConstString m_object_name
 The name an object within this module that is selected, or empty of the module is represented by m_file.
 
uint64_t m_object_offset = 0
 
llvm::sys::TimePoint m_object_mod_time
 
lldb::DataBufferSP m_data_sp
 DataBuffer containing the module image, if it was provided at construction time.
 
lldb::ObjectFileSP m_objfile_sp
 A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile.
 
std::optional< UnwindTablem_unwind_table
 Table of FuncUnwinders objects created for this Module's functions.
 
lldb::SymbolVendorUP m_symfile_up
 A pointer to the symbol vendor for this module.
 
std::vector< lldb::SymbolVendorUPm_old_symfiles
 If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,.
 
TypeSystemMap m_type_system_map
 A map of any type systems associated with this module.
 
PathMappingList m_source_mappings
 Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are.
 
lldb::SectionListUP m_sections_up
 Unified section list for module that is used by the ObjectFile and ObjectFile instances for the debug info.
 
std::atomic< bool > m_did_load_objfile {false}
 
std::atomic< bool > m_did_load_symfile {false}
 
std::atomic< bool > m_did_set_uuid {false}
 
bool m_file_has_changed: 1
 
bool m_first_file_changed_log: 1
 
StatsDuration m_symtab_parse_time
 See if the module was modified after it was initially opened.
 
StatsDuration m_symtab_index_time
 We store a symbol named index time duration here because we might have an object file and a symbol file which both have symbol tables.
 
std::once_flag m_optimization_warning
 
std::once_flag m_language_warning
 

Private Member Functions

 Module ()
 
 Module (const Module &)=delete
 
const Moduleoperator= (const Module &)=delete
 
void LogMessage (Log *log, const llvm::formatv_object_base &payload)
 
void LogMessageVerboseBacktrace (Log *log, const llvm::formatv_object_base &payload)
 
void ReportWarning (const llvm::formatv_object_base &payload)
 
void ReportError (const llvm::formatv_object_base &payload)
 
void ReportErrorIfModifyDetected (const llvm::formatv_object_base &payload)
 

Friends

class ModuleList
 
class ObjectFile
 
class SymbolFile
 

Detailed Description

A class that describes an executable image and its associated object and symbol files.

The module is designed to be able to select a single slice of an executable image as it would appear on disk and during program execution.

Modules control when and if information is parsed according to which accessors are called. For example the object file (ObjectFile) representation will only be parsed if the object file is requested using the Module::GetObjectFile() is called. The debug symbols will only be parsed if the symbol file (SymbolFile) is requested using the Module::GetSymbolFile() method.

The module will parse more detailed information as more queries are made.

Definition at line 87 of file Module.h.

Constructor & Destructor Documentation

◆ Module() [1/4]

Module::Module ( const FileSpec file_spec,
const ArchSpec arch,
ConstString  object_name = ConstString(),
lldb::offset_t  object_offset = 0,
const llvm::sys::TimePoint<> &  object_mod_time = llvm::sys::TimePoint<>() 
)

Construct with file specification and architecture.

Clients that wish to share modules with other targets should use ModuleList::GetSharedModule().

Parameters
[in]file_specThe file specification for the on disk representation of this executable image.
[in]archThe architecture to set as the current architecture in this module.
[in]object_nameThe name of an object in a module used to extract a module within a module (.a files and modules that contain multiple architectures).
[in]object_offsetThe offset within an existing module used to extract a module within a module (.a files and modules that contain multiple architectures).

Definition at line 235 of file Module.cpp.

References lldb_private::ConstString::AsCString(), GetAllocationModuleCollectionMutex(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::GetLog(), GetModuleCollection(), lldb_private::FileSpec::GetPath(), lldb_private::ConstString::IsEmpty(), LLDB_LOGF, m_arch, m_file, m_object_name, lldb_private::Modules, and lldb_private::Object.

◆ Module() [2/4]

Module::Module ( const ModuleSpec module_spec)

◆ ~Module()

Module::~Module ( )
override

◆ Module() [3/4]

Module::Module ( )
private

Definition at line 257 of file Module.cpp.

References GetAllocationModuleCollectionMutex(), and GetModuleCollection().

Referenced by CreateModuleFromObjectFile().

◆ Module() [4/4]

lldb_private::Module::Module ( const Module )
privatedelete

Member Function Documentation

◆ CalculateSymbolContext()

void Module::CalculateSymbolContext ( SymbolContext sc)
overridevirtual

Reconstruct the object's symbol context into sc.

The object should fill in as much of the SymbolContext as it can so function calls that require a symbol context can be made for the given object.

Parameters
[out]scA symbol context object pointer that gets filled in.
See also
SymbolContextScope

Implements lldb_private::SymbolContextScope.

Definition at line 408 of file Module.cpp.

References lldb_private::SymbolContext::module_sp.

Referenced by SymbolIndicesToSymbolContextList().

◆ CalculateSymbolContextModule()

ModuleSP Module::CalculateSymbolContextModule ( )
overridevirtual

Reimplemented from lldb_private::SymbolContextScope.

Definition at line 412 of file Module.cpp.

◆ CreateModuleFromObjectFile()

template<typename ObjFilePlugin , typename... Args>
static lldb::ModuleSP lldb_private::Module::CreateModuleFromObjectFile ( Args &&...  args)
inlinestatic

Definition at line 133 of file Module.h.

References Module().

◆ Dump()

void Module::Dump ( Stream s)

Dump a description of this object to a Stream.

Dump a description of the contents of this object to the supplied stream s. The dumped content will be only what has been loaded or parsed up to this point at which this function is called, so this is a good way to see what has been parsed in a module.

Parameters
[in]sThe stream to which to dump the object description.

Definition at line 1161 of file Module.cpp.

References lldb_private::ObjectFile::Dump(), lldb_private::ConstString::GetCString(), GetObjectFile(), lldb_private::FileSpec::GetPath(), GetSymbolFile(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_file, m_mutex, m_object_name, and lldb_private::Stream::Printf().

◆ DumpSymbolContext()

void Module::DumpSymbolContext ( Stream s)
overridevirtual

Dump the object's symbol context to the stream s.

The object should dump its symbol context to the stream s. This function is widely used in the DumpDebug and verbose output for lldb objects.

Parameters
[in]sThe stream to which to dump the object's symbol context.
See also
SymbolContextScope

Implements lldb_private::SymbolContextScope.

Definition at line 414 of file Module.cpp.

References lldb_private::Stream::Printf().

◆ FileHasChanged()

bool Module::FileHasChanged ( ) const

◆ FindAddressesForLine()

void Module::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 945 of file Module.cpp.

References lldb_private::Address::CalculateSymbolContextFunction(), lldb_private::AddressResolver::GetAddressRangeAtIndex(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressResolver::GetNumberOfAddresses(), m_file, and lldb_private::AddressResolver::ResolveAddress().

◆ FindCompileUnits()

void Module::FindCompileUnits ( const FileSpec path,
SymbolContextList sc_list 
)

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 function we are looking for.
[out]sc_listA symbol context list that gets filled in with all of the matches.

Definition at line 620 of file Module.cpp.

References lldb_private::SymbolContextList::Append(), lldb_private::SymbolContext::comp_unit, GetCompileUnitAtIndex(), GetNumCompileUnits(), lldb_private::CompileUnit::GetPrimaryFile(), lldb_private::FileSpec::Match(), and lldb_private::SymbolContext::module_sp.

◆ FindFirstSymbolWithNameAndType()

const Symbol * Module::FindFirstSymbolWithNameAndType ( ConstString  name,
lldb::SymbolType  symbol_type = lldb::eSymbolTypeAny 
)

Find a symbol in the object file's symbol table.

Parameters
[in]nameThe name of the symbol that we are looking for.
[in]symbol_typeIf set to eSymbolTypeAny, find a symbol of any type that has a name that matches name. If set to any other valid SymbolType enumeration value, then search only for symbols that match symbol_type.
Returns
Returns a valid symbol pointer if a symbol was found, nullptr otherwise.

Definition at line 1257 of file Module.cpp.

References lldb_private::ConstString::AsCString(), lldb_private::Symtab::eDebugAny, lldb_private::Symtab::eVisibilityAny, GetSymtab(), and LLDB_SCOPED_TIMERF.

◆ FindFunctions() [1/4]

void Module::FindFunctions ( const LookupInfo lookup_info,
const CompilerDeclContext parent_decl_ctx,
const ModuleFunctionSearchOptions options,
SymbolContextList sc_list 
)

Find functions by lookup info.

If the function is an inlined function, it will have a block, representing the inlined function, and the function will be the containing function. If it is not inlined, then the block will be NULL.

Parameters
[in]lookup_infoThe lookup info of the function we are looking for.
[out]sc_listA symbol context list that gets filled in with all of the matches.

Definition at line 824 of file Module.cpp.

References lldb_private::Module::LookupInfo::GetLookupName(), lldb_private::Module::LookupInfo::GetNameTypeMask(), GetSymbolFile(), lldb_private::ModuleFunctionSearchOptions::include_inlines, and lldb_private::ModuleFunctionSearchOptions::include_symbols.

Referenced by lldb_private::SourceManager::GetDefaultFileAndLine(), and LookupFunctionInModule().

◆ FindFunctions() [2/4]

void Module::FindFunctions ( const RegularExpression regex,
const ModuleFunctionSearchOptions options,
SymbolContextList sc_list 
)

◆ FindFunctions() [3/4]

void lldb_private::Module::FindFunctions ( ConstString  name,
const CompilerDeclContext parent_decl_ctx,
lldb::FunctionNameType  name_type_mask,
const ModuleFunctionSearchOptions options,
SymbolContextList sc_list 
)

Find functions by name.

If the function is an inlined function, it will have a block, representing the inlined function, and the function will be the containing function. If it is not inlined, then the block will be NULL.

Parameters
[in]nameThe name of the function we are looking for.
[in]name_type_maskA bit mask of bits that indicate what kind of names should be used when doing the lookup. Bits include fully qualified names, base names, C++ methods, or ObjC selectors. See FunctionNameType for more details.
[out]sc_listA symbol context list that gets filled in with all of the matches.

◆ FindFunctions() [4/4]

void lldb_private::Module::FindFunctions ( llvm::ArrayRef< CompilerContext compiler_ctx,
lldb::FunctionNameType  name_type_mask,
const ModuleFunctionSearchOptions options,
SymbolContextList sc_list 
)

Find functions by compiler context.

◆ FindFunctionSymbols()

void Module::FindFunctionSymbols ( ConstString  name,
uint32_t  name_type_mask,
SymbolContextList sc_list 
)

Find a function symbols in the object file's symbol table.

Parameters
[in]nameThe name of the symbol that we are looking for.
[in]name_type_maskA mask that has one or more bitwise OR'ed values from the lldb::FunctionNameType enumeration type that indicate what kind of names we are looking for.
[out]sc_listA list to append any matching symbol contexts to.

Definition at line 1285 of file Module.cpp.

References lldb_private::ConstString::AsCString(), GetSymtab(), and LLDB_SCOPED_TIMERF.

◆ FindGlobalVariables() [1/2]

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

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.

Definition at line 613 of file Module.cpp.

References lldb_private::SymbolFile::FindGlobalVariables(), and GetSymbolFile().

◆ FindGlobalVariables() [2/2]

void Module::FindGlobalVariables ( ConstString  name,
const CompilerDeclContext parent_decl_ctx,
size_t  max_matches,
VariableList variable_list 
)

Find global and static variables by name.

Parameters
[in]nameThe name of the global or static variable we are looking for.
[in]parent_decl_ctxIf valid, a decl context that results must exist within
[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.

Definition at line 606 of file Module.cpp.

References GetSymbolFile().

◆ FindSourceFile()

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

Finds a source file given a file spec using the module source path remappings (if any).

Tries to resolve orig_spec by checking the module source path remappings. It makes sure the file exists, so this call can be expensive if the remappings are on a network file system, so use this function sparingly (not in a tight debug info parsing loop).

Parameters
[in]orig_specThe original source file path to try and remap.
[out]new_specThe newly remapped filespec that is guaranteed to exist.
Returns
/b true if orig_spec was successfully located and new_spec is filled in with an existing file spec, false otherwise.

Definition at line 1540 of file Module.cpp.

References lldb_private::PathMappingList::FindFile(), m_mutex, and m_source_mappings.

◆ FindSymbolsMatchingRegExAndType()

void Module::FindSymbolsMatchingRegExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
SymbolContextList sc_list,
Mangled::NamePreference  mangling_preference = Mangled::ePreferDemangled 
)

◆ FindSymbolsWithNameAndType()

void Module::FindSymbolsWithNameAndType ( ConstString  name,
lldb::SymbolType  symbol_type,
SymbolContextList sc_list 
)

◆ FindTypes()

void Module::FindTypes ( const TypeQuery query,
TypeResults results 
)

Find types using a type-matching object that contains all search parameters.

See also
lldb_private::TypeQuery
Parameters
[in]queryA type matching object that contains all of the details of the type search.
[in]resultsAny matching types will be populated into the results object using TypeMap::InsertUnique(...).

Definition at line 969 of file Module.cpp.

References GetSymbolFile().

Referenced by lldb_private::ModuleList::FindTypes(), LookupTypeHere(), and LookupTypeInModule().

◆ ForEachTypeSystem()

void Module::ForEachTypeSystem ( llvm::function_ref< bool(lldb::TypeSystemSP)>  callback)

Call callback for each TypeSystem in this Module.

Return true from callback to keep iterating, false to stop iterating.

Definition at line 370 of file Module.cpp.

References lldb_private::TypeSystemMap::ForEach(), and m_type_system_map.

Referenced by lldb_private::DebuggerStats::ReportStatistics().

◆ GetAllocatedModuleAtIndex()

Module * Module::GetAllocatedModuleAtIndex ( size_t  idx)
static

◆ GetAllocationModuleCollectionMutex()

std::recursive_mutex & Module::GetAllocationModuleCollectionMutex ( )
static

◆ GetArchitecture()

const ArchSpec & Module::GetArchitecture ( ) const

◆ GetCacheKey()

std::string Module::GetCacheKey ( )

Get a unique cache key for the current module.

The cache key must be unique for a file on disk and not change if the file is updated. This allows cache data to use this key as a prefix and as files are modified in disk, we will overwrite the cache files. If one file can contain multiple files, like a universal mach-o file or like a BSD archive, the cache key must contain enough information to differentiate these different files.

Definition at line 1627 of file Module.cpp.

References lldb_private::FileSpec::GetFilename(), lldb_private::ArchSpec::GetTriple(), Hash(), m_arch, m_file, and m_object_name.

◆ GetCompileUnitAtIndex()

CompUnitSP Module::GetCompileUnitAtIndex ( size_t  idx)

◆ GetDescription()

void Module::GetDescription ( llvm::raw_ostream &  s,
lldb::DescriptionLevel  level = lldb::eDescriptionLevelFull 
)

◆ GetFileSpec()

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

Get const accessor for the module file specification.

This function returns the file for the module on the host system that is running LLDB. This can differ from the path on the platform since we might be doing remote debugging.

Returns
A const reference to the file specification object.

Definition at line 452 of file Module.h.

References m_file.

Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), lldb_private::TypeSystemClang::CreateInstance(), CommandObjectPlatformProcessLaunch::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::UnwindTable::Dump(), lldb_private::Target::Dump(), DumpCompileUnitLineTable(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), CommandObjectSourceInfo::DumpLinesInSymbolContexts(), DumpTargetInfo(), lldb_private::FormatEntity::Format(), lldb::SBProcess::GetDescription(), lldb_private::Target::GetEntryPointAddress(), lldb::SBTarget::GetExecutable(), GetObjectFile(), lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(), GetSpecificationDescription(), lldb_private::Value::GetValueAsData(), HexagonDYLDRendezvous::HexagonDYLDRendezvous(), lldb_private::Process::LaunchPrivate(), LoadScriptingResourceInTarget(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::ModuleList::LogUUIDAndPaths(), LookupFileAndLineInModule(), LookupFunctionInModule(), LookupSymbolInModule(), LookupTypeHere(), LookupTypeInModule(), CommandObjectTargetModulesList::PrintModule(), lldb_private::DebuggerStats::ReportStatistics(), ReportWarningOptimization(), DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint(), and UUIDsMatch().

◆ GetIndexCache()

DataFileCache * Module::GetIndexCache ( )
static

Get the global index file cache.

LLDB can cache data for a module between runs. This cache directory can be used to stored data that previously was manually created each time you debug. Examples include debug information indexes, symbol tables, symbol table indexes, and more.

Returns
If caching is enabled in the lldb settings, return a pointer to the data file cache. If caching is not enabled, return NULL.

Definition at line 1637 of file Module.cpp.

References lldb_private::ModuleList::GetGlobalModuleListProperties().

Referenced by lldb_private::Symtab::LoadFromCache(), lldb_private::plugin::dwarf::ManualDWARFIndex::LoadFromCache(), lldb_private::Symtab::SaveToCache(), and lldb_private::plugin::dwarf::ManualDWARFIndex::SaveToCache().

◆ GetIsDynamicLinkEditor()

bool Module::GetIsDynamicLinkEditor ( )

◆ GetMemoryObjectFile()

ObjectFile * Module::GetMemoryObjectFile ( const lldb::ProcessSP process_sp,
lldb::addr_t  header_addr,
Status error,
size_t  size_to_read = 512 
)

Load an object file from memory.

If available, the size of the object file in memory may be passed to avoid additional round trips to process memory. If the size is not provided, a default value is used. This value should be large enough to enable the ObjectFile plugins to read the header of the object file without going back to the process.

Returns
The object file loaded from memory or nullptr, if the operation failed (see the error for more information in that case).

Definition at line 293 of file Module.cpp.

References lldb_private::Status::AsCString(), error(), lldb_private::ObjectFile::FindPlugin(), lldb_private::StreamString::GetString(), m_arch, m_did_load_objfile, m_mutex, m_object_name, m_objfile_sp, lldb_private::ArchSpec::MergeFrom(), lldb_private::Stream::Printf(), and lldb_private::ConstString::SetString().

◆ GetModificationTime()

const llvm::sys::TimePoint & lldb_private::Module::GetModificationTime ( ) const
inline

◆ GetMutex()

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

Definition at line 825 of file Module.h.

References m_mutex.

◆ GetNumberAllocatedModules()

size_t Module::GetNumberAllocatedModules ( )
static

◆ GetNumCompileUnits()

size_t Module::GetNumCompileUnits ( )

Get the number of compile units for this module.

Returns
The number of compile units that the symbol vendor plug-in finds.

Definition at line 418 of file Module.cpp.

References GetSymbolFile(), and m_mutex.

Referenced by CommandObjectSourceInfo::DumpFileLinesInModule(), FindCompileUnits(), GetCompileUnitAtIndex(), GetModuleConfig(), and ParseAllDebugSymbols().

◆ GetObjectFile()

ObjectFile * Module::GetObjectFile ( )
virtual

Get the object file representation for the current architecture.

If the object file has not been located or parsed yet, this function will find the best ObjectFile plug-in that can parse Module::m_file.

Returns
If Module::m_file does not exist, or no plug-in was found that can parse the file, or the object file doesn't contain the current architecture in Module::m_arch, nullptr will be returned, else a valid object file interface will be returned. The returned pointer is owned by this object and remains valid as long as the object is around.

Definition at line 1184 of file Module.cpp.

References lldb_private::ObjectFile::FindPlugin(), lldb_private::FileSystem::GetByteSize(), GetFileSpec(), lldb_private::FileSystem::Instance(), LLDB_SCOPED_TIMERF, m_arch, m_data_sp, m_did_load_objfile, m_file, m_mutex, m_object_offset, m_objfile_sp, lldb_private::ArchSpec::MergeFrom(), and ReportError().

Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), ProcessKDP::CanDebug(), SystemRuntimeMacOSX::CreateInstance(), DynamicLoaderMacOS::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), DynamicLoaderStatic::CreateInstance(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::plugin::dwarf::ManualDWARFIndex::Dump(), Dump(), DynamicLoaderFreeBSDKernel::FindKernelAtLoadAddress(), lldb_private::UnwindTable::GetAllowAssemblyEmulationUnwindPlans(), DynamicLoaderHexagonDYLD::GetEntryPoint(), lldb_private::Target::GetEntryPointAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), GetIsDynamicLinkEditor(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex(), GetSectionList(), GetSymbolFile(), GetUUID(), lldb_private::Value::GetValueAsData(), GetVersion(), lldb_private::UnwindTable::Initialize(), is_kernel(), is_kmod(), is_reloc(), IsExecutable(), IsLoadedInTarget(), lldb_private::Target::ModulesDidUnload(), CommandObjectTargetModulesList::PrintModule(), lldb_private::DebuggerStats::ReportStatistics(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), SectionFileAddressesChanged(), SetLoadAddress(), lldb_private::DynamicLoaderDarwin::UnloadModuleSections(), lldb_private::UnwindTable::Update(), and lldb_private::DynamicLoaderDarwin::UpdateImageLoadAddress().

◆ GetObjectModificationTime()

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

Definition at line 492 of file Module.h.

References m_object_mod_time.

Referenced by lldb_private::CacheSignature::CacheSignature().

◆ GetObjectName()

ConstString Module::GetObjectName ( ) const

◆ GetObjectOffset()

uint64_t lldb_private::Module::GetObjectOffset ( ) const
inline

Definition at line 533 of file Module.h.

References m_object_offset.

◆ GetPlatformFileSpec()

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

Get accessor for the module platform file specification.

Platform file refers to the path of the module as it is known on the remote system on which it is being debugged. For local debugging this is always the same as Module::GetFileSpec(). But remote debugging might mention a file "/usr/lib/liba.dylib" which might be locally downloaded and cached. In this case the platform file could be something like: "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The file could also be cached in a local developer kit directory.

Returns
A const reference to the file specification object.

Definition at line 466 of file Module.h.

References m_file, and m_platform_file.

Referenced by lldb::SBTarget::Launch(), MatchesModuleSpec(), lldb::SBProcess::RemoteLaunch(), and DYLDRendezvous::UpdateExecutablePath().

◆ GetRemoteInstallFileSpec()

const FileSpec & lldb_private::Module::GetRemoteInstallFileSpec ( ) const
inline

Definition at line 474 of file Module.h.

References m_remote_install_file.

◆ GetSectionList()

SectionList * Module::GetSectionList ( )
virtual

Get the unified section list for the module.

This is the section list created by the module's object file and any debug info and symbol files created by the symbol vendor.

If the symbol vendor has not been loaded yet, this function will return the section list for the object file.

Returns
Unified module section list.

Definition at line 1224 of file Module.cpp.

References lldb_private::ObjectFile::CreateSections(), GetObjectFile(), GetUnifiedSectionList(), and m_sections_up.

Referenced by lldb_private::breakpad::SymbolFileBreakpad::AddSymbols(), CommandObjectTargetModulesLoad::DoExecute(), DumpModuleSections(), lldb_private::UnwindTable::Initialize(), IsLoadedInTarget(), ResolveFileAddress(), SetSymbolFileFileSpec(), and lldb_private::UnwindTable::Update().

◆ GetSourceMappingList() [1/2]

PathMappingList & lldb_private::Module::GetSourceMappingList ( )
inline

Definition at line 827 of file Module.h.

References m_source_mappings.

◆ GetSourceMappingList() [2/2]

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

Definition at line 829 of file Module.h.

References m_source_mappings.

◆ GetSpecificationDescription()

std::string Module::GetSpecificationDescription ( ) const

Get the module path and object name.

Modules can refer to object files. In this case the specification is simple and would return the path to the file:

"/usr/lib/foo.dylib"

Modules can be .o files inside of a BSD archive (.a file). In this case, the object specification will look like:

"/usr/lib/foo.a(bar.o)"

There are many places where logging wants to log this fully qualified specification, so we centralize this functionality here.

Returns
The object path + object name if there is one.

Definition at line 1037 of file Module.cpp.

References lldb_private::ConstString::GetCString(), GetFileSpec(), and m_object_name.

Referenced by DumpModuleSections(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap().

◆ GetSymbolFile()

SymbolFile * Module::GetSymbolFile ( bool  can_create = true,
Stream feedback_strm = nullptr 
)
virtual

Get the module's symbol file.

If the symbol file has already been loaded, this function returns it. All arguments are ignored. If the symbol file has not been located yet, and the can_create argument is false, the function returns nullptr. If can_create is true, this function will find the best SymbolFile plug-in that can use the current object file. feedback_strm, if not null, is used to report the details of the search process.

Reimplemented in lldb_private::plugin::dwarf::DebugMapModule.

Definition at line 992 of file Module.cpp.

References DebuggersOwningModuleRequestingInterruption(), lldb_private::SymbolVendor::FindPlugin(), GetObjectFile(), LLDB_SCOPED_TIMER, m_did_load_symfile, m_mutex, m_symfile_up, m_unwind_table, and REPORT_INTERRUPTION.

Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CalculateFrameVariableError(), CommandObjectTargetModulesDumpClangAST::DoExecute(), Dump(), DumpModuleSymbolFile(), FindFunctions(), FindGlobalVariables(), FindTypes(), GetCompileUnitAtIndex(), GetNumCompileUnits(), lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(), GetSeparateDebugInfoList(), lldb_private::UnwindTable::GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetSymtab(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::LinkOSOAddress(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), ParseAllDebugSymbols(), PreloadSymbols(), CommandObjectTargetModulesList::PrintModule(), lldb_private::plugin::dwarf::DebugNamesDWARFIndex::ProcessEntry(), lldb_private::DebuggerStats::ReportStatistics(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), SectionFileAddressesChanged(), and SetSymbolFileFileSpec().

◆ GetSymbolFileFileSpec()

const FileSpec & lldb_private::Module::GetSymbolFileFileSpec ( ) const
inline

Definition at line 482 of file Module.h.

References m_symfile_spec.

◆ GetSymtab()

Symtab * Module::GetSymtab ( )

◆ GetSymtabIndexTime()

StatsDuration & lldb_private::Module::GetSymtabIndexTime ( )
inline

Accessor for the symbol table index time metric.

The value is returned as a reference to allow it to be updated by the ElapsedTime RAII object.

Definition at line 881 of file Module.h.

References m_symtab_index_time.

Referenced by lldb_private::DebuggerStats::ReportStatistics().

◆ GetSymtabParseTime()

StatsDuration & lldb_private::Module::GetSymtabParseTime ( )
inline

Accessor for the symbol table parse time metric.

The value is returned as a reference to allow it to be updated by the ElapsedTime RAII object.

Definition at line 875 of file Module.h.

References m_symtab_parse_time.

Referenced by lldb_private::DebuggerStats::ReportStatistics().

◆ GetTypeSystemForLanguage()

llvm::Expected< TypeSystemSP > Module::GetTypeSystemForLanguage ( lldb::LanguageType  language)

◆ GetUnifiedSectionList()

SectionList * Module::GetUnifiedSectionList ( )
protected

Definition at line 1251 of file Module.cpp.

References m_sections_up.

Referenced by GetSectionList().

◆ GetUnwindTable()

UnwindTable & Module::GetUnwindTable ( )

Returns a reference to the UnwindTable for this Module.

The UnwindTable contains FuncUnwinders objects for any function in this Module. If a FuncUnwinders object hasn't been created yet (i.e. the function has yet to be unwound in a stack walk), it will be created when requested. Specifically, we do not create FuncUnwinders objects for functions until they are needed.

Returns
Returns the unwind table for this module. If this object has no associated object file, an empty UnwindTable is returned.

Definition at line 1242 of file Module.cpp.

References lldb_private::SymbolLocator::DownloadSymbolFileAsync(), GetUUID(), m_symfile_spec, and m_unwind_table.

◆ GetUUID()

const lldb_private::UUID & Module::GetUUID ( )

Get a reference to the UUID value contained in this object.

If the executable image file doesn't not have a UUID value built into the file format, an MD5 checksum of the entire file, or slice of the file for the current architecture should be used.

Returns
A const pointer to the internal copy of the UUID value in this module if this module has a valid UUID value, NULL otherwise.

Definition at line 340 of file Module.cpp.

References GetObjectFile(), lldb_private::ObjectFile::GetUUID(), m_did_set_uuid, m_mutex, and m_uuid.

Referenced by lldb_private::CacheSignature::CacheSignature(), DumpModuleUUID(), GetUnwindTable(), lldb_private::ModuleList::LogUUIDAndPaths(), MatchesModuleSpec(), lldb_private::DebuggerStats::ReportStatistics(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), and UUIDsMatch().

◆ GetVersion()

llvm::VersionTuple Module::GetVersion ( )

Definition at line 1598 of file Module.cpp.

References GetObjectFile().

◆ Hash()

uint32_t Module::Hash ( )

Get a unique hash for this module.

The hash should be enough to identify the file on disk and the architecture of the file. If the module represents an object inside of a file, then the hash should include the object name and object offset to ensure a unique hash. Some examples:

  • just a regular object file (mach-o, elf, coff, etc) should create a hash
  • a universal mach-o file that contains to multiple architectures, each architecture slice should have a unique hash even though they come from the same file
  • a .o file inside of a BSD archive. Each .o file will have an object name and object offset that should produce a unique hash. The object offset is needed as BSD archive files can contain multiple .o files that have the same name.

Definition at line 1613 of file Module.cpp.

References lldb_private::FileSpec::GetPath(), lldb_private::ArchSpec::GetTriple(), m_arch, m_file, m_object_mod_time, m_object_name, and m_object_offset.

Referenced by GetCacheKey().

◆ IsExecutable()

bool Module::IsExecutable ( )

Tells whether this module is capable of being the main executable for a process.

Returns
true if it is, false otherwise.

Definition at line 1399 of file Module.cpp.

References GetObjectFile(), and lldb_private::ObjectFile::IsExecutable().

◆ IsLoadedInTarget()

bool Module::IsLoadedInTarget ( Target target)

Tells whether this module has been loaded in the target passed in.

This call doesn't distinguish between whether the module is loaded by the dynamic loader, or by a "target module add" type call.

Parameters
[in]targetThe target to check whether this is loaded in.
Returns
true if it is, false otherwise.

Definition at line 1406 of file Module.cpp.

References GetObjectFile(), lldb_private::SectionList::GetSectionAtIndex(), GetSectionList(), lldb_private::SectionList::GetSize(), and LLDB_INVALID_ADDRESS.

◆ LoadScriptingResourceInTarget()

bool Module::LoadScriptingResourceInTarget ( Target target,
Status error,
Stream feedback_stream 
)

◆ LogMessage() [1/2]

template<typename... Args>
void lldb_private::Module::LogMessage ( Log log,
const char *  format,
Args &&...  args 
)
inline

◆ LogMessage() [2/2]

void Module::LogMessage ( Log log,
const llvm::formatv_object_base &  payload 
)
private

◆ LogMessageVerboseBacktrace() [1/2]

template<typename... Args>
void lldb_private::Module::LogMessageVerboseBacktrace ( Log log,
const char *  format,
Args &&...  args 
)
inline

Definition at line 788 of file Module.h.

References LogMessageVerboseBacktrace().

Referenced by LogMessageVerboseBacktrace().

◆ LogMessageVerboseBacktrace() [2/2]

void Module::LogMessageVerboseBacktrace ( Log log,
const llvm::formatv_object_base &  payload 
)
private

◆ MatchesModuleSpec()

bool Module::MatchesModuleSpec ( const ModuleSpec module_ref)

◆ MergeArchitecture()

bool Module::MergeArchitecture ( const ArchSpec arch_spec)

◆ operator=()

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

◆ ParseAllDebugSymbols()

void Module::ParseAllDebugSymbols ( )

A debugging function that will cause everything in a module to be parsed.

All compile units will be parsed, along with all globals and static variables and all functions for those compile units. All types, scopes, local variables, static variables, global variables, and line tables will be parsed. This can be used prior to dumping a module to see a complete list of the resulting debug information that gets parsed, or as a debug function to ensure that the module can consume all of the debug data the symbol vendor provides.

Definition at line 375 of file Module.cpp.

References lldb_private::SymbolContext::comp_unit, lldb_private::CompileUnit::ForeachFunction(), lldb_private::SymbolContext::function, lldb_private::SymbolFile::GetCompileUnitAtIndex(), GetNumCompileUnits(), GetSymbolFile(), m_mutex, lldb_private::SymbolContext::module_sp, lldb_private::SymbolFile::ParseBlocksRecursive(), lldb_private::SymbolFile::ParseFunctions(), lldb_private::SymbolFile::ParseTypes(), and lldb_private::SymbolFile::ParseVariablesForContext().

◆ PreloadSymbols()

void Module::PreloadSymbols ( )

◆ RegisterXcodeSDK()

void Module::RegisterXcodeSDK ( llvm::StringRef  sdk,
llvm::StringRef  sysroot 
)

This callback will be called by SymbolFile implementations when parsing a compile unit that contains SDK information.

Parameters
sysrootwill be added to the path remapping dictionary.

Definition at line 1557 of file Module.cpp.

References lldb_private::PathMappingList::Append(), m_source_mappings, lldb_private::PathMappingList::Replace(), lldb_private::Debugger::ReportError(), and lldb_private::toString().

◆ RemapSourceFile() [1/2]

bool lldb_private::Module::RemapSourceFile ( const char *  ,
std::string &   
) const
delete

◆ RemapSourceFile() [2/2]

std::optional< std::string > Module::RemapSourceFile ( llvm::StringRef  path) const

Remaps a source file given path into new_path.

Remaps path if any source remappings match. This function does NOT stat the file system so it can be used in tight loops where debug info is being parsed.

Parameters
[in]pathThe original source file path to try and remap.
Returns
The newly remapped filespec that is may or may not exist if path was successfully located.

Definition at line 1550 of file Module.cpp.

References m_mutex, m_source_mappings, and lldb_private::PathMappingList::RemapPath().

◆ ReportError() [1/2]

template<typename... Args>
void lldb_private::Module::ReportError ( const char *  format,
Args &&...  args 
)
inline

Definition at line 800 of file Module.h.

References ReportError().

Referenced by GetObjectFile(), and ReportError().

◆ ReportError() [2/2]

void Module::ReportError ( const llvm::formatv_object_base &  payload)
private

◆ ReportErrorIfModifyDetected() [1/2]

template<typename... Args>
void lldb_private::Module::ReportErrorIfModifyDetected ( const char *  format,
Args &&...  args 
)
inline

◆ ReportErrorIfModifyDetected() [2/2]

void Module::ReportErrorIfModifyDetected ( const llvm::formatv_object_base &  payload)
private

◆ ReportWarning() [1/2]

template<typename... Args>
void lldb_private::Module::ReportWarning ( const char *  format,
Args &&...  args 
)
inline

Definition at line 795 of file Module.h.

References ReportWarning().

Referenced by ReportWarning().

◆ ReportWarning() [2/2]

void Module::ReportWarning ( const llvm::formatv_object_base &  payload)
private

◆ ReportWarningOptimization()

void Module::ReportWarningOptimization ( std::optional< lldb::user_id_t debugger_id)

◆ ReportWarningUnsupportedLanguage()

void Module::ReportWarningUnsupportedLanguage ( lldb::LanguageType  language,
std::optional< lldb::user_id_t debugger_id 
)

◆ ResolveFileAddress()

bool Module::ResolveFileAddress ( lldb::addr_t  vm_addr,
Address so_addr 
)

◆ ResolveSymbolContextForAddress()

uint32_t Module::ResolveSymbolContextForAddress ( const Address so_addr,
lldb::SymbolContextItem  resolve_scope,
SymbolContext sc,
bool  resolve_tail_call_address = false 
)

Resolve the symbol context for the given 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

Definition at line 445 of file Module.cpp.

References lldb_private::SymbolContext::Clear(), lldb_private::Symtab::FindSymbolContainingFileAddress(), lldb_private::Symtab::ForEachSymbolContainingFileAddress(), lldb_private::SymbolContext::GetAddressRange(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::AddressRange::GetByteSize(), lldb_private::Address::GetFileAddress(), lldb_private::Symtab::GetObjectFile(), lldb_private::SymbolFile::GetObjectFile(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), GetSymbolFile(), lldb_private::ObjectFile::GetSymtab(), lldb_private::SymbolFile::GetSymtab(), lldb_private::Address::IsSectionOffset(), lldb_private::ObjectFile::IsStripped(), lldb_private::Symbol::IsSynthetic(), m_mutex, lldb_private::SymbolContext::module_sp, lldb_private::SymbolFile::ResolveSymbolContext(), ResolveSymbolContextForAddress(), lldb_private::SymbolFile::SetLoadDebugInfoEnabled(), lldb_private::Address::Slide(), and lldb_private::SymbolContext::symbol.

Referenced by ResolveSymbolContextForAddress().

◆ ResolveSymbolContextForFilePath()

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

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

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

Definition at line 576 of file Module.cpp.

References ResolveSymbolContextsForFileSpec().

◆ ResolveSymbolContextsForFileSpec()

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

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

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

Definition at line 584 of file Module.cpp.

References lldb_private::FileSpec::GetPath(), lldb_private::SymbolContextList::GetSize(), GetSymbolFile(), LLDB_SCOPED_TIMERF, and m_mutex.

Referenced by DumpCompileUnitLineTable(), LookupFileAndLineInModule(), and ResolveSymbolContextForFilePath().

◆ SectionFileAddressesChanged()

void Module::SectionFileAddressesChanged ( )
virtual

Notify the module that the file addresses for the Sections have been updated.

If the Section file addresses for a module are updated, this method should be called. Any parts of the module, object file, or symbol file that has cached those file addresses must invalidate or update its cache.

Definition at line 1234 of file Module.cpp.

References GetObjectFile(), GetSymbolFile(), and lldb_private::ObjectFile::SectionFileAddressesChanged().

◆ SetArchitecture()

bool Module::SetArchitecture ( const ArchSpec new_arch)
protected

◆ SetFileSpecAndObjectName()

void Module::SetFileSpecAndObjectName ( const FileSpec file,
ConstString  object_name 
)

◆ SetLoadAddress()

bool Module::SetLoadAddress ( Target target,
lldb::addr_t  value,
bool  value_is_offset,
bool &  changed 
)

Set the load address for all sections in a module to be the file address plus slide.

Many times a module will be loaded in a target with a constant offset applied to all top level sections. This function can set the load address for all top level sections to be the section file address + offset.

Parameters
[in]targetThe target in which to apply the section load addresses.
[in]valueif value_is_offset is true, then value is the offset to apply to all file addresses for all top level sections in the object file as each section load address is being set. If value_is_offset is false, then "value" is the new absolute base address for the image.
[in]value_is_offsetIf true, then value is an offset to apply to each file address of each top level section. If false, then value is the image base address that will be used to rigidly slide all loadable sections.
[out]changedIf any section load addresses were changed in target, then changed will be set to true. Else changed will be set to false. This allows this function to be called multiple times on the same module for the same target. If the module hasn't moved, then changed will be false and no module updated notification will need to be sent out.
Returns
/b True if any sections were successfully loaded in target, /b false otherwise.

Definition at line 1497 of file Module.cpp.

References GetObjectFile(), and lldb_private::ObjectFile::SetLoadAddress().

Referenced by CommandObjectTargetModulesLoad::DoExecute().

◆ SetPlatformFileSpec()

void lldb_private::Module::SetPlatformFileSpec ( const FileSpec file)
inline

Definition at line 472 of file Module.h.

References m_platform_file.

◆ SetRemoteInstallFileSpec()

void lldb_private::Module::SetRemoteInstallFileSpec ( const FileSpec file)
inline

Definition at line 478 of file Module.h.

References m_remote_install_file.

◆ SetSymbolFileFileSpec()

void Module::SetSymbolFileFileSpec ( const FileSpec file)

◆ SetUUID()

void Module::SetUUID ( const lldb_private::UUID uuid)
protected

Definition at line 355 of file Module.cpp.

References lldbassert, m_did_set_uuid, m_mutex, and m_uuid.

◆ SymbolIndicesToSymbolContextList()

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

Friends And Related Function Documentation

◆ ModuleList

friend class ModuleList
friend

Definition at line 1073 of file Module.h.

◆ ObjectFile

friend class ObjectFile
friend

Definition at line 1074 of file Module.h.

◆ SymbolFile

friend class SymbolFile
friend

Definition at line 1075 of file Module.h.

Member Data Documentation

◆ m_arch

ArchSpec lldb_private::Module::m_arch
protected

◆ m_data_sp

lldb::DataBufferSP lldb_private::Module::m_data_sp
protected

DataBuffer containing the module image, if it was provided at construction time.

Otherwise the data will be retrieved by mapping one of the FileSpec members above.

Definition at line 1019 of file Module.h.

Referenced by FileHasChanged(), GetObjectFile(), and Module().

◆ m_did_load_objfile

std::atomic<bool> lldb_private::Module::m_did_load_objfile {false}
protected

Definition at line 1045 of file Module.h.

Referenced by GetMemoryObjectFile(), and GetObjectFile().

◆ m_did_load_symfile

std::atomic<bool> lldb_private::Module::m_did_load_symfile {false}
protected

Definition at line 1046 of file Module.h.

Referenced by GetSymbolFile(), and SetSymbolFileFileSpec().

◆ m_did_set_uuid

std::atomic<bool> lldb_private::Module::m_did_set_uuid {false}
protected

Definition at line 1047 of file Module.h.

Referenced by GetUUID(), and SetUUID().

◆ m_file

FileSpec lldb_private::Module::m_file
protected

The file representation on disk for this module (if there is one).

Definition at line 1000 of file Module.h.

Referenced by Dump(), FileHasChanged(), FindAddressesForLine(), GetCacheKey(), GetDescription(), GetFileSpec(), GetObjectFile(), GetPlatformFileSpec(), Hash(), MatchesModuleSpec(), Module(), SetFileSpecAndObjectName(), and ~Module().

◆ m_file_has_changed

bool lldb_private::Module::m_file_has_changed
mutableprotected

Definition at line 1048 of file Module.h.

Referenced by FileHasChanged().

◆ m_first_file_changed_log

bool lldb_private::Module::m_first_file_changed_log
protected

Definition at line 1049 of file Module.h.

Referenced by ReportErrorIfModifyDetected().

◆ m_language_warning

std::once_flag lldb_private::Module::m_language_warning
protected

Definition at line 1061 of file Module.h.

Referenced by ReportWarningUnsupportedLanguage().

◆ m_mod_time

llvm::sys::TimePoint lldb_private::Module::m_mod_time
protected

The modification time for this module when it was created.

Definition at line 995 of file Module.h.

Referenced by FileHasChanged(), GetModificationTime(), Module(), and SetFileSpecAndObjectName().

◆ m_mutex

std::recursive_mutex lldb_private::Module::m_mutex
mutableprotected

◆ m_object_mod_time

llvm::sys::TimePoint lldb_private::Module::m_object_mod_time
protected

Definition at line 1014 of file Module.h.

Referenced by GetObjectModificationTime(), Hash(), and Module().

◆ m_object_name

ConstString lldb_private::Module::m_object_name
protected

The name an object within this module that is selected, or empty of the module is represented by m_file.

Definition at line 1010 of file Module.h.

Referenced by Dump(), GetCacheKey(), GetDescription(), GetMemoryObjectFile(), GetObjectName(), GetSpecificationDescription(), Hash(), Module(), SetFileSpecAndObjectName(), and ~Module().

◆ m_object_offset

uint64_t lldb_private::Module::m_object_offset = 0
protected

Definition at line 1013 of file Module.h.

Referenced by GetObjectFile(), GetObjectOffset(), Hash(), and Module().

◆ m_objfile_sp

lldb::ObjectFileSP lldb_private::Module::m_objfile_sp
protected

A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile.

Definition at line 1021 of file Module.h.

Referenced by GetMemoryObjectFile(), GetObjectFile(), SetSymbolFileFileSpec(), and ~Module().

◆ m_old_symfiles

std::vector<lldb::SymbolVendorUP> lldb_private::Module::m_old_symfiles
protected

If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,.

we need to keep all old symbol files around in case anyone has type references to them

Definition at line 1030 of file Module.h.

Referenced by SetSymbolFileFileSpec().

◆ m_optimization_warning

std::once_flag lldb_private::Module::m_optimization_warning
protected

Definition at line 1060 of file Module.h.

Referenced by ReportWarningOptimization().

◆ m_platform_file

FileSpec lldb_private::Module::m_platform_file
protected

The path to the module on the platform on which it is being debugged.

Definition at line 1002 of file Module.h.

Referenced by GetPlatformFileSpec(), MatchesModuleSpec(), Module(), and SetPlatformFileSpec().

◆ m_remote_install_file

FileSpec lldb_private::Module::m_remote_install_file
protected

If set when debugging on remote platforms, this module will be installed at this location.

Definition at line 1004 of file Module.h.

Referenced by GetRemoteInstallFileSpec(), and SetRemoteInstallFileSpec().

◆ m_sections_up

lldb::SectionListUP lldb_private::Module::m_sections_up
protected

Unified section list for module that is used by the ObjectFile and ObjectFile instances for the debug info.

Definition at line 1041 of file Module.h.

Referenced by GetSectionList(), GetUnifiedSectionList(), and ~Module().

◆ m_source_mappings

PathMappingList lldb_private::Module::m_source_mappings
protected
Initial value:
=
PathMappingList GetSymlinkMappings() const
Definition: ModuleList.cpp:180
static ModuleListProperties & GetGlobalModuleListProperties()
Definition: ModuleList.cpp:763

Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are.

Definition at line 1038 of file Module.h.

Referenced by FindSourceFile(), GetSourceMappingList(), RegisterXcodeSDK(), and RemapSourceFile().

◆ m_symfile_spec

FileSpec lldb_private::Module::m_symfile_spec
protected

If this path is valid, then this is the file that will be used as the symbol file for this module.

Definition at line 1007 of file Module.h.

Referenced by GetSymbolFileFileSpec(), GetUnwindTable(), Module(), and SetSymbolFileFileSpec().

◆ m_symfile_up

lldb::SymbolVendorUP lldb_private::Module::m_symfile_up
protected

A pointer to the symbol vendor for this module.

Definition at line 1028 of file Module.h.

Referenced by GetSymbolFile(), SetSymbolFileFileSpec(), and ~Module().

◆ m_symtab_index_time

StatsDuration lldb_private::Module::m_symtab_index_time
protected

We store a symbol named index time duration here because we might have an object file and a symbol file which both have symbol tables.

The parse time for the symbol tables can be aggregated here.

Definition at line 1058 of file Module.h.

Referenced by GetSymtabIndexTime().

◆ m_symtab_parse_time

StatsDuration lldb_private::Module::m_symtab_parse_time
protected

See if the module was modified after it was initially opened.

We store a symbol table parse time duration here because we might have an object file and a symbol file which both have symbol tables. The parse time for the symbol tables can be aggregated here.

Definition at line 1054 of file Module.h.

Referenced by GetSymtabParseTime().

◆ m_type_system_map

TypeSystemMap lldb_private::Module::m_type_system_map
protected

A map of any type systems associated with this module.

Definition at line 1034 of file Module.h.

Referenced by ForEachTypeSystem(), and GetTypeSystemForLanguage().

◆ m_unwind_table

std::optional<UnwindTable> lldb_private::Module::m_unwind_table
protected

Table of FuncUnwinders objects created for this Module's functions.

Definition at line 1024 of file Module.h.

Referenced by GetSymbolFile(), and GetUnwindTable().

◆ m_uuid

UUID lldb_private::Module::m_uuid
protected

Each module is assumed to have a unique identifier to help match it up to debug symbols.

Definition at line 998 of file Module.h.

Referenced by GetUUID(), and SetUUID().


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