31 return Status(
"register %" PRIu32
" not found", reg_index);
34 reg_info->byte_size, reg_value);
45 assert(reg_info &&
"Expected valid register info for reg_index.");
46 if (reg_info->invalidate_regs &&
51 uint32_t full_reg = reg_info->invalidate_regs[0];
66 *full_reg_info, dst,
sizeof(dst), byte_order,
error);
67 if (
error.Success() && dest_size) {
72 *reg_info, src,
sizeof(src), byte_order,
error);
73 if (
error.Success() && src_size && (src_size < dest_size)) {
75 memcpy(dst + (reg_info->byte_offset & 0x1), src, src_size);
78 value_to_write.
SetType(*full_reg_info);
79 reg_to_write = full_reg;
84 const RegisterInfo *
const register_to_write_info_p =
86 assert(register_to_write_info_p &&
87 "register to write does not have valid RegisterInfo");
88 if (!register_to_write_info_p)
89 return Status(
"NativeRegisterContextLinux::%s failed to get RegisterInfo "
90 "for write register index %" PRIu32,
91 __FUNCTION__, reg_to_write);
120 unsigned int regset) {
122 static_cast<void *
>(®set), buf,
127 unsigned int regset) {
129 static_cast<void *
>(®set), buf,
134 const char *reg_name,
141 PTRACE_PEEKUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset),
146 value.
SetUInt(
static_cast<unsigned long>(data), size);
148 LLDB_LOG(log,
"{0}: {1:x}", reg_name, data);
156 void *buf =
reinterpret_cast<void *
>(value.
GetAsUInt64());
157 LLDB_LOG(log,
"{0}: {1}", reg_name, buf);
160 PTRACE_POKEUSER,
m_thread.
GetID(),
reinterpret_cast<void *
>(offset), buf);
163llvm::Expected<ArchSpec>
166 std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(gpr64_size);
168 iov.iov_base = data.get();
169 iov.iov_len = gpr64_size;
170 unsigned int regset = llvm::ELF::NT_PRSTATUS;
175 return HostInfo::GetArchitecture(
176 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::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.