20#include "llvm/Support/Error.h"
31 SetName(llvm::formatv(
"[{0}]", func_idx).str());
46 return parent->IsInScope();
78 parent_addr = process_sp->FixCodeAddress(parent_addr);
82 llvm::Expected<lldb::addr_t> vfunc_ptr_or_err =
83 process_sp->ReadPointerFromMemory(vtable_entry_addr);
84 if (!vfunc_ptr_or_err) {
85 llvm::consumeError(vfunc_ptr_or_err.takeError());
87 "failed to read virtual function entry 0x%16.16" PRIx64,
91 addr_t vfunc_ptr = *vfunc_ptr_or_err;
93 vfunc_ptr = process_sp->FixCodeAddress(vfunc_ptr);
98 m_value.GetScalar() = vtable_entry_addr;
104 Address resolved_vfunc_ptr_address;
105 target_sp->ResolveLoadAddress(vfunc_ptr, resolved_vfunc_ptr_address);
106 if (resolved_vfunc_ptr_address.
IsValid())
118 auto type_system = target_sp->GetScratchTypeSystemForLanguage(
122 (*type_system)->CreateGenericFunctionPrototype().GetPointerType());
124 consumeError(type_system.takeError());
132 const bool thread_and_frame_only_if_stopped =
true;
143 return m_value.GetCompilerType();
168 return llvm::createStringError(
"no symbol for vtable");
201 m_flags.m_children_count_valid =
false;
217 LanguageRuntime *language_runtime = process_sp->GetLanguageRuntime(language);
219 if (language_runtime ==
nullptr) {
221 "no language runtime support for the language \"%s\"",
227 llvm::Expected<LanguageRuntime::VTableInfo> vtable_info_or_err =
229 if (!vtable_info_or_err) {
235 const addr_t vtable_start_addr =
236 vtable_info_or_err->addr.GetLoadAddress(target_sp.get());
241 "no vtable symbol found containing 0x%" PRIx64, vtable_start_addr);
251 "vtable symbol \"%s\" doesn't have a valid size",
257 const addr_t vtable_end_addr =
264 auto type_system_or_err =
266 if (type_system_or_err) {
270 consumeError(type_system_or_err.takeError());
ValueObjectVTableChild(ValueObject &parent, uint32_t func_idx, uint64_t addr_size)
const uint64_t m_addr_size
llvm::Expected< uint64_t > GetByteSize() override
bool IsInScope() override
bool UpdateValue() override
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
ValueObjectVTableChild(const ValueObjectVTableChild &)=delete
~ValueObjectVTableChild() override=default
CompilerType GetCompilerTypeImpl() override
const uint32_t m_func_idx
const ValueObjectVTableChild & operator=(const ValueObjectVTableChild &)=delete
ValueType GetValueType() const override
A section + offset based address class.
Function * CalculateSymbolContextFunction() const
bool IsValid() const
Check if the object state is valid.
Generic representation of a type in a programming language.
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
A uniqued constant string class.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class that describes a function.
CompilerType GetCompilerType()
virtual llvm::Expected< VTableInfo > GetVTableInfo(ValueObject &in_value, bool check_type)
Get the vtable information for a given value.
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
const Symbol * m_vtable_symbol
The symbol for the C++ virtual function table.
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
uint32_t m_addr_size
Cache the address size in bytes to avoid checking with the process to many times.
ConstString GetQualifiedTypeName() override
ValueObject * CreateChildAtIndex(size_t idx) override
Should only be called by ValueObject::GetChildAtIndex().
static lldb::ValueObjectSP Create(ValueObject &parent)
lldb::ValueType GetValueType() const override
ValueObjectVTable(ValueObject &parent)
~ValueObjectVTable() override
ConstString GetTypeName() override
uint32_t m_num_vtable_entries
Cache the number of vtable children when we update the value.
ConstString GetDisplayTypeName() override
CompilerType GetCompilerTypeImpl() override
bool IsInScope() override
bool UpdateValue() override
llvm::Expected< uint64_t > GetByteSize() override
void SetValueIsValid(bool valid)
struct lldb_private::ValueObject::Bitflags m_flags
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
Status m_error
An error object that can describe any errors that occur when updating values.
lldb::ProcessSP GetProcessSP() const
DataExtractor m_data
A data extractor that can be used to extract the value.
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
void SetValueDidChange(bool value_changed)
virtual lldb::ModuleSP GetModule()
Return the module associated with this value object in case the value is from an executable file and ...
lldb::LanguageType GetObjectRuntimeLanguage()
void SetName(llvm::StringRef name)
Change the name of the current ValueObject.
bool UpdateValueIfNeeded(bool update_format=true)
lldb::TargetSP GetTargetSP() const
virtual ValueObject * GetParent()
virtual void SetFormat(lldb::Format format)
const ExecutionContextRef & GetExecutionContextRef() const
virtual AddrAndType GetAddressOf(bool scalar_is_load_address=true)
@ LoadAddress
A load address value.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
std::shared_ptr< lldb_private::Process > ProcessSP
@ eValueTypeVTableEntry
function pointer in virtual function table
@ eValueTypeVTable
virtual function table
std::shared_ptr< lldb_private::Target > TargetSP