16#include "llvm/Support/Error.h"
25 uint32_t concrete_frame_idx,
56 {reg, std::make_unique<WasmVirtualRegisterInfo>(
59 return it->second.get();
72static llvm::Expected<DataBufferSP>
74 uint32_t frame_index, uint32_t module_id) {
114 llvm::Expected<DataBufferSP> maybe_buffer =
118 "Failed to read Wasm value: {0}");
125 wasm_reg_info->
byte_size = buffer_sp->GetByteSize();
129 *reg_info, reg_data, reg_info->
byte_offset,
false);
130 return error.Success();
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERROR(log, error,...)
static llvm::Expected< DataBufferSP > ReadWasmValue(ProcessWasm &process, const WasmVirtualRegisterInfo ®_info, uint32_t frame_index, uint32_t module_id)
A local and an operand stack value belong to the frame, while a global belongs to the module instance...
lldb::ByteOrder GetByteOrder() const
uint32_t GetAddressByteSize() const
uint32_t m_concrete_frame_idx
uint64_t GetPC(uint64_t fail_value=LLDB_INVALID_ADDRESS)
virtual Thread & GetThread()
bool SetUInt(uint64_t uint, uint32_t byte_size)
Status SetValueFromData(const RegisterInfo ®_info, DataExtractor &data, lldb::offset_t offset, bool partial_data_ok)
lldb::ProcessSP GetProcess() const
friend class ThreadGDBRemote
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &value) override
lldb::DynamicRegisterInfoSP m_reg_info_sp
bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value) override
GDBRemoteRegisterContext(ThreadGDBRemote &thread, uint32_t concrete_frame_idx, lldb::DynamicRegisterInfoSP reg_info_sp, bool read_all_at_once, bool write_all_at_once)
ProcessWasm provides the access to the Wasm program state retrieved from the Wasm engine.
llvm::Expected< lldb::DataBufferSP > GetWasmGlobalForModule(uint32_t module_id, uint32_t index)
Query the value of the global at index in the global index space of the module instance module_id nam...
llvm::Expected< lldb::DataBufferSP > GetWasmVariable(WasmVirtualRegisterKinds kind, uint32_t frame_index, uint32_t index)
Query the value of a frame-scoped WebAssembly variable, which is a local or a value on the operand st...
llvm::Expected< lldb::DataBufferSP > GetWasmGlobalForFrame(uint32_t frame_index, uint32_t index)
Query the value of a WebAssembly global through the frame at frame_index, which reaches only the glob...
bool CanNameInstance(uint32_t module_id)
Whether the instance holding a global can be named to the stub, which needs both a valid id to name i...
const RegisterInfo * GetRegisterInfoAtIndex(size_t reg) override
const RegisterSet * GetRegisterSet(size_t reg_set) override
size_t GetRegisterCount() override
bool WriteRegister(const RegisterInfo *reg_info, const RegisterValue &value) override
RegisterContextWasm(process_gdb_remote::ThreadGDBRemote &thread, uint32_t concrete_frame_idx, lldb::DynamicRegisterInfoSP reg_info_sp)
uint32_t GetModuleID()
The module whose code this context's frame is executing.
uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) override
Convert from a given register numbering scheme to the lldb register numbering scheme.
void InvalidateAllRegisters() override
size_t GetRegisterSetCount() override
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &value) override
~RegisterContextWasm() override
std::unordered_map< size_t, std::unique_ptr< WasmVirtualRegisterInfo > > m_register_map
ProcessWasm provides the access to the Wasm program state retrieved from the Wasm engine.
lldb::addr_t GetConcreteFramePC(uint32_t concrete_frame_idx)
Return the program counter the Wasm unwinder recorded for the given concrete frame index,...
#define LLDB_INVALID_ADDRESS
uint32_t GetWasmModuleID(lldb::addr_t addr)
The module an address belongs to, or kWasmInvalidModuleID for an invalid address.
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.
@ eWasmTagNotAWasmLocation
uint32_t GetWasmVirtualRegisterTag(size_t reg)
uint32_t GetWasmVirtualRegisterIndex(size_t reg)
std::shared_ptr< lldb_private::DynamicRegisterInfo > DynamicRegisterInfoSP
@ eEncodingUint
unsigned integer
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
RegisterKind
Register numbering types.
Every register is described in detail including its name, alternate name (optional),...
lldb::Encoding encoding
Encoding of the register bits.
uint32_t byte_offset
The byte offset in the register context data where this register's value is found.
uint32_t byte_size
Size in bytes of the register.
const char * name
Name of this register, can't be NULL.
Registers are grouped into register sets.
WasmVirtualRegisterKinds kind