35#include "llvm/ADT/StringRef.h"
36#include "llvm/Support/Error.h"
66 m_name = var_sp->GetName();
99llvm::Expected<uint32_t>
104 return llvm::createStringError(
"invalid type");
107 const bool omit_empty_base_classes =
true;
108 auto child_count = type.
GetNumChildren(omit_empty_base_classes, &exe_ctx);
111 return *child_count <= max ? *child_count : max;
162 loclist_base_load_addr =
166 llvm::Expected<Value> maybe_value = expr_list.
Evaluate(
167 &exe_ctx,
nullptr, loclist_base_load_addr,
nullptr,
nullptr);
173 expr_list.
IsImplicit(&exe_ctx,
nullptr, loclist_base_load_addr);
178 m_value.SetCompilerType(compiler_type);
183 if (llvm::Error err =
184 runtime->FixupVariableLocation(*variable,
m_value)) {
206 if (
size_t value_buf_size =
m_value.GetBuffer().GetByteSize()) {
208 if (
m_error.Success() && value_buf_size < value_size)
209 m_value.ResizeData(value_size);
214 const bool process_is_alive = process && process->
IsAlive();
216 switch (value_type) {
262 llvm::consumeError(maybe_value.takeError());
281 const bool process_is_alive = process && process->
IsAlive();
283 const bool is_pointer_or_ref =
284 (type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0;
286 switch (value_type) {
307 if (process_is_alive && is_pointer_or_ref)
318 if (is_pointer_or_ref)
383 return llvm::createStringError(
"variable is not in a writable location");
404 if (!reg_info || !reg_ctx) {
438 if (!reg_info || !reg_ctx) {
static llvm::raw_ostream & error(Stream &strm)
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
static std::shared_ptr< ClusterManager > Create()
Generic representation of a type in a programming language.
lldb::LanguageType GetMinimumLanguage()
ConstString GetDisplayTypeName() const
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
A uniqued constant string class.
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
bool IsAlwaysValidSingleExpr() const
bool IsImplicit(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr) const
Return true if the expression in scope at the current PC produces an implicit location,...
llvm::Expected< Value > Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr) const
bool GetExpressionData(DataExtractor &data, lldb::addr_t func_load_addr=LLDB_INVALID_ADDRESS, lldb::addr_t file_addr=0) const
Get the expression data at the file address.
A class that describes the declaration location of a lldb object.
Execution context objects refer to objects in the execution of the program that is being debugged.
bool HasFrameRef() const
Returns true if this object has a weak reference to a frame.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
StackFrame * GetFramePtr() const
Returns a pointer to the frame object.
Target * GetTargetPtr() const
Returns a pointer to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
RegisterContext * GetRegisterContext() const
const Address & GetAddress() const
Return the address of the function (its entry point).
A plug-in interface definition class for debugging a process.
virtual bool IsAlive()
Check if a process is still alive.
virtual bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value)=0
Status SetValueFromString(const RegisterInfo *reg_info, llvm::StringRef value_str)
Status SetValueFromData(const RegisterInfo ®_info, DataExtractor &data, lldb::offset_t offset, bool partial_data_ok)
This base class provides an interface to stack frames.
static Status FromErrorString(const char *str)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
virtual lldb::ModuleSP CalculateSymbolContextModule()
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
const ArchSpec & GetArchitecture() const
CompilerType GetForwardCompilerType()
ConstString GetQualifiedName()
ConstString GetTypeName() override
ValueObjectVariable(ExecutionContextScope *exe_scope, ValueObjectManager &manager, const lldb::VariableSP &var_sp)
~ValueObjectVariable() override
lldb::ValueType GetValueType() const override
SymbolContextScope * GetSymbolContextScope() override
lldb::ModuleSP GetModule() override
Return the module associated with this value object in case the value is from an executable file and ...
void DoUpdateChildrenAddressType(ValueObject &valobj) override
ConstString GetDisplayTypeName() override
bool SetData(DataExtractor &data, Status &error) override
const char * GetLocationAsCString() override
bool m_resolved_value_is_implicit
True when the resolved value has no writable storage in the inferior (an implicit location,...
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
Value m_resolved_value
The value that DWARFExpression resolves this variable to before we patch it up.
llvm::Error CanSetValue() override
Check if the value may be writable.
ConstString GetQualifiedTypeName() override
bool IsInScope() override
bool SetValueFromCString(const char *value_str, Status &error) override
bool UpdateValue() override
lldb::VariableSP m_variable_sp
The variable that this value object is based upon.
llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max) override
Should only be called by ValueObject::GetNumChildren().
llvm::Expected< uint64_t > GetByteSize() override
bool GetDeclaration(Declaration &decl) override
CompilerType GetCompilerTypeImpl() override
void SetValueIsValid(bool valid)
ClusterManager< ValueObject > ValueObjectManager
ValueObject(ExecutionContextScope *exe_scope, ValueObjectManager &manager, AddressType child_ptr_or_ref_addr_type=eAddressTypeLoad)
Use this constructor to create a "root variable object".
virtual llvm::Error CanSetValue()
Check if the value may be writable.
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.
bool HasNoStorage()
Returns whether objects of the type of this value occupy no memory, so that the value has no data and...
void SetValueDidChange(bool value_changed)
bool UpdateValueIfNeeded(bool update_format=true)
CompilerType GetCompilerType()
virtual const char * GetLocationAsCString()
virtual bool SetValueFromCString(const char *value_str, Status &error)
virtual bool SetData(DataExtractor &data, Status &error)
ConstString m_name
The name of this object.
const char * GetLocationAsCStringImpl(const Value &value, const DataExtractor &data)
const ExecutionContextRef & GetExecutionContextRef() const
virtual bool CanProvideValue()
const Value & GetValue() const
void SetAddressTypeOfChildren(AddressType at)
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
ValueType
Type that describes Value::m_value.
@ HostAddress
A host address value (for memory in the process that < A is using liblldb).
@ FileAddress
A file address value.
@ LoadAddress
A load address value.
@ Scalar
A raw scalar value.
ValueType GetValueType() const
void SetContext(ContextType context_type, void *p)
@ Variable
lldb_private::Variable *.
@ RegisterInfo
RegisterInfo * (can be a scalar or a vector register).
DWARFExpressionList & LocationExpressionList()
void CalculateSymbolContext(SymbolContext *sc)
bool GetLocationIsConstantValueData() const
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
@ eAddressTypeLoad
Address is an address as in the current target inferior process.
@ eAddressTypeHost
Address is an address in the process that is running this code.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::Module > ModuleSP
Every register is described in detail including its name, alternate name (optional),...