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

#include "lldb/Core/Module.h"

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

Classes

class  LookupInfo
 

Public Member Functions

 Module (const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name=nullptr, lldb::offset_t object_offset=0, const llvm::sys::TimePoint<> &object_mod_time=llvm::sys::TimePoint<>())
 Construct with file specification and architecture. More...
 
 Module (const ModuleSpec &module_spec)
 
 ~Module () override
 Destructor. More...
 
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. More...
 
void CalculateSymbolContext (SymbolContext *sc) override
 Reconstruct the object's symbol context into sc. More...
 
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. More...
 
void Dump (Stream *s)
 Dump a description of this object to a Stream. More...
 
void DumpSymbolContext (Stream *s) override
 Dump the object's symbol context to the stream s. More...
 
const SymbolFindFirstSymbolWithNameAndType (ConstString name, lldb::SymbolType symbol_type=lldb::eSymbolTypeAny)
 Find a symbol in the object file's symbol table. More...
 
void FindSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
 
void FindSymbolsMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
 
void FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
 Find a function symbols in the object file's symbol table. More...
 
void FindCompileUnits (const FileSpec &path, SymbolContextList &sc_list)
 Find compile units by partial or full path. More...
 
void FindFunctions (ConstString name, const CompilerDeclContext &parent_decl_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by name. More...
 
void FindFunctions (const RegularExpression &regex, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list)
 Find functions by name. More...
 
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...
 
void FindGlobalVariables (ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, VariableList &variable_list)
 Find global and static variables by name. More...
 
void FindGlobalVariables (const RegularExpression &regex, size_t max_matches, VariableList &variable_list)
 Find global and static variables by regular expression. More...
 
void FindTypes (ConstString type_name, bool exact_match, size_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeList &types)
 Find types by name. More...
 
void FindTypes (llvm::ArrayRef< CompilerContext > pattern, LanguageSet languages, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeMap &types)
 Find types by name. More...
 
lldb::TypeSP FindFirstType (const SymbolContext &sc, ConstString type_name, bool exact_match)
 
void FindTypesInNamespace (ConstString type_name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, TypeList &type_list)
 Find types by name that are in a namespace. More...
 
const ArchSpecGetArchitecture () const
 Get const accessor for the module architecture. More...
 
const FileSpecGetFileSpec () const
 Get const accessor for the module file specification. More...
 
const FileSpecGetPlatformFileSpec () const
 Get accessor for the module platform file specification. More...
 
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. More...
 
bool IsExecutable ()
 Tells whether this module is capable of being the main executable for a process. More...
 
bool IsLoadedInTarget (Target *target)
 Tells whether this module has been loaded in the target passed in. More...
 
bool LoadScriptingResourceInTarget (Target *target, Status &error, Stream *feedback_stream=nullptr)
 
size_t GetNumCompileUnits ()
 Get the number of compile units for this module. More...
 
lldb::CompUnitSP GetCompileUnitAtIndex (size_t idx)
 
ConstString GetObjectName () const
 
uint64_t GetObjectOffset () const
 
virtual ObjectFileGetObjectFile ()
 Get the object file representation for the current architecture. More...
 
virtual SectionListGetSectionList ()
 Get the unified section list for the module. More...
 
virtual void SectionFileAddressesChanged ()
 Notify the module that the file addresses for the Sections have been updated. More...
 
UnwindTableGetUnwindTable ()
 Returns a reference to the UnwindTable for this Module. More...
 
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. More...
 
virtual SymbolFileGetSymbolFile (bool can_create=true, Stream *feedback_strm=nullptr)
 Get the module's symbol file. More...
 
SymtabGetSymtab ()
 
const lldb_private::UUIDGetUUID ()
 Get a reference to the UUID value contained in this object. More...
 
void ParseAllDebugSymbols ()
 A debugging function that will cause everything in a module to be parsed. More...
 
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. More...
 
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. More...
 
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. More...
 
void SetFileSpecAndObjectName (const FileSpec &file, ConstString object_name)
 
bool GetIsDynamicLinkEditor ()
 
llvm::Expected< TypeSystem & > GetTypeSystemForLanguage (lldb::LanguageType language)
 
void LogMessage (Log *log, const char *format,...) __attribute__((format(printf
 
void void LogMessageVerboseBacktrace (Log *log, const char *format,...) __attribute__((format(printf
 
void void void ReportWarning (const char *format,...) __attribute__((format(printf
 
void void void void ReportError (const char *format,...) __attribute__((format(printf
 
void void void void void ReportErrorIfModifyDetected (const char *format,...) __attribute__((format(printf
 
void void void void void 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). More...
 
llvm::Optional< std::stringRemapSourceFile (llvm::StringRef path) const
 Remaps a source file given path into new_path. More...
 
bool RemapSourceFile (const char *, std::string &) const =delete
 
bool MergeArchitecture (const ArchSpec &arch_spec)
 Update the ArchSpec to a more specific variant. More...
 
StatsDurationGetSymtabParseTime ()
 Accessor for the symbol table parse time metric. More...
 
StatsDurationGetSymtabIndexTime ()
 Accessor for the symbol table index time metric. More...
 
- Public Member Functions inherited from lldb_private::SymbolContextScope
virtual ~SymbolContextScope ()=default
 
virtual CompileUnitCalculateSymbolContextCompileUnit ()
 
virtual FunctionCalculateSymbolContextFunction ()
 
virtual BlockCalculateSymbolContextBlock ()
 
virtual SymbolCalculateSymbolContextSymbol ()
 

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)
 

Protected Member Functions

uint32_t ResolveSymbolContextForAddress (lldb::addr_t vm_addr, bool vm_addr_is_file_addr, lldb::SymbolContextItem resolve_scope, Address &so_addr, SymbolContext &sc)
 Resolve a file or load virtual address. More...
 
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. More...
 
llvm::sys::TimePoint m_mod_time
 The modification time for this module when it was created. More...
 
ArchSpec m_arch
 The architecture for this module. More...
 
UUID m_uuid
 Each module is assumed to have a unique identifier to help match it up to debug symbols. More...
 
FileSpec m_file
 The file representation on disk for this module (if there is one). More...
 
FileSpec m_platform_file
 The path to the module on the platform on which it is being debugged. More...
 
FileSpec m_remote_install_file
 If set when debugging on remote platforms, this module will be installed at this location. More...
 
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. More...
 
ConstString m_object_name
 The name an object within this module that is selected, or empty of the module is represented by m_file. More...
 
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. More...
 
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. More...
 
llvm::Optional< UnwindTablem_unwind_table
 Table of FuncUnwinders objects created for this Module's functions. More...
 
lldb::SymbolVendorUP m_symfile_up
 A pointer to the symbol vendor for this module. More...
 
std::vector< lldb::SymbolVendorUP > m_old_symfiles
 If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,. More...
 
TypeSystemMap m_type_system_map
 A map of any type systems associated with this module. More...
 
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. More...
 
lldb::SectionListUP m_sections_up
 Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info. More...
 
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 {0.0}
 See if the module was modified after it was initially opened. More...
 
StatsDuration m_symtab_index_time {0.0}
 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. More...
 

Private Member Functions

 Module ()
 
void FindTypes_Impl (ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, llvm::DenseSet< lldb_private::SymbolFile * > &searched_symbol_files, TypeMap &types)
 
 Module (const Module &)=delete
 
const Moduleoperator= (const Module &)=delete
 

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 85 of file Module.h.

Constructor & Destructor Documentation

◆ Module() [1/4]

Module::Module ( const FileSpec file_spec,
const ArchSpec arch,
const ConstString object_name = nullptr,
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 233 of file Module.cpp.

References lldb_private::ConstString::AsCString(), GetAllocationModuleCollectionMutex(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::GetLogIfAnyCategoriesSet(), GetModuleCollection(), lldb_private::FileSpec::GetPath(), lldb_private::ConstString::IsEmpty(), LIBLLDB_LOG_MODULES, LIBLLDB_LOG_OBJECT, LLDB_LOGF, m_arch, m_file, and m_object_name.

◆ Module() [2/4]

Module::Module ( const ModuleSpec module_spec)

◆ ~Module()

Module::~Module ( )
override

◆ Module() [3/4]

Module::Module ( )
private

Definition at line 260 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 131 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 1214 of file Module.cpp.

References lldb_private::ObjectFile::Dump(), lldb_private::SymbolFile::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 914 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 622 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 1306 of file Module.cpp.

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

◆ FindFirstType()

lldb::TypeSP Module::FindFirstType ( const SymbolContext sc,
ConstString  type_name,
bool  exact_match 
)

◆ FindFunctions() [1/2]

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

◆ FindFunctions() [2/2]

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 compile unit 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.

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

◆ 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 1334 of file Module.cpp.

References lldb_private::ConstString::AsCString(), lldb_private::Symtab::FindFunctionSymbols(), 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 615 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 608 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 1597 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 
)

◆ FindSymbolsWithNameAndType()

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

◆ FindTypes() [1/2]

void Module::FindTypes ( ConstString  type_name,
bool  exact_match,
size_t  max_matches,
llvm::DenseSet< lldb_private::SymbolFile * > &  searched_symbol_files,
TypeList types 
)

Find types by name.

Type lookups in modules go through the SymbolFile. The SymbolFile needs to be able to lookup types by basename and not the fully qualified typename. This allows the type accelerator tables to stay small, even with heavily templatized C++. The type search will then narrow down the search results. If "exact_match" is true, then the type search will only match exact type name matches. If "exact_match" is false, the type will match as long as the base typename matches and as long as any immediate containing namespaces/class scopes that are specified match. So to search for a type "d" in "b::c", the name "b::c::d" can be specified and it will match any class/namespace "b" which contains a class/namespace "c" which contains type "d". We do this to allow users to not always have to specify complete scoping on all expressions, but it also allows for exact matching when required.

Parameters
[in]type_nameThe name of the type we are looking for that is a fully or partially qualified type name.
[in]exact_matchIf true, type_name is fully qualified and must match exactly. If false, type_name is a partially qualified name where the leading namespaces or classes can be omitted to make finding types that a user may type easier.
[out]typesA type list gets populated with any matches.

Definition at line 972 of file Module.cpp.

References lldb_private::ConstString::AsCString(), FindTypes_Impl(), lldb_private::ConstString::GetCString(), lldb_private::TypeMap::GetSize(), lldb_private::Type::GetTypeScopeAndBasename(), lldb_private::SymbolContext::module_sp, lldb_private::TypeMap::RemoveMismatchedTypes(), lldb_private::SymbolContext::SortTypeList(), and string().

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

◆ FindTypes() [2/2]

void Module::FindTypes ( llvm::ArrayRef< CompilerContext pattern,
LanguageSet  languages,
llvm::DenseSet< lldb_private::SymbolFile * > &  searched_symbol_files,
TypeMap types 
)

Find types by name.

This behaves like the other FindTypes method but allows to specify a DeclContext and a language for the type being searched for.

Parameters
searched_symbol_filesPrevents one file from being visited multiple times.

Definition at line 1025 of file Module.cpp.

References lldb_private::SymbolFile::FindTypes(), GetSymbolFile(), and LLDB_SCOPED_TIMER.

◆ FindTypes_Impl()

void Module::FindTypes_Impl ( ConstString  name,
const CompilerDeclContext parent_decl_ctx,
size_t  max_matches,
llvm::DenseSet< lldb_private::SymbolFile * > &  searched_symbol_files,
TypeMap types 
)
private

Definition at line 938 of file Module.cpp.

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

Referenced by FindTypes(), and FindTypesInNamespace().

◆ FindTypesInNamespace()

void Module::FindTypesInNamespace ( ConstString  type_name,
const CompilerDeclContext parent_decl_ctx,
size_t  max_matches,
TypeList type_list 
)

Find types by name that are in a namespace.

This function is used by the expression parser when searches need to happen in an exact namespace scope.

Parameters
[in]type_nameThe name of a type within a namespace that should not include any qualifying namespaces (just a type basename).
[out]type_listA type list gets populated with any matches.

Definition at line 948 of file Module.cpp.

References FindTypes_Impl(), lldb_private::TypeMap::GetSize(), lldb_private::SymbolContext::module_sp, and lldb_private::SymbolContext::SortTypeList().

◆ GetAllocatedModuleAtIndex()

Module * Module::GetAllocatedModuleAtIndex ( size_t  idx)
static

Definition at line 118 of file Module.cpp.

References GetModuleCollection().

◆ GetAllocationModuleCollectionMutex()

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

Definition at line 100 of file Module.cpp.

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

◆ GetArchitecture()

const ArchSpec & Module::GetArchitecture ( ) const

◆ 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 477 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(), GetSpecificationDescription(), lldb_private::Value::GetValueAsData(), HexagonDYLDRendezvous::HexagonDYLDRendezvous(), lldb_private::Process::Launch(), LoadScriptingResourceInTarget(), PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::ModuleList::LogUUIDAndPaths(), LookupFileAndLineInModule(), LookupFunctionInModule(), LookupSymbolInModule(), LookupTypeHere(), LookupTypeInModule(), CommandObjectTargetModulesList::PrintModule(), lldb_private::DebuggerStats::ReportStatistics(), DynamicLoaderPOSIXDYLD::SetRendezvousBreakpoint(), and UUIDsMatch().

◆ 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 298 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

Definition at line 513 of file Module.h.

References m_mod_time.

Referenced by CommandObjectTargetModulesList::PrintModule().

◆ GetMutex()

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

Definition at line 828 of file Module.h.

References m_mutex.

◆ GetNumberAllocatedModules()

size_t Module::GetNumberAllocatedModules ( )
static

Definition at line 112 of file Module.cpp.

References GetModuleCollection().

◆ 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(), LLDB_SCOPED_TIMERF, 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 1237 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 ProcessKDP::CanDebug(), lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), DynamicLoaderStatic::CreateInstance(), DynamicLoaderDarwinKernel::CreateInstance(), DynamicLoaderMacOS::CreateInstance(), SystemRuntimeMacOSX::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), CommandObjectTargetModulesLoad::DoExecute(), Dump(), lldb_private::UnwindTable::GetAllowAssemblyEmulationUnwindPlans(), DynamicLoaderHexagonDYLD::GetEntryPoint(), lldb_private::Target::GetEntryPointAddress(), SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), GetIsDynamicLinkEditor(), SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo(), SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex(), GetSectionList(), GetSymbolFile(), GetUUID(), lldb_private::Value::GetValueAsData(), GetVersion(), lldb_private::UnwindTable::Initialize(), IsExecutable(), IsLoadedInTarget(), CommandObjectTargetModulesList::PrintModule(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), SectionFileAddressesChanged(), SetLoadAddress(), lldb_private::DynamicLoaderDarwin::UnloadModuleSections(), and lldb_private::DynamicLoaderDarwin::UpdateImageLoadAddress().

◆ GetObjectModificationTime()

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

Definition at line 517 of file Module.h.

References m_object_mod_time.

◆ GetObjectName()

ConstString Module::GetObjectName ( ) const

◆ GetObjectOffset()

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

Definition at line 558 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 491 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 499 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 1276 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(), and SetSymbolFileFileSpec().

◆ GetSourceMappingList() [1/2]

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

Definition at line 830 of file Module.h.

References m_source_mappings.

◆ GetSourceMappingList() [2/2]

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

Definition at line 832 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 1067 of file Module.cpp.

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

Referenced by DumpModuleSections(), and 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 DebugMapModule.

Definition at line 1034 of file Module.cpp.

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

Referenced by CommandObjectTargetModulesDumpClangAST::DoExecute(), Dump(), DumpModuleSymbolFile(), FindFunctions(), FindGlobalVariables(), FindTypes(), FindTypes_Impl(), GetCompileUnitAtIndex(), GetNumCompileUnits(), lldb_private::UnwindTable::GetSymbolFile(), GetSymtab(), SymbolFileDWARFDebugMap::LinkOSOAddress(), PlatformDarwin::LocateExecutableScriptingResources(), ParseAllDebugSymbols(), PreloadSymbols(), CommandObjectTargetModulesList::PrintModule(), lldb_private::DebuggerStats::ReportStatistics(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), SectionFileAddressesChanged(), and SetSymbolFileFileSpec().

◆ GetSymbolFileFileSpec()

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

Definition at line 507 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 884 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 878 of file Module.h.

References m_symtab_parse_time.

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

◆ GetTypeSystemForLanguage()

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

◆ GetUnifiedSectionList()

SectionList * Module::GetUnifiedSectionList ( )
protected

Definition at line 1300 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 1294 of file Module.cpp.

References 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 345 of file Module.cpp.

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

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

◆ GetVersion()

llvm::VersionTuple Module::GetVersion ( )

Definition at line 1646 of file Module.cpp.

References GetObjectFile().

◆ 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 1455 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 1462 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 = nullptr 
)

◆ LogMessage()

void Module::LogMessage ( Log log,
const char *  format,
  ... 
)

◆ LogMessageVerboseBacktrace()

void Module::LogMessageVerboseBacktrace ( Log log,
const char *  format,
  ... 
)

◆ 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 1614 of file Module.cpp.

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

◆ RemapSourceFile() [1/2]

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

◆ RemapSourceFile() [2/2]

llvm::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 1607 of file Module.cpp.

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

◆ ReportError()

void Module::ReportError ( const char *  format,
  ... 
)

◆ ReportErrorIfModifyDetected()

void Module::ReportErrorIfModifyDetected ( const char *  format,
  ... 
)

◆ ReportWarning()

void Module::ReportWarning ( const char *  format,
  ... 
)

◆ ResolveFileAddress()

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

◆ ResolveSymbolContextForAddress() [1/2]

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 447 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::SymbolFile::GetSymtab(), lldb_private::ObjectFile::GetSymtab(), lldb_private::Address::IsSectionOffset(), lldb_private::ObjectFile::IsStripped(), lldb_private::Symbol::IsSynthetic(), m_mutex, lldb_private::SymbolContext::module_sp, lldb_private::SymbolFile::ResolveSymbolContext(), lldb_private::Address::Slide(), and lldb_private::SymbolContext::symbol.

◆ ResolveSymbolContextForAddress() [2/2]

uint32_t lldb_private::Module::ResolveSymbolContextForAddress ( lldb::addr_t  vm_addr,
bool  vm_addr_is_file_addr,
lldb::SymbolContextItem  resolve_scope,
Address so_addr,
SymbolContext sc 
)
protected

Resolve a file or load virtual address.

Tries to resolve vm_addr as a file address (if vm_addr_is_file_addr is true) or as a load address if vm_addr_is_file_addr is false) in the symbol vendor. resolve_scope indicates what clients wish to resolve and can be used to limit the scope of what is parsed.

Parameters
[in]vm_addrThe load virtual address to resolve.
[in]vm_addr_is_file_addrIf true, vm_addr is a file address, else vm_addr if a load address.
[in]resolve_scopeThe scope that should be resolved (see SymbolContext::Scope).
[out]so_addrThe section offset based address that got resolved if any bits are returned.
[out]scin the resolve_scope pertains to a member in the sc.
Returns
A integer that contains SymbolContext::Scope bits set for each item that was successfully resolved.
See also
SymbolContext::Scope

◆ 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 578 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 586 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 1286 of file Module.cpp.

References GetObjectFile(), GetSymbolFile(), lldb_private::SymbolFile::SectionFileAddressesChanged(), 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 1554 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 497 of file Module.h.

References m_platform_file.

◆ SetRemoteInstallFileSpec()

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

Definition at line 503 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 360 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 1067 of file Module.h.

◆ ObjectFile

friend class ObjectFile
friend

Definition at line 1068 of file Module.h.

◆ SymbolFile

friend class SymbolFile
friend

Definition at line 1069 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 979 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 1005 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 1006 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 1007 of file Module.h.

Referenced by GetUUID(), and SetUUID().

◆ m_file

FileSpec lldb_private::Module::m_file
protected

◆ m_file_has_changed

bool lldb_private::Module::m_file_has_changed
mutableprotected

Definition at line 1008 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 1009 of file Module.h.

Referenced by ReportErrorIfModifyDetected().

◆ 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 955 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 974 of file Module.h.

Referenced by GetObjectModificationTime(), 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 970 of file Module.h.

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

◆ m_object_offset

uint64_t lldb_private::Module::m_object_offset = 0
protected

Definition at line 973 of file Module.h.

Referenced by GetObjectFile(), GetObjectOffset(), 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 981 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 990 of file Module.h.

Referenced by SetSymbolFileFileSpec().

◆ 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 962 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 964 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 and ObjectFile instances for the debug info.

Definition at line 1001 of file Module.h.

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

◆ m_source_mappings

PathMappingList lldb_private::Module::m_source_mappings
protected
Initial value:

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 998 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 967 of file Module.h.

Referenced by GetSymbolFileFileSpec(), 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 988 of file Module.h.

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

◆ m_symtab_index_time

StatsDuration lldb_private::Module::m_symtab_index_time {0.0}
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 1018 of file Module.h.

Referenced by GetSymtabIndexTime().

◆ m_symtab_parse_time

StatsDuration lldb_private::Module::m_symtab_parse_time {0.0}
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 1014 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 994 of file Module.h.

Referenced by GetTypeSystemForLanguage().

◆ m_unwind_table

llvm::Optional<UnwindTable> lldb_private::Module::m_unwind_table
protected

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

Definition at line 984 of file Module.h.

Referenced by GetUnwindTable(), and SetSymbolFileFileSpec().

◆ 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 958 of file Module.h.

Referenced by GetUUID(), and SetUUID().


The documentation for this class was generated from the following files:
lldb_private::ModuleList::GetGlobalModuleListProperties
static ModuleListProperties & GetGlobalModuleListProperties()
Definition: ModuleList.cpp:701
lldb_private::ModuleListProperties::GetSymlinkMappings
PathMappingList GetSymlinkMappings() const
Definition: ModuleList.cpp:129