LLDB mainline
|
A class that describes an executable image and its associated object and symbol files. More...
#include "lldb/Core/Module.h"
Classes | |
class | LookupInfo |
A class that encapsulates name lookup information. More... |
Public Member Functions | |
Module (const FileSpec &file_spec, const ArchSpec &arch, ConstString object_name=ConstString(), lldb::offset_t object_offset=0, const llvm::sys::TimePoint<> &object_mod_time=llvm::sys::TimePoint<>()) | |
Construct with file specification and architecture. | |
Module (const ModuleSpec &module_spec) | |
~Module () override | |
Destructor. | |
bool | MatchesModuleSpec (const ModuleSpec &module_ref) |
bool | SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset, bool &changed) |
Set the load address for all sections in a module to be the file address plus slide. | |
void | CalculateSymbolContext (SymbolContext *sc) override |
Reconstruct the object's symbol context into sc. | |
lldb::ModuleSP | CalculateSymbolContextModule () override |
void | GetDescription (llvm::raw_ostream &s, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) |
std::string | GetSpecificationDescription () const |
Get the module path and object name. | |
void | Dump (Stream *s) |
Dump a description of this object to a Stream. | |
void | DumpSymbolContext (Stream *s) override |
Dump the object's symbol context to the stream s. | |
const Symbol * | FindFirstSymbolWithNameAndType (ConstString name, lldb::SymbolType symbol_type=lldb::eSymbolTypeAny) |
Find a symbol in the object file's symbol table. | |
void | FindSymbolsWithNameAndType (ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list) |
void | FindSymbolsMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, SymbolContextList &sc_list, Mangled::NamePreference mangling_preference=Mangled::ePreferDemangled) |
void | FindFunctionSymbols (ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list) |
Find a function symbols in the object file's symbol table. | |
void | FindCompileUnits (const FileSpec &path, SymbolContextList &sc_list) |
Find compile units by partial or full path. | |
void | FindFunctions (const LookupInfo &lookup_info, const CompilerDeclContext &parent_decl_ctx, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) |
Find functions by lookup info. | |
void | FindFunctions (ConstString name, const CompilerDeclContext &parent_decl_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) |
Find functions by name. | |
void | FindFunctions (llvm::ArrayRef< CompilerContext > compiler_ctx, lldb::FunctionNameType name_type_mask, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) |
Find functions by compiler context. | |
void | FindFunctions (const RegularExpression ®ex, const ModuleFunctionSearchOptions &options, SymbolContextList &sc_list) |
Find functions by name. | |
void | FindAddressesForLine (const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, Function *function, std::vector< Address > &output_local, std::vector< Address > &output_extern) |
Find addresses by file/line. | |
void | FindGlobalVariables (ConstString name, const CompilerDeclContext &parent_decl_ctx, size_t max_matches, VariableList &variable_list) |
Find global and static variables by name. | |
void | FindGlobalVariables (const RegularExpression ®ex, size_t max_matches, VariableList &variable_list) |
Find global and static variables by regular expression. | |
void | FindTypes (const TypeQuery &query, TypeResults &results) |
Find types using a type-matching object that contains all search parameters. | |
const ArchSpec & | GetArchitecture () const |
Get const accessor for the module architecture. | |
const FileSpec & | GetFileSpec () const |
Get const accessor for the module file specification. | |
const FileSpec & | GetPlatformFileSpec () const |
Get accessor for the module platform file specification. | |
void | SetPlatformFileSpec (const FileSpec &file) |
const FileSpec & | GetRemoteInstallFileSpec () const |
void | SetRemoteInstallFileSpec (const FileSpec &file) |
const FileSpec & | GetSymbolFileFileSpec () const |
void | PreloadSymbols () |
void | SetSymbolFileFileSpec (const FileSpec &file) |
const llvm::sys::TimePoint & | GetModificationTime () const |
const llvm::sys::TimePoint & | GetObjectModificationTime () const |
void | RegisterXcodeSDK (llvm::StringRef sdk, llvm::StringRef sysroot) |
This callback will be called by SymbolFile implementations when parsing a compile unit that contains SDK information. | |
bool | IsExecutable () |
Tells whether this module is capable of being the main executable for a process. | |
bool | IsLoadedInTarget (Target *target) |
Tells whether this module has been loaded in the target passed in. | |
bool | LoadScriptingResourceInTarget (Target *target, Status &error, Stream &feedback_stream) |
size_t | GetNumCompileUnits () |
Get the number of compile units for this module. | |
lldb::CompUnitSP | GetCompileUnitAtIndex (size_t idx) |
ConstString | GetObjectName () const |
uint64_t | GetObjectOffset () const |
virtual ObjectFile * | GetObjectFile () |
Get the object file representation for the current architecture. | |
virtual SectionList * | GetSectionList () |
Get the unified section list for the module. | |
virtual void | SectionFileAddressesChanged () |
Notify the module that the file addresses for the Sections have been updated. | |
UnwindTable & | GetUnwindTable () |
Returns a reference to the UnwindTable for this Module. | |
llvm::VersionTuple | GetVersion () |
ObjectFile * | 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. | |
virtual SymbolFile * | GetSymbolFile (bool can_create=true, Stream *feedback_strm=nullptr) |
Get the module's symbol file. | |
Symtab * | GetSymtab (bool can_create=true) |
Get the module's symbol table. | |
const lldb_private::UUID & | GetUUID () |
Get a reference to the UUID value contained in this object. | |
void | ParseAllDebugSymbols () |
A debugging function that will cause everything in a module to be parsed. | |
bool | ResolveFileAddress (lldb::addr_t vm_addr, Address &so_addr) |
uint32_t | ResolveSymbolContextForAddress (const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc, bool resolve_tail_call_address=false) |
Resolve the symbol context for the given address. | |
uint32_t | ResolveSymbolContextForFilePath (const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) |
Resolve items in the symbol context for a given file and line. | |
uint32_t | ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) |
Resolve items in the symbol context for a given file and line. | |
void | SetFileSpecAndObjectName (const FileSpec &file, ConstString object_name) |
bool | GetIsDynamicLinkEditor () |
llvm::Expected< lldb::TypeSystemSP > | GetTypeSystemForLanguage (lldb::LanguageType language) |
void | ForEachTypeSystem (llvm::function_ref< bool(lldb::TypeSystemSP)> callback) |
Call callback for each TypeSystem in this Module . | |
template<typename... Args> | |
void | LogMessage (Log *log, const char *format, Args &&...args) |
template<typename... Args> | |
void | LogMessageVerboseBacktrace (Log *log, const char *format, Args &&...args) |
template<typename... Args> | |
void | ReportWarning (const char *format, Args &&...args) |
template<typename... Args> | |
void | ReportError (const char *format, Args &&...args) |
template<typename... Args> | |
void | ReportErrorIfModifyDetected (const char *format, Args &&...args) |
void | ReportWarningOptimization (std::optional< lldb::user_id_t > debugger_id) |
void | ReportWarningUnsupportedLanguage (lldb::LanguageType language, std::optional< lldb::user_id_t > debugger_id) |
bool | FileHasChanged () const |
std::recursive_mutex & | GetMutex () const |
PathMappingList & | GetSourceMappingList () |
const PathMappingList & | GetSourceMappingList () const |
bool | FindSourceFile (const FileSpec &orig_spec, FileSpec &new_spec) const |
Finds a source file given a file spec using the module source path remappings (if any). | |
std::optional< std::string > | RemapSourceFile (llvm::StringRef path) const |
Remaps a source file given path into new_path. | |
bool | RemapSourceFile (const char *, std::string &) const =delete |
bool | MergeArchitecture (const ArchSpec &arch_spec) |
Update the ArchSpec to a more specific variant. | |
StatsDuration & | GetSymtabParseTime () |
Accessor for the symbol table parse time metric. | |
StatsDuration & | GetSymtabIndexTime () |
Accessor for the symbol table index time metric. | |
StatisticsMap & | GetSymbolLocatorStatistics () |
void | ResetStatistics () |
uint32_t | Hash () |
Get a unique hash for this module. | |
std::string | GetCacheKey () |
Get a unique cache key for the current module. | |
Public Member Functions inherited from lldb_private::SymbolContextScope | |
virtual | ~SymbolContextScope ()=default |
virtual CompileUnit * | CalculateSymbolContextCompileUnit () |
virtual Function * | CalculateSymbolContextFunction () |
virtual Block * | CalculateSymbolContextBlock () |
virtual Symbol * | CalculateSymbolContextSymbol () |
Public Member Functions inherited from lldb_private::UserID | |
UserID (lldb::user_id_t uid=LLDB_INVALID_UID) | |
Construct with optional user ID. | |
~UserID ()=default | |
Destructor. | |
void | Clear () |
Clears the object state. | |
lldb::user_id_t | GetID () const |
Get accessor for the user ID. | |
void | SetID (lldb::user_id_t uid) |
Set accessor for the user ID. |
Static Public Member Functions | |
static size_t | GetNumberAllocatedModules () |
static Module * | GetAllocatedModuleAtIndex (size_t idx) |
static std::recursive_mutex & | GetAllocationModuleCollectionMutex () |
template<typename ObjFilePlugin, typename... Args> | |
static lldb::ModuleSP | CreateModuleFromObjectFile (Args &&...args) |
static DataFileCache * | GetIndexCache () |
Get the global index file cache. |
Protected Member Functions | |
void | SymbolIndicesToSymbolContextList (Symtab *symtab, std::vector< uint32_t > &symbol_indexes, SymbolContextList &sc_list) |
bool | SetArchitecture (const ArchSpec &new_arch) |
void | SetUUID (const lldb_private::UUID &uuid) |
SectionList * | GetUnifiedSectionList () |
Protected Attributes | |
std::recursive_mutex | m_mutex |
A mutex to keep this object happy in multi-threaded environments. | |
llvm::sys::TimePoint | m_mod_time |
The modification time for this module when it was created. | |
ArchSpec | m_arch |
The architecture for this module. | |
UUID | m_uuid |
Each module is assumed to have a unique identifier to help match it up to debug symbols. | |
FileSpec | m_file |
The file representation on disk for this module (if there is one). | |
FileSpec | m_platform_file |
The path to the module on the platform on which it is being debugged. | |
FileSpec | m_remote_install_file |
If set when debugging on remote platforms, this module will be installed at this location. | |
FileSpec | m_symfile_spec |
If this path is valid, then this is the file that will be used as the symbol file for this module. | |
ConstString | m_object_name |
The name an object within this module that is selected, or empty of the module is represented by m_file. | |
uint64_t | m_object_offset = 0 |
llvm::sys::TimePoint | m_object_mod_time |
lldb::DataBufferSP | m_data_sp |
DataBuffer containing the module image, if it was provided at construction time. | |
lldb::ObjectFileSP | m_objfile_sp |
A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile. | |
UnwindTable | m_unwind_table |
Table of FuncUnwinders objects created for this Module's functions. | |
lldb::SymbolVendorUP | m_symfile_up |
A pointer to the symbol vendor for this module. | |
std::vector< lldb::SymbolVendorUP > | m_old_symfiles |
If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,. | |
TypeSystemMap | m_type_system_map |
A map of any type systems associated with this module. | |
PathMappingList | m_source_mappings |
Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are. | |
lldb::SectionListUP | m_sections_up |
Unified section list for module that is used by the ObjectFile and ObjectFile instances for the debug info. | |
std::atomic< bool > | m_did_load_objfile {false} |
std::atomic< bool > | m_did_load_symfile {false} |
std::atomic< bool > | m_did_set_uuid {false} |
bool | m_file_has_changed: 1 |
bool | m_first_file_changed_log: 1 |
StatsDuration | m_symtab_parse_time |
See if the module was modified after it was initially opened. | |
StatsDuration | m_symtab_index_time |
We store a symbol named index time duration here because we might have an object file and a symbol file which both have symbol tables. | |
StatisticsMap | m_symbol_locator_duration_map |
llvm::DenseMap< llvm::stable_hash, std::unique_ptr< std::once_flag > > | m_shown_diagnostics |
A set of hashes of all warnings and errors, to avoid reporting them multiple times to the same Debugger. | |
std::recursive_mutex | m_diagnostic_mutex |
Protected Attributes inherited from lldb_private::UserID | |
lldb::user_id_t | m_uid |
The user ID that uniquely identifies an object. |
Private Member Functions | |
Module () | |
Module (const Module &)=delete | |
const Module & | operator= (const Module &)=delete |
void | LogMessage (Log *log, const llvm::formatv_object_base &payload) |
void | LogMessageVerboseBacktrace (Log *log, const llvm::formatv_object_base &payload) |
void | ReportWarning (const llvm::formatv_object_base &payload) |
void | ReportError (const llvm::formatv_object_base &payload) |
void | ReportErrorIfModifyDetected (const llvm::formatv_object_base &payload) |
std::once_flag * | GetDiagnosticOnceFlag (llvm::StringRef msg) |
Friends | |
class | ModuleList |
class | ObjectFile |
class | SymbolFile |
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.
Module::Module | ( | const FileSpec & | file_spec, |
const ArchSpec & | arch, | ||
ConstString | object_name = ConstString(), | ||
lldb::offset_t | object_offset = 0, | ||
const llvm::sys::TimePoint<> & | object_mod_time = llvm::sys::TimePoint<>() ) |
Construct with file specification and architecture.
Clients that wish to share modules with other targets should use ModuleList::GetSharedModule().
[in] | file_spec | The file specification for the on disk representation of this executable image. |
[in] | arch | The architecture to set as the current architecture in this module. |
[in] | object_name | The 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_offset | The offset within an existing module used to extract a module within a module (.a files and modules that contain multiple architectures). |
Definition at line 238 of file Module.cpp.
References g_unique_id, GetAllocationModuleCollectionMutex(), lldb_private::GetLog(), GetModificationTime(), GetModuleCollection(), LLDB_LOGF, m_arch, m_file, m_file_has_changed, m_first_file_changed_log, m_mod_time, m_object_mod_time, m_object_name, m_object_offset, m_unwind_table, lldb_private::Modules, lldb_private::Object, and lldb_private::UserID::UserID().
Referenced by lldb_private::plugin::dwarf::DebugMapModule::DebugMapModule(), GetAllocatedModuleAtIndex(), Module(), and operator=().
Module::Module | ( | const ModuleSpec & | module_spec | ) |
Definition at line 135 of file Module.cpp.
References lldb_private::ConstString::AsCString(), lldb_private::ModuleSpecList::FindMatchingModuleSpec(), g_unique_id, GetAllocationModuleCollectionMutex(), lldb_private::ModuleSpec::GetArchitecture(), lldb_private::ArchSpec::GetArchitectureName(), lldb_private::ModuleSpec::GetData(), lldb_private::ModuleSpec::GetFileSpec(), lldb_private::GetLog(), lldb_private::FileSystem::GetModificationTime(), GetModuleCollection(), lldb_private::ObjectFile::GetModuleSpecifications(), lldb_private::ModuleSpec::GetObjectModificationTime(), lldb_private::ModuleSpec::GetObjectName(), lldb_private::ModuleSpec::GetObjectOffset(), lldb_private::FileSpec::GetPath(), lldb_private::ModuleSpec::GetPlatformFileSpec(), lldb_private::ModuleSpec::GetSymbolFileSpec(), lldb_private::FileSystem::Instance(), lldb_private::ConstString::IsEmpty(), lldb_private::ArchSpec::IsValid(), LLDB_LOGF, m_arch, m_data_sp, m_file, m_file_has_changed, m_first_file_changed_log, m_mod_time, m_object_mod_time, m_object_name, m_object_offset, m_platform_file, m_symfile_spec, m_unwind_table, lldb_private::Modules, lldb_private::Object, and lldb_private::UserID::UserID().
|
override |
Destructor.
Definition at line 270 of file Module.cpp.
References GetAllocationModuleCollectionMutex(), lldb_private::GetLog(), GetModuleCollection(), LLDB_LOGF, m_arch, m_file, m_mutex, m_object_name, m_objfile_sp, m_sections_up, m_symfile_up, lldb_private::Modules, and lldb_private::Object.
|
private |
Definition at line 262 of file Module.cpp.
References g_unique_id, GetAllocationModuleCollectionMutex(), GetModuleCollection(), m_file_has_changed, m_first_file_changed_log, m_unwind_table, and lldb_private::UserID::UserID().
Referenced by CreateModuleFromObjectFile().
|
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.
[out] | sc | A symbol context object pointer that gets filled in. |
Implements lldb_private::SymbolContextScope.
Definition at line 418 of file Module.cpp.
References lldb_private::SymbolContext::module_sp.
Referenced by SymbolIndicesToSymbolContextList().
|
overridevirtual |
Reimplemented from lldb_private::SymbolContextScope.
Definition at line 422 of file Module.cpp.
|
inlinestatic |
Definition at line 135 of file Module.h.
References Module().
Referenced by lldb_private::IRExecutionUnit::GetJITModule(), lldb_private::ScriptedProcess::GetLoadedDynamicLibrariesInfos(), and lldb_private::minidump::ProcessMinidump::ReadModuleList().
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.
[in] | s | The stream to which to dump the object description. |
Definition at line 1154 of file Module.cpp.
References lldb_private::ObjectFile::Dump(), GetObjectFile(), GetSymbolFile(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_file, m_mutex, m_object_name, ObjectFile, lldb_private::Stream::Printf(), and SymbolFile.
|
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.
[in] | s | The stream to which to dump the object's symbol context. |
Implements lldb_private::SymbolContextScope.
Definition at line 424 of file Module.cpp.
References lldb_private::Stream::Printf().
bool Module::FileHasChanged | ( | ) | const |
Definition at line 1053 of file Module.cpp.
References lldb_private::FileSystem::GetModificationTime(), lldb_private::FileSystem::Instance(), m_data_sp, m_file, m_file_has_changed, and m_mod_time.
Referenced by ReportErrorIfModifyDetected().
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.
[in] | target_sp | The target the addresses are desired for. |
[in] | file | Source file to locate. |
[in] | line | Source line to locate. |
[in] | function | Optional filter function. Addresses within this function will be added to the 'local' list. All others will be added to the 'extern' list. |
[out] | output_local | All matching addresses within 'function' |
[out] | output_extern | All matching addresses not within 'function' |
Definition at line 931 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().
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.
[in] | path | The name of the function we are looking for. |
[out] | sc_list | A symbol context list that gets filled in with all of the matches. |
Definition at line 633 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.
const Symbol * Module::FindFirstSymbolWithNameAndType | ( | ConstString | name, |
lldb::SymbolType | symbol_type = lldb::eSymbolTypeAny ) |
Find a symbol in the object file's symbol table.
[in] | name | The name of the symbol that we are looking for. |
[in] | symbol_type | If 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. |
Definition at line 1249 of file Module.cpp.
References lldb_private::ConstString::AsCString(), lldb_private::Symtab::eDebugAny, lldb_private::Symtab::eVisibilityAny, GetSymtab(), and LLDB_SCOPED_TIMERF.
void Module::FindFunctions | ( | const LookupInfo & | lookup_info, |
const CompilerDeclContext & | parent_decl_ctx, | ||
const ModuleFunctionSearchOptions & | options, | ||
SymbolContextList & | sc_list ) |
Find functions by lookup info.
If the function is an inlined function, it will have a block, representing the inlined function, and the function will be the containing function. If it is not inlined, then the block will be NULL.
[in] | lookup_info | The lookup info of the function we are looking for. |
[out] | sc_list | A symbol context list that gets filled in with all of the matches. |
Definition at line 811 of file Module.cpp.
References lldb_private::Module::LookupInfo::GetLookupName(), lldb_private::Module::LookupInfo::GetNameTypeMask(), GetSymbolFile(), lldb_private::ModuleFunctionSearchOptions::include_inlines, lldb_private::ModuleFunctionSearchOptions::include_symbols, and SymbolFile.
Referenced by lldb_private::SourceManager::GetDefaultFileAndLine().
void Module::FindFunctions | ( | const RegularExpression & | regex, |
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.
[in] | regex | A regular expression to use when matching the name. |
[out] | sc_list | A symbol context list that gets filled in with all of the matches. |
Definition at line 862 of file Module.cpp.
References lldb_private::SymbolContextList::Append(), lldb_private::Symtab::AppendSymbolIndexesMatchingRegExAndType(), lldb_private::SymbolContext::block, lldb_private::Symtab::eDebugAny, lldb::eSymbolTypeAny, lldb::eSymbolTypeCode, lldb::eSymbolTypeResolver, lldb_private::Symtab::eVisibilityAny, lldb_private::SymbolContext::function, lldb_private::Function::GetAddress(), lldb_private::Symbol::GetAddressRef(), lldb_private::Address::GetFileAddress(), lldb_private::SymbolContextList::GetSize(), GetSymbolFile(), lldb_private::Symbol::GetType(), lldb_private::ModuleFunctionSearchOptions::include_inlines, lldb_private::ModuleFunctionSearchOptions::include_symbols, lldb_private::SymbolContext::symbol, lldb_private::Symtab::SymbolAtIndex(), SymbolFile, and lldb_private::Symbol::ValueIsAddress().
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.
[in] | name | The name of the function we are looking for. |
[in] | name_type_mask | A 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_list | A symbol context list that gets filled in with all of the matches. |
void lldb_private::Module::FindFunctions | ( | llvm::ArrayRef< CompilerContext > | compiler_ctx, |
lldb::FunctionNameType | name_type_mask, | ||
const ModuleFunctionSearchOptions & | options, | ||
SymbolContextList & | sc_list ) |
Find functions by compiler context.
void Module::FindFunctionSymbols | ( | ConstString | name, |
uint32_t | name_type_mask, | ||
SymbolContextList & | sc_list ) |
Find a function symbols in the object file's symbol table.
[in] | name | The name of the symbol that we are looking for. |
[in] | name_type_mask | A 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_list | A list to append any matching symbol contexts to. |
Definition at line 1277 of file Module.cpp.
References lldb_private::ConstString::AsCString(), GetSymtab(), and LLDB_SCOPED_TIMERF.
void Module::FindGlobalVariables | ( | const RegularExpression & | regex, |
size_t | max_matches, | ||
VariableList & | variable_list ) |
Find global and static variables by regular expression.
[in] | regex | A regular expression to use when matching the name. |
[in] | max_matches | Allow the number of matches to be limited to max_matches. Specify UINT32_MAX to get all possible matches. |
[in] | variable_list | A list of variables that gets the matches appended to. |
Definition at line 626 of file Module.cpp.
References lldb_private::SymbolFile::FindGlobalVariables(), GetSymbolFile(), and SymbolFile.
void Module::FindGlobalVariables | ( | ConstString | name, |
const CompilerDeclContext & | parent_decl_ctx, | ||
size_t | max_matches, | ||
VariableList & | variable_list ) |
Find global and static variables by name.
[in] | name | The name of the global or static variable we are looking for. |
[in] | parent_decl_ctx | If valid, a decl context that results must exist within |
[in] | max_matches | Allow the number of matches to be limited to max_matches. Specify UINT32_MAX to get all possible matches. |
[in] | variable_list | A list of variables that gets the matches appended to. |
Definition at line 619 of file Module.cpp.
References GetSymbolFile(), and SymbolFile.
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).
[in] | orig_spec | The original source file path to try and remap. |
[out] | new_spec | The newly remapped filespec that is guaranteed to exist. |
Definition at line 1534 of file Module.cpp.
References m_mutex, and m_source_mappings.
void Module::FindSymbolsMatchingRegExAndType | ( | const RegularExpression & | regex, |
lldb::SymbolType | symbol_type, | ||
SymbolContextList & | sc_list, | ||
Mangled::NamePreference | mangling_preference = Mangled::ePreferDemangled ) |
Definition at line 1297 of file Module.cpp.
References lldb_private::Symtab::eDebugAny, lldb_private::Symtab::eVisibilityAny, GetSymtab(), lldb_private::RegularExpression::GetText(), LLDB_SCOPED_TIMERF, and SymbolIndicesToSymbolContextList().
void Module::FindSymbolsWithNameAndType | ( | ConstString | name, |
lldb::SymbolType | symbol_type, | ||
SymbolContextList & | sc_list ) |
Definition at line 1285 of file Module.cpp.
References GetSymtab(), and SymbolIndicesToSymbolContextList().
void Module::FindTypes | ( | const TypeQuery & | query, |
TypeResults & | results ) |
Find types using a type-matching object that contains all search parameters.
[in] | query | A type matching object that contains all of the details of the type search. |
[in] | results | Any matching types will be populated into the results object using TypeMap::InsertUnique(...). |
Definition at line 955 of file Module.cpp.
References GetSymbolFile(), and SymbolFile.
Referenced by lldb_private::ModuleList::FindTypes().
void Module::ForEachTypeSystem | ( | llvm::function_ref< bool(lldb::TypeSystemSP)> | callback | ) |
Call callback
for each TypeSystem
in this Module
.
Return true from callback to keep iterating, false to stop iterating.
Definition at line 380 of file Module.cpp.
References m_type_system_map.
|
static |
Definition at line 124 of file Module.cpp.
References GetAllocationModuleCollectionMutex(), GetModuleCollection(), and Module().
Referenced by FindModulesByName(), lldb_private::DebuggerStats::ReportStatistics(), and lldb_private::DebuggerStats::ResetStatistics().
|
static |
Definition at line 106 of file Module.cpp.
Referenced by CommandObjectTargetModulesDumpClangAST::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTargetModulesList::DoExecute(), FindModulesByName(), GetAllocatedModuleAtIndex(), GetNumberAllocatedModules(), Module(), Module(), Module(), lldb_private::DebuggerStats::ReportStatistics(), lldb_private::DebuggerStats::ResetStatistics(), and ~Module().
const ArchSpec & Module::GetArchitecture | ( | ) | const |
Get const accessor for the module architecture.
Definition at line 1019 of file Module.cpp.
References m_arch.
Referenced by CommandObjectPlatformProcessLaunch::DoExecute(), DynamicLoaderMacOSXDYLD::DoInitialImageFetch(), DumpModuleArchitecture(), DumpModuleSections(), lldb_private::TargetList::FindTargetWithExecutableAndArchitecture(), and lldb_private::ModuleList::LogUUIDAndPaths().
std::string Module::GetCacheKey | ( | ) |
Get a unique cache key for the current module.
The cache key must be unique for a file on disk and not change if the file is updated. This allows cache data to use this key as a prefix and as files are modified in disk, we will overwrite the cache files. If one file can contain multiple files, like a universal mach-o file or like a BSD archive, the cache key must contain enough information to differentiate these different files.
Definition at line 1629 of file Module.cpp.
References Hash(), m_arch, m_file, and m_object_name.
CompUnitSP Module::GetCompileUnitAtIndex | ( | size_t | idx | ) |
Definition at line 435 of file Module.cpp.
References GetNumCompileUnits(), GetSymbolFile(), m_mutex, and SymbolFile.
Referenced by CommandObjectSourceInfo::DumpFileLinesInModule(), and FindCompileUnits().
void Module::GetDescription | ( | llvm::raw_ostream & | s, |
lldb::DescriptionLevel | level = lldb::eDescriptionLevelFull ) |
Definition at line 1031 of file Module.cpp.
References lldb::eDescriptionLevelBrief, lldb::eDescriptionLevelFull, m_arch, m_file, m_object_name, and PATH_MAX.
Referenced by LogMessage(), LogMessageVerboseBacktrace(), ReportError(), ReportErrorIfModifyDetected(), and ReportWarning().
|
private |
Definition at line 1106 of file Module.cpp.
References m_diagnostic_mutex, and m_shown_diagnostics.
Referenced by ReportError(), ReportWarning(), ReportWarningOptimization(), and ReportWarningUnsupportedLanguage().
|
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.
Definition at line 454 of file Module.h.
References m_file.
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), CommandObjectPlatformProcessLaunch::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), lldb_private::Target::Dump(), DumpTargetInfo(), lldb_private::TargetList::FindTargetWithExecutableAndArchitecture(), lldb_private::ForEachFormatterInModule(), lldb_private::FormatEntity::Format(), lldb::SBProcess::GetDescription(), lldb_private::Target::GetEntryPointAddress(), lldb::SBTarget::GetExecutable(), GetObjectFile(), lldb_private::PlatformDarwin::GetSDKPathFromDebugInfo(), GetSpecificationDescription(), lldb_private::Value::GetValueAsData(), HexagonDYLDRendezvous::HexagonDYLDRendezvous(), lldb_private::Process::LaunchPrivate(), LoadScriptingResourceInTarget(), LookupFileAndLineInModule(), LookupFunctionInModule(), LookupSymbolInModule(), LookupTypeHere(), LookupTypeInModule(), CommandObjectTargetModulesList::PrintModule(), and ReportWarningOptimization().
|
static |
Get the global index file cache.
LLDB can cache data for a module between runs. This cache directory can be used to stored data that previously was manually created each time you debug. Examples include debug information indexes, symbol tables, symbol table indexes, and more.
Definition at line 1639 of file Module.cpp.
References lldb_private::ModuleList::GetGlobalModuleListProperties().
Referenced by lldb_private::plugin::dwarf::ManualDWARFIndex::LoadFromCache(), lldb_private::Symtab::LoadFromCache(), lldb_private::plugin::dwarf::ManualDWARFIndex::SaveToCache(), and lldb_private::Symtab::SaveToCache().
bool Module::GetIsDynamicLinkEditor | ( | ) |
Definition at line 1606 of file Module.cpp.
References lldb_private::ObjectFile::GetIsDynamicLinkEditor(), GetObjectFile(), and ObjectFile.
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.
Definition at line 300 of file Module.cpp.
References lldb_private::Status::AsCString(), error(), lldb_private::ObjectFile::FindPlugin(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::StreamString::GetString(), m_arch, m_did_load_objfile, m_mutex, m_object_name, m_objfile_sp, m_unwind_table, ObjectFile, and lldb_private::Stream::Printf().
|
inline |
Definition at line 490 of file Module.h.
References m_mod_time.
Referenced by lldb_private::CacheSignature::CacheSignature(), Module(), and CommandObjectTargetModulesList::PrintModule().
|
inline |
|
static |
Definition at line 118 of file Module.cpp.
References GetAllocationModuleCollectionMutex(), and GetModuleCollection().
Referenced by CommandObjectTargetModulesList::DoExecute(), FindModulesByName(), lldb::SBModule::GetNumberAllocatedModules(), lldb_private::DebuggerStats::ReportStatistics(), and lldb_private::DebuggerStats::ResetStatistics().
size_t Module::GetNumCompileUnits | ( | ) |
Get the number of compile units for this module.
Definition at line 428 of file Module.cpp.
References GetSymbolFile(), m_mutex, and SymbolFile.
Referenced by CommandObjectSourceInfo::DumpFileLinesInModule(), FindCompileUnits(), GetCompileUnitAtIndex(), GetModuleConfig(), and ParseAllDebugSymbols().
|
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.
Definition at line 1177 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, m_unwind_table, ObjectFile, and ReportError().
Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), ProcessKDP::CanDebug(), DynamicLoaderMacOS::CreateInstance(), DynamicLoaderMacOSXDYLD::CreateInstance(), DynamicLoaderStatic::CreateInstance(), SystemRuntimeMacOSX::CreateInstance(), Dump(), DynamicLoaderFreeBSDKernel::FindKernelAtLoadAddress(), lldb_private::Target::GetEntryPointAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(), GetIsDynamicLinkEditor(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetObjectFileByCompUnitInfo(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetObjectFileByOSOIndex(), GetSectionList(), GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetUUID(), GetVersion(), is_kmod(), is_reloc(), IsExecutable(), IsLoadedInTarget(), lldb_private::DebuggerStats::ReportStatistics(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), SectionFileAddressesChanged(), and SetLoadAddress().
|
inline |
Definition at line 494 of file Module.h.
References m_object_mod_time.
Referenced by lldb_private::CacheSignature::CacheSignature().
ConstString Module::GetObjectName | ( | ) | const |
Definition at line 1175 of file Module.cpp.
References m_object_name.
Referenced by DynamicLoaderHexagonDYLD::GetThreadLocalData(), and MatchesModuleSpec().
|
inline |
Definition at line 535 of file Module.h.
References m_object_offset.
|
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.
Definition at line 468 of file Module.h.
References m_file, and m_platform_file.
Referenced by lldb::SBTarget::Launch(), lldb::SBTarget::Launch(), MatchesModuleSpec(), lldb::SBProcess::RemoteLaunch(), and DYLDRendezvous::UpdateExecutablePath().
|
inline |
Definition at line 476 of file Module.h.
References m_remote_install_file.
|
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.
Definition at line 1219 of file Module.cpp.
References lldb_private::ObjectFile::CreateSections(), GetObjectFile(), GetUnifiedSectionList(), m_sections_up, and ObjectFile.
Referenced by IsLoadedInTarget(), ResolveFileAddress(), and SetSymbolFileFileSpec().
|
inline |
Definition at line 833 of file Module.h.
References m_source_mappings.
|
inline |
Definition at line 835 of file Module.h.
References m_source_mappings.
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.
Definition at line 1021 of file Module.cpp.
References GetFileSpec(), and m_object_name.
Referenced by DumpModuleSections(), and lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap().
|
virtual |
Get the module's symbol file.
If the symbol file has already been loaded, this function returns it. All arguments are ignored. If the symbol file has not been located yet, and the can_create argument is false, the function returns nullptr. If can_create is true, this function will find the best SymbolFile plug-in that can use the current object file. feedback_strm, if not null, is used to report the details of the search process.
Reimplemented in lldb_private::plugin::dwarf::DebugMapModule.
Definition at line 977 of file Module.cpp.
References DebuggersOwningModuleRequestingInterruption(), lldb_private::SymbolVendor::FindPlugin(), GetObjectFile(), LLDB_SCOPED_TIMER, m_did_load_symfile, m_mutex, m_symfile_up, m_unwind_table, ObjectFile, REPORT_INTERRUPTION, and SymbolFile.
Referenced by lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::CalculateFrameVariableError(), CommandObjectTargetModulesDumpClangAST::DoExecute(), Dump(), DumpModuleSymbolFile(), FindFunctions(), FindFunctions(), FindGlobalVariables(), FindGlobalVariables(), FindTypes(), GetCompileUnitAtIndex(), GetNumCompileUnits(), GetSeparateDebugInfoList(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetSymtab(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::LinkOSOAddress(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), ParseAllDebugSymbols(), PreloadSymbols(), CommandObjectTargetModulesList::PrintModule(), ResetStatistics(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), SectionFileAddressesChanged(), and SetSymbolFileFileSpec().
|
inline |
Definition at line 484 of file Module.h.
References m_symfile_spec.
|
inline |
Definition at line 889 of file Module.h.
References m_symbol_locator_duration_map.
Get the module's symbol table.
If the symbol table has already been loaded, this function returns it. Otherwise, it will only be loaded when can_create is true.
Definition at line 1004 of file Module.cpp.
References GetSymbolFile(), and SymbolFile.
Referenced by DumpModuleSymtab(), FindFirstSymbolWithNameAndType(), FindFunctionSymbols(), FindSymbolsMatchingRegExAndType(), FindSymbolsWithNameAndType(), and DynamicLoaderMacOS::GetDyldLockVariableAddressFromModule().
|
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 887 of file Module.h.
References m_symtab_index_time.
|
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 881 of file Module.h.
References m_symtab_parse_time.
llvm::Expected< TypeSystemSP > Module::GetTypeSystemForLanguage | ( | lldb::LanguageType | language | ) |
Definition at line 376 of file Module.cpp.
References m_type_system_map.
|
protected |
Definition at line 1243 of file Module.cpp.
References m_sections_up.
Referenced by GetSectionList().
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.
Definition at line 1237 of file Module.cpp.
References lldb_private::SymbolLocator::DownloadSymbolFileAsync(), GetUUID(), m_symfile_spec, and m_unwind_table.
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.
Definition at line 350 of file Module.cpp.
References GetObjectFile(), lldb_private::ObjectFile::GetUUID(), m_did_set_uuid, m_mutex, m_uuid, and ObjectFile.
Referenced by DumpModuleUUID(), GetUnwindTable(), lldb_private::ModuleList::LogUUIDAndPaths(), MatchesModuleSpec(), DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(), and UUIDsMatch().
llvm::VersionTuple Module::GetVersion | ( | ) |
Definition at line 1600 of file Module.cpp.
References GetObjectFile(), and ObjectFile.
uint32_t Module::Hash | ( | ) |
Get a unique hash for this module.
The hash should be enough to identify the file on disk and the architecture of the file. If the module represents an object inside of a file, then the hash should include the object name and object offset to ensure a unique hash. Some examples:
Definition at line 1615 of file Module.cpp.
References m_arch, m_file, m_object_mod_time, m_object_name, and m_object_offset.
Referenced by GetCacheKey().
bool Module::IsExecutable | ( | ) |
Tells whether this module is capable of being the main executable for a process.
Definition at line 1391 of file Module.cpp.
References GetObjectFile(), and lldb_private::ObjectFile::IsExecutable().
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.
[in] | target | The target to check whether this is loaded in. |
Definition at line 1398 of file Module.cpp.
References GetObjectFile(), lldb_private::SectionList::GetSectionAtIndex(), GetSectionList(), lldb_private::SectionList::GetSize(), LLDB_INVALID_ADDRESS, and ObjectFile.
bool Module::LoadScriptingResourceInTarget | ( | Target * | target, |
Status & | error, | ||
Stream & | feedback_stream ) |
Definition at line 1415 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb_private::FileSpec::Dump(), lldb_private::eLoadScriptFromSymFileFalse, lldb_private::eLoadScriptFromSymFileWarn, error(), lldb::eScriptLanguageNone, lldb_private::Status::FromErrorString(), lldb_private::StreamString::GetData(), lldb_private::Target::GetDebugger(), GetFileSpec(), lldb_private::FileSpecList::GetFileSpecAtIndex(), lldb_private::FileSpec::GetPath(), lldb_private::Target::GetPlatform(), lldb_private::Debugger::GetScriptInterpreter(), lldb_private::Debugger::GetScriptLanguage(), lldb_private::FileSpecList::GetSize(), lldb_private::FileSystem::Instance(), lldb_private::ScriptInterpreter::LoadScriptingModule(), and lldb_private::Stream::Printf().
|
private |
Definition at line 1131 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb::eDescriptionLevelFull, lldb_private::StreamString::GetData(), GetDescription(), lldb_private::Log::PutCString(), and lldb_private::Stream::PutCString().
|
inline |
Definition at line 794 of file Module.h.
References LogMessageVerboseBacktrace().
Referenced by LogMessageVerboseBacktrace().
|
private |
Definition at line 1139 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb::eDescriptionLevelFull, lldb_private::StreamString::GetData(), GetDescription(), lldb_private::Log::GetVerbose(), lldb_private::Log::PutCString(), and lldb_private::Stream::PutCString().
bool Module::MatchesModuleSpec | ( | const ModuleSpec & | module_ref | ) |
Definition at line 1503 of file Module.cpp.
References lldb_private::ModuleSpec::GetArchitecture(), lldb_private::ModuleSpec::GetFileSpec(), GetObjectName(), lldb_private::ModuleSpec::GetObjectName(), GetPlatformFileSpec(), lldb_private::ModuleSpec::GetPlatformFileSpec(), GetUUID(), lldb_private::ModuleSpec::GetUUID(), lldb_private::ArchSpec::IsValid(), lldb_private::UUID::IsValid(), m_arch, m_file, m_platform_file, and lldb_private::FileSpec::Match().
Referenced by FindModulesByName().
Update the ArchSpec to a more specific variant.
Definition at line 1572 of file Module.cpp.
References lldb_private::GetLog(), lldb_private::ArchSpec::GetTriple(), lldb_private::ArchSpec::IsValid(), LLDB_LOGF, m_arch, lldb_private::ArchSpec::MergeFrom(), lldb_private::Modules, lldb_private::Object, and SetArchitecture().
References Module().
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 385 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(), lldb_private::SymbolFile::ParseVariablesForContext(), and SymbolFile.
void Module::PreloadSymbols | ( | ) |
Definition at line 1314 of file Module.cpp.
References GetSymbolFile(), lldb_private::SymbolFile::GetSymtab(), m_mutex, lldb_private::SymbolFile::PreloadSymbols(), and SymbolFile.
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.
sysroot | will be added to the path remapping dictionary. |
Definition at line 1551 of file Module.cpp.
References m_source_mappings, lldb_private::Debugger::ReportError(), and lldb_private::toString().
|
delete |
std::optional< std::string > Module::RemapSourceFile | ( | llvm::StringRef | path | ) | const |
Remaps a source file given path into new_path.
Remaps path if any source remappings match. This function does NOT stat the file system so it can be used in tight loops where debug info is being parsed.
[in] | path | The original source file path to try and remap. |
Definition at line 1544 of file Module.cpp.
References m_mutex, and m_source_mappings.
|
inline |
Definition at line 806 of file Module.h.
References ReportError().
Referenced by GetObjectFile(), and ReportError().
|
private |
Definition at line 1114 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb::eDescriptionLevelBrief, GetDescription(), GetDiagnosticOnceFlag(), lldb_private::StreamString::GetString(), and lldb_private::Debugger::ReportError().
|
inline |
Definition at line 813 of file Module.h.
References ReportErrorIfModifyDetected().
Referenced by ReportErrorIfModifyDetected().
|
private |
Definition at line 1089 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb::eDescriptionLevelFull, FileHasChanged(), GetDescription(), lldb_private::StreamString::GetString(), m_first_file_changed_log, lldb_private::Stream::PutCString(), and lldb_private::Debugger::ReportError().
|
inline |
|
private |
Definition at line 1122 of file Module.cpp.
References lldb_private::Stream::AsRawOstream(), lldb::eDescriptionLevelFull, GetDescription(), GetDiagnosticOnceFlag(), lldb_private::StreamString::GetString(), and lldb_private::Debugger::ReportWarning().
void Module::ReportWarningOptimization | ( | std::optional< lldb::user_id_t > | debugger_id | ) |
Definition at line 1064 of file Module.cpp.
References GetDiagnosticOnceFlag(), lldb_private::FileSpec::GetFilename(), GetFileSpec(), lldb_private::StreamString::GetString(), lldb_private::ConstString::IsEmpty(), and lldb_private::Debugger::ReportWarning().
void Module::ReportWarningUnsupportedLanguage | ( | lldb::LanguageType | language, |
std::optional< lldb::user_id_t > | debugger_id ) |
Definition at line 1078 of file Module.cpp.
References GetDiagnosticOnceFlag(), lldb_private::Language::GetNameForLanguageType(), lldb_private::StreamString::GetString(), and lldb_private::Debugger::ReportWarning().
void Module::ResetStatistics | ( | ) |
Definition at line 1592 of file Module.cpp.
References GetSymbolFile(), m_symtab_index_time, m_symtab_parse_time, lldb_private::SymbolFile::ResetStatistics(), and SymbolFile.
bool Module::ResolveFileAddress | ( | lldb::addr_t | vm_addr, |
Address & | so_addr ) |
Definition at line 447 of file Module.cpp.
References GetSectionList(), m_mutex, and lldb_private::Address::ResolveAddressUsingFileSections().
Referenced by lldb_private::Value::ConvertToLoadAddress(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::LinkOSOAddress(), and LookupAddressInModule().
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.
[in] | so_addr | A load address to resolve. |
[in] | resolve_scope | The 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] | sc | The SymbolContext that is modified based on symbol resolution. |
[in] | resolve_tail_call_address | Determines 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. |
Definition at line 455 of file Module.cpp.
References lldb_private::LineEntry::ApplyFileMappings(), 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::SymbolFile::GetObjectFile(), lldb_private::Symtab::GetObjectFile(), lldb_private::Address::GetOffset(), lldb_private::Address::GetSection(), GetSymbolFile(), lldb_private::ObjectFile::GetSymtab(), lldb_private::SymbolFile::GetSymtab(), lldb_private::Address::IsSectionOffset(), lldb_private::ObjectFile::IsStripped(), lldb_private::Symbol::IsSynthetic(), lldb_private::LineEntry::IsValid(), lldb_private::SymbolContext::line_entry, m_mutex, lldb_private::SymbolContext::module_sp, ObjectFile, lldb_private::SymbolFile::ResolveSymbolContext(), ResolveSymbolContextForAddress(), lldb_private::SymbolFile::SetLoadDebugInfoEnabled(), lldb_private::Address::Slide(), lldb_private::SymbolContext::symbol, SymbolFile, and lldb_private::SymbolContext::target_sp.
Referenced by ResolveSymbolContextForAddress().
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.
[in] | file_path | A 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] | line | The source line to match, or zero if just the compile unit should be resolved. |
[in] | check_inlines | Check 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_scope | The scope that should be resolved (see SymbolContext::Scope). |
[out] | sc_list | A symbol context list that gets matching symbols contexts appended to. |
Definition at line 589 of file Module.cpp.
References 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.
[in] | file_spec | A 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] | line | The source line to match, or zero if just the compile unit should be resolved. |
[in] | check_inlines | Check 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_scope | The scope that should be resolved (see SymbolContext::Scope). |
[out] | sc_list | A symbol context list that gets filled in with all of the matches. |
Definition at line 597 of file Module.cpp.
References lldb_private::FileSpec::GetPath(), lldb_private::SymbolContextList::GetSize(), GetSymbolFile(), LLDB_SCOPED_TIMERF, m_mutex, and SymbolFile.
Referenced by ResolveSymbolContextForFilePath().
|
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 1229 of file Module.cpp.
References GetObjectFile(), GetSymbolFile(), ObjectFile, lldb_private::ObjectFile::SectionFileAddressesChanged(), and SymbolFile.
void Module::SetFileSpecAndObjectName | ( | const FileSpec & | file, |
ConstString | object_name ) |
Definition at line 1010 of file Module.cpp.
References lldb_private::FileSystem::GetModificationTime(), lldb_private::FileSystem::Instance(), m_file, m_mod_time, and m_object_name.
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.
[in] | target | The target in which to apply the section load addresses. |
[in] | value | if 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_offset | If 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] | changed | If 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. |
Definition at line 1491 of file Module.cpp.
References GetObjectFile(), ObjectFile, and lldb_private::ObjectFile::SetLoadAddress().
|
inline |
Definition at line 474 of file Module.h.
References m_platform_file.
|
inline |
Definition at line 480 of file Module.h.
References m_remote_install_file.
void Module::SetSymbolFileFileSpec | ( | const FileSpec & | file | ) |
Definition at line 1330 of file Module.cpp.
References lldb_private::ObjectFile::ClearSymtab(), lldb_private::SectionList::DeleteSection(), lldb_private::ObjectFile::GetFileSpec(), lldb_private::SectionList::GetNumSections(), lldb_private::SymbolFile::GetObjectFile(), lldb_private::FileSpec::GetPath(), lldb_private::SectionList::GetSectionAtIndex(), GetSectionList(), GetSymbolFile(), lldb_private::FileSystem::Instance(), m_did_load_symfile, m_objfile_sp, m_old_symfiles, m_symfile_spec, m_symfile_up, ObjectFile, and SymbolFile.
|
protected |
Definition at line 365 of file Module.cpp.
References lldbassert, m_did_set_uuid, m_mutex, and m_uuid.
|
protected |
Definition at line 1259 of file Module.cpp.
References lldb_private::SymbolContextList::Append(), CalculateSymbolContext(), lldb_private::SymbolContext::symbol, and lldb_private::Symtab::SymbolAtIndex().
Referenced by FindSymbolsMatchingRegExAndType(), and FindSymbolsWithNameAndType().
|
friend |
|
friend |
Definition at line 1091 of file Module.h.
References ObjectFile.
Referenced by Dump(), GetIsDynamicLinkEditor(), GetMemoryObjectFile(), GetObjectFile(), GetSectionList(), GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetUUID(), GetVersion(), IsLoadedInTarget(), ObjectFile, ResolveSymbolContextForAddress(), SectionFileAddressesChanged(), SetLoadAddress(), and SetSymbolFileFileSpec().
|
friend |
Definition at line 1092 of file Module.h.
References SymbolFile.
Referenced by Dump(), FindFunctions(), FindFunctions(), FindGlobalVariables(), FindGlobalVariables(), FindTypes(), GetCompileUnitAtIndex(), GetNumCompileUnits(), GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetSymtab(), ParseAllDebugSymbols(), PreloadSymbols(), ResetStatistics(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), SectionFileAddressesChanged(), SetSymbolFileFileSpec(), SymbolFile, and lldb_private::plugin::dwarf::DebugMapModule::~DebugMapModule().
|
protected |
The architecture for this module.
Definition at line 1009 of file Module.h.
Referenced by GetArchitecture(), GetCacheKey(), GetDescription(), GetMemoryObjectFile(), GetObjectFile(), Hash(), MatchesModuleSpec(), MergeArchitecture(), Module(), Module(), SetArchitecture(), and ~Module().
|
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 1031 of file Module.h.
Referenced by FileHasChanged(), GetObjectFile(), and Module().
|
protected |
Definition at line 1078 of file Module.h.
Referenced by GetDiagnosticOnceFlag().
|
protected |
Definition at line 1057 of file Module.h.
Referenced by GetMemoryObjectFile(), and GetObjectFile().
|
protected |
Definition at line 1058 of file Module.h.
Referenced by GetSymbolFile(), and SetSymbolFileFileSpec().
|
protected |
|
protected |
The file representation on disk for this module (if there is one).
Definition at line 1012 of file Module.h.
Referenced by Dump(), FileHasChanged(), FindAddressesForLine(), GetCacheKey(), GetDescription(), GetFileSpec(), GetObjectFile(), GetPlatformFileSpec(), Hash(), MatchesModuleSpec(), Module(), Module(), SetFileSpecAndObjectName(), and ~Module().
|
mutableprotected |
|
protected |
|
protected |
The modification time for this module when it was created.
Definition at line 1007 of file Module.h.
Referenced by FileHasChanged(), GetModificationTime(), Module(), Module(), and SetFileSpecAndObjectName().
|
mutableprotected |
A mutex to keep this object happy in multi-threaded environments.
Definition at line 1003 of file Module.h.
Referenced by Dump(), FindSourceFile(), GetCompileUnitAtIndex(), GetMemoryObjectFile(), GetMutex(), GetNumCompileUnits(), GetObjectFile(), GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), GetUUID(), ParseAllDebugSymbols(), PreloadSymbols(), RemapSourceFile(), ResolveFileAddress(), ResolveSymbolContextForAddress(), ResolveSymbolContextsForFileSpec(), SetUUID(), and ~Module().
|
protected |
|
protected |
The name an object within this module that is selected, or empty of the module is represented by m_file.
Definition at line 1022 of file Module.h.
Referenced by Dump(), GetCacheKey(), GetDescription(), GetMemoryObjectFile(), GetObjectName(), GetSpecificationDescription(), Hash(), Module(), Module(), SetFileSpecAndObjectName(), and ~Module().
|
protected |
Definition at line 1025 of file Module.h.
Referenced by GetObjectFile(), GetObjectOffset(), Hash(), Module(), and Module().
|
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 1033 of file Module.h.
Referenced by GetMemoryObjectFile(), GetObjectFile(), SetSymbolFileFileSpec(), and ~Module().
|
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 1042 of file Module.h.
Referenced by SetSymbolFileFileSpec().
|
protected |
The path to the module on the platform on which it is being debugged.
Definition at line 1014 of file Module.h.
Referenced by GetPlatformFileSpec(), MatchesModuleSpec(), Module(), and SetPlatformFileSpec().
|
protected |
If set when debugging on remote platforms, this module will be installed at this location.
Definition at line 1016 of file Module.h.
Referenced by GetRemoteInstallFileSpec(), and SetRemoteInstallFileSpec().
|
protected |
Unified section list for module that is used by the ObjectFile and ObjectFile instances for the debug info.
Definition at line 1053 of file Module.h.
Referenced by GetSectionList(), GetUnifiedSectionList(), and ~Module().
|
protected |
A set of hashes of all warnings and errors, to avoid reporting them multiple times to the same Debugger.
Definition at line 1077 of file Module.h.
Referenced by GetDiagnosticOnceFlag().
|
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 1050 of file Module.h.
Referenced by FindSourceFile(), GetSourceMappingList(), GetSourceMappingList(), RegisterXcodeSDK(), and RemapSourceFile().
|
protected |
Definition at line 1072 of file Module.h.
Referenced by GetSymbolLocatorStatistics().
|
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 1019 of file Module.h.
Referenced by GetSymbolFileFileSpec(), GetUnwindTable(), Module(), and SetSymbolFileFileSpec().
|
protected |
A pointer to the symbol vendor for this module.
Definition at line 1040 of file Module.h.
Referenced by GetSymbolFile(), lldb_private::plugin::dwarf::DebugMapModule::GetSymbolFile(), SetSymbolFileFileSpec(), and ~Module().
|
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 1070 of file Module.h.
Referenced by GetSymtabIndexTime(), and ResetStatistics().
|
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 1066 of file Module.h.
Referenced by GetSymtabParseTime(), and ResetStatistics().
|
protected |
A map of any type systems associated with this module.
Definition at line 1046 of file Module.h.
Referenced by ForEachTypeSystem(), and GetTypeSystemForLanguage().
|
protected |
Table of FuncUnwinders objects created for this Module's functions.
Definition at line 1036 of file Module.h.
Referenced by GetMemoryObjectFile(), GetObjectFile(), GetSymbolFile(), GetUnwindTable(), Module(), Module(), and Module().
|
protected |