LLDB  mainline
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | 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]
Collaboration diagram for lldb_private::Module:
Collaboration graph
[legend]

Classes

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

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 (Stream *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...
 
size_t FindSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
 
size_t FindSymbolsMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list)
 
size_t FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list)
 Find a function symbols in the object file's symbol table. More...
 
size_t FindCompileUnits (const FileSpec &path, bool append, SymbolContextList &sc_list)
 Find compile units by partial or full path. More...
 
size_t FindFunctions (ConstString name, const CompilerDeclContext *parent_decl_ctx, lldb::FunctionNameType name_type_mask, bool symbols_ok, bool inlines_ok, bool append, SymbolContextList &sc_list)
 Find functions by name. More...
 
size_t FindFunctions (const RegularExpression &regex, bool symbols_ok, bool inlines_ok, bool append, 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...
 
size_t FindGlobalVariables (ConstString name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, VariableList &variable_list)
 Find global and static variables by name. More...
 
size_t FindGlobalVariables (const RegularExpression &regex, size_t max_matches, VariableList &variable_list)
 Find global and static variables by regular expression. More...
 
size_t 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...
 
lldb::TypeSP FindFirstType (const SymbolContext &sc, ConstString type_name, bool exact_match)
 
size_t 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 SetObjectModificationTime (const llvm::sys::TimePoint<> &mod_time)
 
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 SymbolVendorGetSymbolVendor (bool can_create=true, lldb_private::Stream *feedback_strm=nullptr)
 Get the symbol vendor interface for the current architecture. More...
 
TypeListGetTypeList ()
 Get accessor the type list for this module. More...
 
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 ()
 
TypeSystemGetTypeSystemForLanguage (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...
 
bool RemapSourceFile (llvm::StringRef path, std::string &new_path) const
 Remaps a source file given path into new_path. More...
 
bool RemapSourceFile (const char *, std::string &) const =delete
 
- 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)
 See if the module was modified after it was initially opened. 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
 
llvm::sys::TimePoint m_object_mod_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. 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_symbol_vendor {false}
 
std::atomic< bool > m_did_set_uuid {false}
 
bool m_file_has_changed: 1
 
bool m_first_file_changed_log: 1
 

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 vendor (SymbolVendor) is requested using the Module::GetSymbolVendor() is called.

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

Definition at line 109 of file Module.h.

Constructor & Destructor Documentation

◆ Module() [1/2]

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 218 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, m_arch, m_file, m_file_has_changed, m_first_file_changed_log, m_object_name, m_object_offset, and lldb_private::Log::Printf().

◆ Module() [2/2]

Module::Module ( const ModuleSpec module_spec)

◆ ~Module()

Module::~Module ( )
override

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

References lldb_private::SymbolContext::module_sp.

Referenced by CreateModuleFromObjectFile(), and SymbolIndicesToSymbolContextList().

◆ CalculateSymbolContextModule()

ModuleSP Module::CalculateSymbolContextModule ( )
overridevirtual

Reimplemented from lldb_private::SymbolContextScope.

Definition at line 396 of file Module.cpp.

Referenced by CreateModuleFromObjectFile().

◆ CreateModuleFromObjectFile()

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

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

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

Referenced by CreateModuleFromObjectFile().

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

References lldb_private::Stream::Printf().

Referenced by CreateModuleFromObjectFile().

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

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

Referenced by CreateModuleFromObjectFile().

◆ FindCompileUnits()

size_t Module::FindCompileUnits ( const FileSpec path,
bool  append,
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.
[in]appendIf true, then append any compile units that were found to sc_list. If false, then the sc_list is cleared and the contents of sc_list are replaced.
[out]sc_listA symbol context list that gets filled in with all of the matches.
Returns
The number of matches added to sc_list.

Definition at line 621 of file Module.cpp.

References lldb_private::SymbolContextList::Append(), basename(), lldb_private::SymbolContextList::Clear(), lldb_private::SymbolContext::comp_unit, lldb::eLanguageTypeUnknown, lldb_private::FileSpec::Equal(), lldb_private::CPlusPlusLanguage::ExtractContextAndIdentifier(), lldb_private::CPlusPlusLanguage::MethodName::GetBasename(), GetCompileUnitAtIndex(), lldb_private::ConstString::GetCString(), lldb_private::FileSpec::GetDirectory(), GetNumCompileUnits(), lldb_private::CPlusPlusLanguage::MethodName::GetQualifiers(), lldb_private::SymbolContextList::GetSize(), lldb_private::CPlusPlusLanguage::IsCPPMangledName(), lldb_private::ObjCLanguage::IsPossibleObjCMethodName(), lldb_private::ObjCLanguage::IsPossibleObjCSelector(), lldb_private::CPlusPlusLanguage::MethodName::IsValid(), lldb_private::Language::LanguageIsC(), lldb_private::Language::LanguageIsObjC(), lldb_private::Module::LookupInfo::LookupInfo(), and lldb_private::SymbolContext::module_sp.

Referenced by CreateModuleFromObjectFile().

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

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

Referenced by lldb_private::MemoryHistoryASan::CreateInstance(), and CreateModuleFromObjectFile().

◆ FindFirstType()

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

Definition at line 979 of file Module.cpp.

References FindTypes(), and lldb_private::TypeList::GetTypeAtIndex().

Referenced by CreateModuleFromObjectFile().

◆ FindFunctions() [1/2]

size_t lldb_private::Module::FindFunctions ( ConstString  name,
const CompilerDeclContext parent_decl_ctx,
lldb::FunctionNameType  name_type_mask,
bool  symbols_ok,
bool  inlines_ok,
bool  append,
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]namespace_declIf valid, a namespace to search in.
[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.
[in]appendIf true, any matches will be appended to sc_list, else matches replace the contents of sc_list.
[out]sc_listA symbol context list that gets filled in with all of the matches.
Returns
The number of matches added to sc_list.

Referenced by CreateModuleFromObjectFile(), lldb_private::Disassembler::Disassemble(), lldb_private::SourceManager::GetDefaultFileAndLine(), LookupFunctionInModule(), and lldb_private::Module::LookupInfo::Prune().

◆ FindFunctions() [2/2]

size_t Module::FindFunctions ( const RegularExpression regex,
bool  symbols_ok,
bool  inlines_ok,
bool  append,
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]regexA regular expression to use when matching the name.
[in]appendIf true, any matches will be appended to sc_list, else matches replace the contents of sc_list.
[out]sc_listA symbol context list that gets filled in with all of the matches.
Returns
The number of matches added to sc_list.

Definition at line 854 of file Module.cpp.

References lldb_private::SymbolContextList::Append(), lldb_private::Symtab::AppendSymbolIndexesMatchingRegExAndType(), lldb_private::SymbolContext::block, lldb_private::SymbolContextList::Clear(), lldb_private::Symtab::eDebugAny, lldb::eSymbolTypeAny, lldb::eSymbolTypeCode, lldb::eSymbolTypeResolver, lldb_private::Symtab::eVisibilityAny, lldb_private::SymbolVendor::FindFunctions(), lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::Symbol::GetAddressRef(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Address::GetFileAddress(), lldb_private::SymbolContextList::GetSize(), GetSymbolVendor(), lldb_private::SymbolVendor::GetSymtab(), lldb_private::Symbol::GetType(), lldb_private::SymbolContext::symbol, lldb_private::Symtab::SymbolAtIndex(), and lldb_private::Symbol::ValueIsAddress().

◆ FindFunctionSymbols()

size_t 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.
Returns
The number of symbol contexts that were added to sc_list

Definition at line 1348 of file Module.cpp.

References lldb_private::ConstString::AsCString(), lldb_private::Symtab::FindFunctionSymbols(), and GetSymbolVendor().

Referenced by CreateModuleFromObjectFile().

◆ FindGlobalVariables() [1/2]

size_t 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.
Returns
The number of matches added to variable_list.

Definition at line 601 of file Module.cpp.

References lldb_private::SymbolVendor::FindGlobalVariables(), and GetSymbolVendor().

Referenced by CreateModuleFromObjectFile().

◆ FindGlobalVariables() [2/2]

size_t 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.
Returns
The number of matches added to variable_list.

Definition at line 612 of file Module.cpp.

References lldb_private::SymbolVendor::FindGlobalVariables(), and GetSymbolVendor().

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

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

Referenced by GetSourceMappingList().

◆ FindSymbolsMatchingRegExAndType()

size_t Module::FindSymbolsMatchingRegExAndType ( const RegularExpression regex,
lldb::SymbolType  symbol_type,
SymbolContextList sc_list 
)

◆ FindSymbolsWithNameAndType()

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

◆ FindTypes()

size_t 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 SymbolVendor (which will use one or more SymbolFile subclasses). 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]type_listA type list gets populated with any matches.
Returns
The number of matches added to type_list.

Definition at line 990 of file Module.cpp.

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

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

◆ FindTypesInNamespace()

size_t 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).
[in]namespace_declThe namespace declaration that this type must exist in.
[out]type_listA type list gets populated with any matches.
Returns
The number of matches added to type_list.

Definition at line 962 of file Module.cpp.

References lldb_private::SymbolContext::module_sp, and lldb_private::SymbolContext::SortTypeList().

Referenced by CreateModuleFromObjectFile().

◆ 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 ( Stream 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 531 of file Module.h.

References m_file.

Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), DynamicLoaderMacOS::CanLoadImage(), lldb_private::ThreadPlanCallFunction::ConstructorSetup(), CommandObjectPlatformProcessLaunch::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoLaunch(), lldb_private::Target::Dump(), DumpCompileUnitLineTable(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), CommandObjectSourceInfo::DumpLinesInSymbolContexts(), DumpModuleObjfileHeaders(), DumpTargetInfo(), lldb_private::TargetList::FindTargetWithExecutableAndArchitecture(), lldb_private::FormatEntity::Format(), lldb::SBProcess::GetDescription(), lldb::SBTarget::GetExecutable(), GetObjectFile(), GetSpecificationDescription(), lldb_private::UnwindTable::GetUncachedFuncUnwindersContainingAddress(), 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::SearchFilterByModule::Search(), lldb_private::SearchFilterByModuleList::Search(), and UUIDsMatch().

◆ GetIsDynamicLinkEditor()

bool Module::GetIsDynamicLinkEditor ( )

Definition at line 1663 of file Module.cpp.

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

Referenced by GetObjectOffset().

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

References 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(), lldb_private::Status::SetErrorString(), lldb_private::Status::SetErrorStringWithFormat(), and lldb_private::ConstString::SetString().

Referenced by GetObjectOffset().

◆ GetModificationTime()

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

Definition at line 567 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 888 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 402 of file Module.cpp.

References lldb_private::SymbolVendor::GetNumCompileUnits(), GetSymbolVendor(), and m_mutex.

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

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

References lldb_private::ObjectFile::FindPlugin(), lldb_private::FileSystem::GetByteSize(), GetFileSpec(), lldb_private::FileSystem::Instance(), m_arch, 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(), lldb_private::ThreadPlanCallFunction::ConstructorSetup(), DynamicLoaderStatic::CreateInstance(), DynamicLoaderDarwinKernel::CreateInstance(), DynamicLoaderMacOS::CreateInstance(), SystemRuntimeMacOSX::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::process_gdb_remote::ProcessGDBRemote::DoLaunch(), Dump(), DumpModuleObjfileHeaders(), lldb_private::UnwindTable::GetAllowAssemblyEmulationUnwindPlans(), DynamicLoaderHexagonDYLD::GetEntryPoint(), SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), GetIsDynamicLinkEditor(), SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo(), SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex(), GetObjectOffset(), GetSectionList(), GetSymbolVendor(), GetUUID(), lldb_private::Value::GetValueAsData(), GetVersion(), IsExecutable(), IsLoadedInTarget(), CommandObjectTargetModulesList::PrintModule(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), SectionFileAddressesChanged(), SetLoadAddress(), lldb_private::DynamicLoaderDarwin::UnloadModuleSections(), lldb_private::UnwindTable::UnwindTable(), and lldb_private::DynamicLoaderDarwin::UpdateImageLoadAddress().

◆ GetObjectModificationTime()

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

Definition at line 571 of file Module.h.

References m_object_mod_time.

◆ GetObjectName()

ConstString Module::GetObjectName ( ) const

◆ GetObjectOffset()

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

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

References m_file, and m_platform_file.

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

◆ GetRemoteInstallFileSpec()

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

Definition at line 553 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 1284 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(), GetObjectOffset(), IsLoadedInTarget(), LoadOrGetSection(), ResolveFileAddress(), SetSymbolFileFileSpec(), and lldb_private::UnwindTable::UnwindTable().

◆ GetSourceMappingList() [1/2]

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

Definition at line 890 of file Module.h.

References m_source_mappings.

◆ GetSourceMappingList() [2/2]

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

Definition at line 892 of file Module.h.

References FindSourceFile(), m_source_mappings, and RemapSourceFile().

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

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

Referenced by CreateModuleFromObjectFile(), DumpModuleSections(), and SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap().

◆ GetSymbolFileFileSpec()

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

Definition at line 561 of file Module.h.

References m_symfile_spec, PreloadSymbols(), and SetSymbolFileFileSpec().

◆ GetSymbolVendor()

SymbolVendor * Module::GetSymbolVendor ( bool  can_create = true,
lldb_private::Stream feedback_strm = nullptr 
)
virtual

Get the symbol vendor interface for the current architecture.

If the symbol vendor file has not been located yet, this function will find the best SymbolVendor plug-in that can use the current object file.

Returns
If this module does not have a valid object file, or no plug-in can be found that can use the object file, nullptr will be returned, else a valid symbol vendor plug-in interface will be returned. The returned pointer is owned by this object and remains valid as long as the object is around.

Reimplemented in DebugMapModule.

Definition at line 1047 of file Module.cpp.

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

Referenced by SymbolFileDWARFDebugMap::CompleteType(), CommandObjectTargetModulesDumpClangAST::DoExecute(), Dump(), DumpModuleSymbolVendor(), DumpModuleSymtab(), FindAddressesForLine(), FindFirstSymbolWithNameAndType(), FindFunctions(), FindFunctionSymbols(), FindGlobalVariables(), FindSymbolsMatchingRegExAndType(), FindSymbolsWithNameAndType(), GetCompileUnitAtIndex(), DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule(), GetNumCompileUnits(), GetObjectOffset(), SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo(), GetTypeList(), SymbolFileDWARFDebugMap::LinkOSOAddress(), PlatformDarwin::LocateExecutableScriptingResources(), LookupSymbolInModule(), ParseAllDebugSymbols(), PreloadSymbols(), CommandObjectTargetModulesList::PrintModule(), lldb_private::Module::LookupInfo::Prune(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), and SectionFileAddressesChanged().

◆ GetTypeList()

TypeList * Module::GetTypeList ( )

Get accessor the type list for this module.

Returns
A valid type list pointer, or nullptr if there is no valid symbol vendor for this module.

Definition at line 1242 of file Module.cpp.

References GetSymbolVendor(), and lldb_private::SymbolVendor::GetTypeList().

Referenced by GetObjectOffset().

◆ GetTypeSystemForLanguage()

TypeSystem * Module::GetTypeSystemForLanguage ( lldb::LanguageType  language)

◆ GetUnifiedSectionList()

SectionList * Module::GetUnifiedSectionList ( )
protected

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

References m_unwind_table.

Referenced by GetObjectOffset().

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

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

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

◆ GetVersion()

llvm::VersionTuple Module::GetVersion ( )

Definition at line 1657 of file Module.cpp.

References GetObjectFile().

Referenced by GetObjectOffset().

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

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

Referenced by SetObjectModificationTime().

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

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

Referenced by SetObjectModificationTime().

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

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

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

Referenced by GetObjectOffset().

◆ PreloadSymbols()

void Module::PreloadSymbols ( )

◆ RemapSourceFile() [1/2]

bool Module::RemapSourceFile ( llvm::StringRef  path,
std::string &  new_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.
[out]new_pathThe newly remapped filespec that is may or may not exist.
Returns
/b true if path was successfully located and new_path is filled in with a new source path, false otherwise.

Definition at line 1651 of file Module.cpp.

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

Referenced by GetSourceMappingList().

◆ RemapSourceFile() [2/2]

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

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

References lldb_private::SymbolContext::Clear(), lldb::eSymbolTypeInvalid, 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(), lldb_private::SymbolVendor::GetSymbolFile(), GetSymbolVendor(), lldb_private::SymbolVendor::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::SymbolVendor::ResolveSymbolContext(), lldb_private::Address::Slide(), and lldb_private::SymbolContext::symbol.

Referenced by GetObjectOffset().

◆ 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

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

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

References ResolveSymbolContextsForFileSpec().

Referenced by GetObjectOffset().

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

References lldb_private::FileSpec::GetPath(), lldb_private::SymbolContextList::GetSize(), GetSymbolVendor(), m_mutex, and lldb_private::SymbolVendor::ResolveSymbolContext().

Referenced by DumpCompileUnitLineTable(), GetObjectOffset(), 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 1294 of file Module.cpp.

References GetObjectFile(), GetSymbolVendor(), lldb_private::SymbolVendor::SectionFileAddressesChanged(), and lldb_private::ObjectFile::SectionFileAddressesChanged().

Referenced by GetObjectOffset().

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

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

Referenced by CreateModuleFromObjectFile(), and CommandObjectTargetModulesLoad::DoExecute().

◆ SetObjectModificationTime()

void lldb_private::Module::SetObjectModificationTime ( const llvm::sys::TimePoint<> &  mod_time)
inline

◆ SetPlatformFileSpec()

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

Definition at line 551 of file Module.h.

References m_platform_file.

◆ SetRemoteInstallFileSpec()

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

Definition at line 557 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 345 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 1103 of file Module.h.

◆ ObjectFile

friend class ObjectFile
friend

Definition at line 1104 of file Module.h.

◆ SymbolFile

friend class SymbolFile
friend

Definition at line 1105 of file Module.h.

Member Data Documentation

◆ m_arch

ArchSpec lldb_private::Module::m_arch
protected

The architecture for this module.

Definition at line 1008 of file Module.h.

Referenced by GetArchitecture(), GetDescription(), GetMemoryObjectFile(), GetObjectFile(), MatchesModuleSpec(), Module(), SetArchitecture(), and ~Module().

◆ m_did_load_objfile

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

Definition at line 1049 of file Module.h.

Referenced by GetMemoryObjectFile(), and GetObjectFile().

◆ m_did_load_symbol_vendor

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

Definition at line 1050 of file Module.h.

Referenced by GetSymbolVendor(), and SetSymbolFileFileSpec().

◆ m_did_set_uuid

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

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

Referenced by FileHasChanged(), and Module().

◆ m_first_file_changed_log

bool lldb_private::Module::m_first_file_changed_log
mutableprotected

Definition at line 1052 of file Module.h.

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

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

◆ 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 1025 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 1021 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
protected

Definition at line 1024 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 1026 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 1035 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 1013 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 1015 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 1045 of file Module.h.

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

◆ m_source_mappings

PathMappingList lldb_private::Module::m_source_mappings
protected

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

Referenced by FindSourceFile(), GetSourceMappingList(), 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 1018 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 1033 of file Module.h.

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

◆ 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 1039 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 1029 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 1009 of file Module.h.

Referenced by GetUUID(), and SetUUID().


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