60 const uintptr_t rhs_value =
62 if ((rhs_value != 0) &&
64 m_data_buffer.CopyData(v.m_data_buffer.GetBytes(),
65 v.m_data_buffer.GetByteSize());
67 m_value = (uintptr_t)m_data_buffer.GetBytes();
78 const uintptr_t rhs_value =
80 if ((rhs_value != 0) &&
107 strm->
Printf(
", value_type = %s, context = %p, context_type = %s",
130 switch (address_type) {
140 llvm_unreachable(
"Unexpected address type!");
166 if (scalar_size > 0) {
167 const size_t new_size = curr_size + scalar_size;
181 if (src && src_len > 0) {
182 const size_t new_size = curr_size + src_len;
184 ::memcpy(
m_data_buffer.GetBytes() + curr_size, src, src_len);
231 if (error_ptr && error_ptr->
Success())
243 if (error_ptr && error_ptr->
Success())
333 std::optional<uint64_t> type_size =
337 if (type_size && *type_size == 0)
354 uint32_t result_byte_size = *type_size;
355 if (
m_value.GetData(data, result_byte_size))
362 if (exe_ctx ==
nullptr) {
364 "can't read load address (no execution context)");
367 if (process ==
nullptr || !process->
IsAlive()) {
386 "can't read load address (invalid process)");
400 if (exe_ctx ==
nullptr) {
402 "can't read file address (no execution context)");
411 if (module ==
nullptr) {
418 module = var_sc.module_sp.get();
423 bool resolved =
false;
424 ObjectFile *objfile =
module->GetObjectFile();
429 bool process_launched_and_stopped =
436 process_launched_and_stopped) {
438 address = load_address;
448 file_so_addr = so_addr;
460 "unable to resolve the module for file address 0x%" PRIx64
461 " for variable '%s' in %s",
466 "unable to resolve the module for file address 0x%" PRIx64
472 "unable to resolve the module for file address 0x%" PRIx64
473 " for variable '%s'",
477 "unable to resolve the module for file address 0x%" PRIx64,
485 "can't read memory from file address without more context");
496 ByteOrder byte_order = target->GetArchitecture().GetByteOrder();
500 !llvm::isa_and_present<RegisterTypeComposite>(
520 "invalid %s address",
539 auto data_sp = std::make_shared<DataBufferHeap>(byte_size,
'\0');
543 uint8_t *dst =
const_cast<uint8_t *
>(data.
PeekData(0, byte_size));
544 if (dst !=
nullptr) {
552 memcpy(dst,
reinterpret_cast<uint8_t *
>(address), byte_size);
556 const bool force_live_memory =
true;
558 error, force_live_memory) !=
561 "read memory from 0x%" PRIx64
" failed", (uint64_t)address);
571 const size_t bytes_read =
573 if (bytes_read != byte_size)
575 "read memory from 0x%" PRIx64
" failed (%u of %u bytes read)",
576 (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
579 "read memory from 0x%" PRIx64
" failed (invalid process)",
585 "unsupported AddressType value (%i)", address_type);
610 if (
error.Success()) {
618 if ((uintptr_t)addr != (uintptr_t)
m_data_buffer.GetBytes()) {
624 if ((uintptr_t)addr != (uintptr_t)
m_data_buffer.GetBytes()) {
651 switch (value_type) {
657 return "file address";
659 return "load address";
661 return "host address";
663 llvm_unreachable(
"enum cases exhausted.");
667 switch (context_type) {
671 return "RegisterInfo *";
677 llvm_unreachable(
"enum cases exhausted.");
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERRORV(log, error,...)
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool IsValid() const
Check if the object state is valid.
bool IsSectionOffset() const
Check if an address is section offset.
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.
Generic representation of a type in a programming language.
bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value, ExecutionContextScope *exe_scope) const
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
size_t GetPointerByteSize() const
AST related queries.
lldb::Format GetFormat() const
const char * AsCString(const char *value_if_empty) const
Get the string value as a C string.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
Target * GetTargetPtr() const
Returns a pointer to the target object.
Target & GetTargetRef() const
Returns a reference to the target object.
Process * GetProcessPtr() const
Returns a pointer to the process object.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
A class that describes an executable image and its associated object and symbol files.
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr)
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
A plug-in interface definition class for object file parsers.
virtual lldb::ByteOrder GetByteOrder() const =0
Gets whether endian swapping should occur when extracting data from this object file.
virtual uint32_t GetAddressByteSize() const =0
Gets the address size in bytes for the current object file.
virtual SectionList * GetSectionList(bool update_module_section_list=true)
Gets the section list for the currently selected architecture (and object for archives).
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(const ProcessAddress &process_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
lldb::StateType GetState()
Get accessor for the current process state.
virtual bool IsAlive()
Check if a process is still alive.
Target & GetTarget()
Get the target object pointer for this module.
size_t GetByteSize() const
unsigned long long ULongLong(unsigned long long fail_value=0) const
size_t GetAsMemoryData(void *dst, size_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
void Clear()
Clear the object state.
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.
bool Success() const
Test for success condition.
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Defines a symbol context baton that can be handed other debug core functions.
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
virtual size_t ReadMemory(const Address &addr, void *dst, size_t dst_len, Status &error, bool force_live_memory=false, lldb::addr_t *load_addr_ptr=nullptr, bool *did_read_live_memory=nullptr)
const ArchSpec & GetArchitecture() const
CompilerType GetForwardCompilerType()
void PushValue(const Value &value)
Value * GetValueAtIndex(size_t idx)
const Scalar & GetScalar() const
See comment on m_scalar to understand what GetScalar returns.
void AppendBytes(const void *bytes, int len)
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, Module *module)
RegisterInfo * GetRegisterInfo() const
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.
static ValueType GetValueTypeFromAddressType(AddressType address_type)
ContextType m_context_type
Value & operator=(const Value &rhs)
size_t AppendDataToHostBuffer(const Value &rhs)
ValueType GetValueType() const
void SetCompilerType(const CompilerType &compiler_type)
DataBufferHeap m_data_buffer
lldb::Format GetValueDefaultFormat()
Scalar & ResolveValue(ExecutionContext *exe_ctx, Module *module=nullptr)
static const char * GetValueTypeAsCString(ValueType context_type)
DataBufferHeap & GetBuffer()
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx)
void SetValueType(ValueType value_type)
CompilerType m_compiler_type
ContextType
Type that describes Value::m_context.
@ Variable
lldb_private::Variable *.
@ RegisterInfo
RegisterInfo * (can be a scalar or a vector register).
@ LLDBType
lldb_private::Type *.
bool GetData(DataExtractor &data)
AddressType GetValueAddressType() const
const CompilerType & GetCompilerType()
static const char * GetContextTypeAsCString(ContextType context_type)
void ConvertToLoadAddress(Module *module, Target *target)
Convert this value's file address to a load address, if possible.
size_t ResizeData(size_t len)
void SetBytes(const void *bytes, int len)
bool ValueOf(ExecutionContext *exe_ctx)
Scalar m_value
Represents a value, which can be a scalar, a load address, a file address, or a host address.
ConstString GetName() const
void CalculateSymbolContext(SymbolContext *sc)
uint8_t * GetBytes()
Get a pointer to the data.
#define LLDB_INVALID_ADDRESS
lldb::ByteOrder InlHostByteOrder()
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
bool StateIsStoppedState(lldb::StateType state, bool must_exist)
Check if a state represents a state where the process or thread is stopped.
@ 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.
Format
Display format definitions.
ByteOrder
Byte ordering definitions.
uint32_t byte_size
Size in bytes of the register.
lldb::Format format
Default display format.