41 uint32_t reg_to_write = reg_index;
46 assert(reg_info &&
"Expected valid register info for reg_index.");
67 *full_reg_info, dst.
data(), dst.size(), byte_order,
error);
68 if (
error.Success() && dest_size) {
73 *reg_info, src.
data(), src.size(), byte_order,
error);
74 if (
error.Success() && src_size && (src_size < dest_size)) {
76 memcpy(dst.data() + (reg_info->
byte_offset & 0x1), src.data(),
81 value_to_write.
SetType(*full_reg_info);
82 reg_to_write = full_reg;
89 assert(register_to_write_info_p &&
90 "register to write does not have valid RegisterInfo");
91 if (!register_to_write_info_p)
93 "NativeRegisterContextLinux::%s failed to get RegisterInfo "
94 "for write register index %" PRIu32,
95 __FUNCTION__, reg_to_write);
124 unsigned int regset) {
126 static_cast<void *
>(®set), buf,
131 unsigned int regset) {
133 static_cast<void *
>(®set), buf,
138 const char *reg_name,
145 PTRACE_PEEKUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset),
150 value.
SetUInt(
static_cast<unsigned long>(data), size);
152 LLDB_LOG(log,
"{0}: {1:x}", reg_name, data);
157 uint32_t offset,
const char *reg_name,
const RegisterValue &value) {
160 void *buf =
reinterpret_cast<void *
>(value.
GetAsUInt64());
161 LLDB_LOG(log,
"{0}: {1}", reg_name, buf);
164 PTRACE_POKEUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset), buf);
167llvm::Expected<ArchSpec>
170 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(gpr64_size);
172 iov.iov_base = data.get();
173 iov.iov_len = gpr64_size;
174 unsigned int regset = llvm::ELF::NT_PRSTATUS;
179 return HostInfo::GetArchitecture(
180 iov.iov_len < gpr64_size ? HostInfo::eArchKind32 : HostInfo::eArchKind64);
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
lldb::ByteOrder GetByteOrder() const
const RegisterInfo * GetRegisterInfoAtIndex(uint32_t reg_index) const override
virtual Status ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value)=0
NativeThreadProtocol & m_thread
NativeProcessProtocol & GetProcess()
lldb::tid_t GetID() const
bool SetUInt(uint64_t uint, uint32_t byte_size)
uint32_t GetAsMemoryData(const RegisterInfo ®_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const
uint64_t GetAsUInt64(uint64_t fail_value=UINT64_MAX, bool *success_ptr=nullptr) const
void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order)
void SetType(RegisterValue::Type type)
uint32_t GetByteSize() const
llvm::SmallVector< uint8_t, kTypicalRegisterByteSize > BytesContainer
llvm::Error ToError() const
FIXME: Replace all uses with takeError() instead.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
bool Fail() const
Test for error condition.
static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr=nullptr, void *data=nullptr, size_t data_size=0, long *result=nullptr)
}
virtual Status ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset)
lldb::ByteOrder GetByteOrder() const
virtual Status WriteRegisterRaw(uint32_t reg_index, const RegisterValue ®_value)
virtual Status WriteRegisterSet(void *buf, size_t buf_size, unsigned int regset)
virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value)
virtual Status WriteFPR()
virtual uint32_t GetPtraceOffset(uint32_t reg_index)
virtual Status DoReadRegisterValue(uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value)
virtual size_t GetFPRSize()=0
static llvm::Expected< ArchSpec > DetermineArchitectureViaGPR(lldb::tid_t tid, size_t gpr64_size)
virtual Status WriteGPR()
virtual size_t GetGPRSize() const
virtual Status DoWriteRegisterValue(uint32_t offset, const char *reg_name, const RegisterValue &value)
virtual void * GetGPRBuffer()=0
virtual void * GetFPRBuffer()=0
#define LLDB_INVALID_REGNUM
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.
ByteOrder
Byte ordering definitions.
Every register is described in detail including its name, alternate name (optional),...
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.
llvm::ArrayRef< uint8_t > data(const uint8_t *context_base) const
const char * name
Name of this register, can't be NULL.
uint32_t * invalidate_regs
List of registers (terminated with LLDB_INVALID_REGNUM).