42 module_sp,
nullptr,
nullptr);
56 llvm::Expected<ModuleSP> module_sp_or_err =
57 process_sp->ReadModuleFromMemory(
FileSpec(), header_addr);
58 if (
auto err = module_sp_or_err.takeError()) {
59 llvm::consumeError(std::move(err));
65 Target &target = process_sp->GetTarget();
67 m_opaque_sp->SetLoadAddress(target, 0,
true, changed);
85 return this->
operator bool();
87SBModule::operator
bool()
const {
106 ObjectFile *obj_file = module_sp->GetObjectFile();
130 file_spec.
SetFileSpec(module_sp->GetPlatformFileSpec());
142 module_sp->SetPlatformFileSpec(*platform_file);
155 sb_file_spec.
SetFileSpec(module_sp->GetRemoteInstallFileSpec());
164 module_sp->SetRemoteInstallFileSpec(file.
ref());
173 const uint8_t *uuid_bytes =
nullptr;
176 uuid_bytes = module_sp->GetUUID().GetBytes().data();
192 const char *uuid_cstr =
196 if (uuid_cstr && uuid_cstr[0])
228 if (module_sp->ResolveFileAddress(vm_addr, addr))
229 sb_addr.
ref() = addr;
236 uint32_t resolve_scope) {
241 SymbolContextItem scope =
static_cast<SymbolContextItem
>(resolve_scope);
242 if (module_sp && addr.
IsValid())
243 module_sp->ResolveSymbolContextForAddress(addr.
ref(), scope, *sb_sc);
266 return module_sp->GetNumCompileUnits();
277 CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(index);
278 sb_cu.
reset(cu_sp.get());
288 if (sb_file_spec.
IsValid() && module_sp) {
289 module_sp->FindCompileUnits(*sb_file_spec, *sb_sc_list);
296 return module_sp->GetSymtab();
305 return symtab->GetNumSymbols();
325 if (name && name[0]) {
341 if (name && name[0]) {
345 std::vector<uint32_t> matching_symbol_indexes;
347 matching_symbol_indexes);
348 const size_t num_matches = matching_symbol_indexes.size();
353 for (
size_t i = 0; i < num_matches; ++i) {
370 module_sp->GetSymbolFile();
371 SectionList *section_list = module_sp->GetSectionList();
373 return section_list->
GetSize();
385 module_sp->GetSymbolFile();
386 SectionList *section_list = module_sp->GetSectionList();
395 uint32_t name_type_mask) {
400 if (name && module_sp) {
405 FunctionNameType type =
static_cast<FunctionNameType
>(name_type_mask);
407 function_options, *sb_sc_list);
413 uint32_t max_matches) {
418 if (name && module_sp) {
421 max_matches, variable_list);
422 for (
const VariableSP &var_sp : variable_list) {
431 return sb_value_list;
448 if (name_cstr && module_sp) {
452 module_sp->FindTypes(query, results);
457 auto type_system_or_err =
459 if (
auto err = type_system_or_err.takeError()) {
460 llvm::consumeError(std::move(err));
464 if (
auto ts = *type_system_or_err)
465 return SBType(ts->GetBuiltinTypeByName(name));
475 auto type_system_or_err =
477 if (
auto err = type_system_or_err.takeError()) {
478 llvm::consumeError(std::move(err));
480 if (
auto ts = *type_system_or_err)
481 return SBType(ts->GetBasicTypeFromAST(type));
493 if (type && module_sp) {
497 module_sp->FindTypes(query, results);
500 auto type_system_or_err =
502 if (
auto err = type_system_or_err.takeError()) {
503 llvm::consumeError(std::move(err));
505 if (
auto ts = *type_system_or_err)
506 if (
CompilerType compiler_type = ts->GetBuiltinTypeByName(name))
522 if (
SymbolFile *symfile = module_sp->GetSymbolFile()) {
523 Type *type_ptr = symfile->ResolveTypeUID(uid);
525 return SBType(type_ptr->shared_from_this());
539 SymbolFile *symfile = module_sp->GetSymbolFile();
543 TypeClass type_class =
static_cast<TypeClass
>(type_mask);
545 symfile->
GetTypes(
nullptr, type_class, type_list);
556 if (sect_name && module_sp) {
558 module_sp->GetSymbolFile();
559 SectionList *section_list = module_sp->GetSectionList();
563 sb_section.
SetSP(section_sp);
575 return module_sp->GetArchitecture().GetByteOrder();
586 std::string triple(module_sp->GetArchitecture().GetTriple().str());
599 return module_sp->GetArchitecture().GetAddressByteSize();
600 return sizeof(
void *);
606 llvm::VersionTuple version;
608 version = module_sp->GetVersion();
610 if (!version.empty())
612 if (version.getMinor())
614 if (version.getSubminor())
620 if (num_versions > 0)
621 versions[0] = version.empty() ?
UINT32_MAX : version.getMajor();
622 if (num_versions > 1)
623 versions[1] = version.getMinor().value_or(
UINT32_MAX);
624 if (num_versions > 2)
625 versions[2] = version.getSubminor().value_or(
UINT32_MAX);
626 for (uint32_t i = 3; i < num_versions; ++i)
637 if (
SymbolFile *symfile = module_sp->GetSymbolFile())
638 sb_file_spec.
SetFileSpec(symfile->GetObjectFile()->GetFileSpec());
658 ObjectFile *objfile_ptr = module_sp->GetObjectFile();
671 ObjectFile *objfile_ptr = module_sp->GetObjectFile();
687 const bool mandatory =
false;
696 return m_opaque_sp->GetObjectName().AsCString(
nullptr);
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
static Symtab * GetUnifiedSymbolTable(const lldb::ModuleSP &module_sp)
lldb_private::Address & ref()
void reset(lldb_private::CompileUnit *lldb_object_ptr)
void SetFileSpec(const lldb_private::FileSpec &fspec)
const lldb_private::FileSpec & ref() const
std::unique_ptr< lldb_private::ModuleSpec > m_opaque_up
bool GetDescription(lldb::SBStream &description)
lldb::SBTypeList GetTypes(uint32_t type_mask=lldb::eTypeClassAny)
Get all types matching type_mask from debug info in this module.
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target, const char *name)
Find the first global (or static) variable by name.
void SetSP(const ModuleSP &module_sp)
lldb::SBType FindFirstType(const char *name)
lldb::SBAddress GetObjectFileEntryPointAddress() const
uint32_t GetAddressByteSize()
uint32_t GetNumCompileUnits()
lldb::SBTypeList FindTypes(const char *type)
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target, const char *name, uint32_t max_matches)
Find global and static variables by name.
static void GarbageCollectAllocatedModules()
Remove any global modules which are no longer needed.
static uint32_t GetNumberAllocatedModules()
Get the number of global modules.
lldb::SBFileSpec GetSymbolFileSpec() const
Get accessor for the symbol file specification.
lldb::SBSymbol GetSymbolAtIndex(size_t idx)
lldb::ModuleSP m_opaque_sp
lldb::SBSymbol FindSymbol(const char *name, lldb::SymbolType type=eSymbolTypeAny)
lldb::SBAddress ResolveFileAddress(lldb::addr_t vm_addr)
bool IsFileBacked() const
friend class SBSymbolContext
const uint8_t * GetUUIDBytes() const
lldb::SBFileSpec GetRemoteInstallFileSpec()
Get accessor for the remote install path for a module.
lldb::SBModuleSpecList GetSeparateDebugInfoFiles()
Get the separate debug info files for this module.
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions)
Get the module version numbers.
lldb::SBType GetTypeByID(lldb::user_id_t uid)
Get a type using its type ID.
lldb::SBSection FindSection(const char *sect_name)
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t)
lldb::SBSection GetSectionAtIndex(size_t idx)
lldb::SBSymbolContextList FindSymbols(const char *name, lldb::SymbolType type=eSymbolTypeAny)
bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file)
Set accessor for the remote install path for a module.
const char * GetObjectName() const
If this Module represents a specific object or part within a larger file, returns the name of that ob...
bool operator==(const lldb::SBModule &rhs) const
lldb::SBSymbolContextList FindFunctions(const char *name, uint32_t name_type_mask=lldb::eFunctionNameTypeAny)
Find functions by name.
lldb::SBAddress GetObjectFileHeaderAddress() const
lldb::SBFileSpec GetFileSpec() const
Get const accessor for the module file specification.
lldb::SBSymbolContextList FindCompileUnits(const lldb::SBFileSpec &sb_file_spec)
Find compile units related to *this module and passed source file.
lldb::ByteOrder GetByteOrder()
const SBModule & operator=(const SBModule &rhs)
bool operator!=(const lldb::SBModule &rhs) const
const char * GetUUIDString() const
lldb::SBFileSpec GetPlatformFileSpec() const
Get accessor for the module platform file specification.
lldb::SBSymbolContext ResolveSymbolContextForAddress(const lldb::SBAddress &addr, uint32_t resolve_scope)
bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file)
lldb::SBType GetBasicType(lldb::BasicType type)
lldb::ProcessSP GetSP() const
void SetSP(const lldb::SectionSP §ion_sp)
lldb_private::Stream & ref()
void SetSymbol(lldb_private::Symbol *lldb_object_ptr)
lldb::TargetSP GetSP() const
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
void Append(lldb::SBType type)
void Append(const lldb::SBValue &val_obj)
lldb::SBValue GetValueAtIndex(uint32_t idx) const
A section + offset based address class.
Represents a generic declaration context in a program.
Generic representation of a type in a programming language.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
static Status GetSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr, bool invoke_locate_callback=true, bool invoke_symbol_locators=true)
void Append(const lldb::ModuleSP &module_sp, bool notify=true)
Append a module to the module list.
static size_t RemoveOrphanSharedModules(bool mandatory)
static size_t GetNumberAllocatedModules()
A plug-in interface definition class for object file parsers.
virtual lldb_private::Address GetEntryPointAddress()
Returns the address of the Entry Point in this object file - if the object file doesn't have an entry...
bool IsInMemory() const
Returns true if the object file exists only in memory.
virtual lldb_private::Address GetBaseAddress()
Returns base address of this object file.
lldb::SectionSP FindSectionByName(llvm::StringRef section_name) const
lldb::SectionSP GetSectionAtIndex(size_t idx) const
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
const char * Intern(llvm::StringRef str) const
static StringPoolRef GetSystemPool()
The system pool. Only valid between Initialize and Terminate.
Defines a list of symbol context objects.
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
Defines a symbol context baton that can be handed other debug core functions.
lldb::ModuleSP module_sp
The Module for a given query.
Symbol * symbol
The Symbol for a given query.
Provides public interface for all SymbolFiles.
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope, lldb::TypeClass type_mask, lldb_private::TypeList &type_list)=0
Symbol * SymbolAtIndex(size_t idx)
Symbol * FindFirstSymbolWithNameAndType(ConstString name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility)
void FindAllSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, std::vector< uint32_t > &symbol_indexes)
const ModuleList & GetImages() const
Get accessor for the images for this process.
TypeIterable Types() const
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
lldb::TypeSP GetFirstType() const
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
A class that represents a running process on the host machine.
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eLanguageTypeC
Non-standardized C, such as K&R.
class LLDB_API SBModuleSpecList
std::shared_ptr< lldb_private::Type > TypeSP
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::Module > ModuleSP
std::shared_ptr< lldb_private::CompileUnit > CompUnitSP
Options used by Module::FindFunctions.
bool include_inlines
Include inlined functions.
bool include_symbols
Include the symbol table.