31 return Status(
"register %" PRIu32
" not found", reg_index);
40 uint32_t reg_to_write = reg_index;
45 assert(reg_info &&
"Expected valid register info for reg_index.");
66 *full_reg_info, dst.
data(), dst.size(), byte_order,
error);
67 if (
error.Success() && dest_size) {
72 *reg_info, src.
data(), src.size(), byte_order,
error);
73 if (
error.Success() && src_size && (src_size < dest_size)) {
75 memcpy(dst.data() + (reg_info->
byte_offset & 0x1), src.data(),
80 value_to_write.
SetType(*full_reg_info);
81 reg_to_write = full_reg;
88 assert(register_to_write_info_p &&
89 "register to write does not have valid RegisterInfo");
90 if (!register_to_write_info_p)
91 return Status(
"NativeRegisterContextLinux::%s failed to get RegisterInfo "
92 "for write register index %" PRIu32,
93 __FUNCTION__, reg_to_write);
122 unsigned int regset) {
124 static_cast<void *
>(®set), buf,
129 unsigned int regset) {
131 static_cast<void *
>(®set), buf,
136 const char *reg_name,
143 PTRACE_PEEKUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset),
148 value.
SetUInt(
static_cast<unsigned long>(data), size);
150 LLDB_LOG(log,
"{0}: {1:x}", reg_name, data);
155 uint32_t offset,
const char *reg_name,
const RegisterValue &value) {
158 void *buf =
reinterpret_cast<void *
>(value.
GetAsUInt64());
159 LLDB_LOG(log,
"{0}: {1}", reg_name, buf);
162 PTRACE_POKEUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset), buf);
165llvm::Expected<ArchSpec>
168 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(gpr64_size);
170 iov.iov_base = data.get();
171 iov.iov_len = gpr64_size;
172 unsigned int regset = llvm::ELF::NT_PRSTATUS;
177 return HostInfo::GetArchitecture(
178 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
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).