59 const uintptr_t rhs_value =
61 if ((rhs_value != 0) &&
63 m_data_buffer.CopyData(v.m_data_buffer.GetBytes(),
64 v.m_data_buffer.GetByteSize());
66 m_value = (uintptr_t)m_data_buffer.GetBytes();
77 const uintptr_t rhs_value =
79 if ((rhs_value != 0) &&
106 strm->
Printf(
", value_type = %s, context = %p, context_type = %s",
129 switch (address_type) {
139 llvm_unreachable(
"Unexpected address type!");
165 if (scalar_size > 0) {
166 const size_t new_size = curr_size + scalar_size;
180 if (src && src_len > 0) {
181 const size_t new_size = curr_size + src_len;
183 ::memcpy(
m_data_buffer.GetBytes() + curr_size, src, src_len);
230 if (error_ptr && error_ptr->
Success())
242 if (error_ptr && error_ptr->
Success())
332 std::optional<uint64_t> type_size =
336 if (type_size && *type_size == 0)
353 uint32_t result_byte_size = *type_size;
354 if (
m_value.GetData(data, result_byte_size))
361 if (exe_ctx ==
nullptr) {
363 "can't read load address (no execution context)");
366 if (process ==
nullptr || !process->
IsAlive()) {
385 "can't read load address (invalid process)");
399 if (exe_ctx ==
nullptr) {
401 "can't read file address (no execution context)");
410 if (module ==
nullptr) {
417 module = var_sc.module_sp.get();
422 bool resolved =
false;
423 ObjectFile *objfile =
module->GetObjectFile();
428 bool process_launched_and_stopped =
435 process_launched_and_stopped) {
437 address = load_address;
447 file_so_addr = so_addr;
459 "unable to resolve the module for file address 0x%" PRIx64
460 " for variable '%s' in %s",
465 "unable to resolve the module for file address 0x%" PRIx64
471 "unable to resolve the module for file address 0x%" PRIx64
472 " for variable '%s'",
476 "unable to resolve the module for file address 0x%" PRIx64,
484 "can't read memory from file address without more context");
498 : target->GetArchitecture().GetByteOrder());
515 "invalid %s address",
534 auto data_sp = std::make_shared<DataBufferHeap>(byte_size,
'\0');
538 uint8_t *dst =
const_cast<uint8_t *
>(data.
PeekData(0, byte_size));
539 if (dst !=
nullptr) {
547 memcpy(dst,
reinterpret_cast<uint8_t *
>(address), byte_size);
551 const bool force_live_memory =
true;
553 error, force_live_memory) !=
556 "read memory from 0x%" PRIx64
" failed", (uint64_t)address);
566 const size_t bytes_read =
568 if (bytes_read != byte_size)
570 "read memory from 0x%" PRIx64
" failed (%u of %u bytes read)",
571 (uint64_t)address, (uint32_t)bytes_read, (uint32_t)byte_size);
574 "read memory from 0x%" PRIx64
" failed (invalid process)",
580 "unsupported AddressType value (%i)", address_type);
605 if (
error.Success()) {
613 if ((uintptr_t)addr != (uintptr_t)
m_data_buffer.GetBytes()) {
619 if ((uintptr_t)addr != (uintptr_t)
m_data_buffer.GetBytes()) {
646 switch (value_type) {
652 return "file address";
654 return "load address";
656 return "host address";
658 llvm_unreachable(
"enum cases exhausted.");
662 switch (context_type) {
666 return "RegisterInfo *";
672 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=nullptr) 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(lldb::addr_t vm_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.
uint32_t byte_size
Size in bytes of the register.
lldb::Format format
Default display format.