aboutsummaryrefslogtreecommitdiff
path: root/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp')
-rw-r--r--source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp63
1 files changed, 32 insertions, 31 deletions
diff --git a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
index be256e972215..43253f388019 100644
--- a/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
+++ b/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp
@@ -41,18 +41,19 @@ lldb::ByteOrder NativeRegisterContextLinux::GetByteOrder() const {
return byte_order;
}
-Error NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index,
- RegisterValue &reg_value) {
+Status NativeRegisterContextLinux::ReadRegisterRaw(uint32_t reg_index,
+ RegisterValue &reg_value) {
const RegisterInfo *const reg_info = GetRegisterInfoAtIndex(reg_index);
if (!reg_info)
- return Error("register %" PRIu32 " not found", reg_index);
+ return Status("register %" PRIu32 " not found", reg_index);
return DoReadRegisterValue(reg_info->byte_offset, reg_info->name,
reg_info->byte_size, reg_value);
}
-Error NativeRegisterContextLinux::WriteRegisterRaw(
- uint32_t reg_index, const RegisterValue &reg_value) {
+Status
+NativeRegisterContextLinux::WriteRegisterRaw(uint32_t reg_index,
+ const RegisterValue &reg_value) {
uint32_t reg_to_write = reg_index;
RegisterValue value_to_write = reg_value;
@@ -60,7 +61,7 @@ Error NativeRegisterContextLinux::WriteRegisterRaw(
const RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg_index);
if (reg_info->invalidate_regs &&
(reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM)) {
- Error error;
+ Status error;
RegisterValue full_value;
uint32_t full_reg = reg_info->invalidate_regs[0];
@@ -99,71 +100,71 @@ Error NativeRegisterContextLinux::WriteRegisterRaw(
assert(register_to_write_info_p &&
"register to write does not have valid RegisterInfo");
if (!register_to_write_info_p)
- return Error("NativeRegisterContextLinux::%s failed to get RegisterInfo "
- "for write register index %" PRIu32,
- __FUNCTION__, reg_to_write);
+ return Status("NativeRegisterContextLinux::%s failed to get RegisterInfo "
+ "for write register index %" PRIu32,
+ __FUNCTION__, reg_to_write);
return DoWriteRegisterValue(reg_info->byte_offset, reg_info->name, reg_value);
}
-Error NativeRegisterContextLinux::ReadGPR() {
+Status NativeRegisterContextLinux::ReadGPR() {
void *buf = GetGPRBuffer();
if (!buf)
- return Error("GPR buffer is NULL");
+ return Status("GPR buffer is NULL");
size_t buf_size = GetGPRSize();
return DoReadGPR(buf, buf_size);
}
-Error NativeRegisterContextLinux::WriteGPR() {
+Status NativeRegisterContextLinux::WriteGPR() {
void *buf = GetGPRBuffer();
if (!buf)
- return Error("GPR buffer is NULL");
+ return Status("GPR buffer is NULL");
size_t buf_size = GetGPRSize();
return DoWriteGPR(buf, buf_size);
}
-Error NativeRegisterContextLinux::ReadFPR() {
+Status NativeRegisterContextLinux::ReadFPR() {
void *buf = GetFPRBuffer();
if (!buf)
- return Error("FPR buffer is NULL");
+ return Status("FPR buffer is NULL");
size_t buf_size = GetFPRSize();
return DoReadFPR(buf, buf_size);
}
-Error NativeRegisterContextLinux::WriteFPR() {
+Status NativeRegisterContextLinux::WriteFPR() {
void *buf = GetFPRBuffer();
if (!buf)
- return Error("FPR buffer is NULL");
+ return Status("FPR buffer is NULL");
size_t buf_size = GetFPRSize();
return DoWriteFPR(buf, buf_size);
}
-Error NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size,
- unsigned int regset) {
+Status NativeRegisterContextLinux::ReadRegisterSet(void *buf, size_t buf_size,
+ unsigned int regset) {
return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGSET, m_thread.GetID(),
static_cast<void *>(&regset), buf,
buf_size);
}
-Error NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size,
- unsigned int regset) {
+Status NativeRegisterContextLinux::WriteRegisterSet(void *buf, size_t buf_size,
+ unsigned int regset) {
return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGSET, m_thread.GetID(),
static_cast<void *>(&regset), buf,
buf_size);
}
-Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
- const char *reg_name,
- uint32_t size,
- RegisterValue &value) {
+Status NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
+ const char *reg_name,
+ uint32_t size,
+ RegisterValue &value) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
long data;
- Error error = NativeProcessLinux::PtraceWrapper(
+ Status error = NativeProcessLinux::PtraceWrapper(
PTRACE_PEEKUSER, m_thread.GetID(), reinterpret_cast<void *>(offset),
nullptr, 0, &data);
@@ -175,7 +176,7 @@ Error NativeRegisterContextLinux::DoReadRegisterValue(uint32_t offset,
return error;
}
-Error NativeRegisterContextLinux::DoWriteRegisterValue(
+Status NativeRegisterContextLinux::DoWriteRegisterValue(
uint32_t offset, const char *reg_name, const RegisterValue &value) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_REGISTERS));
@@ -186,22 +187,22 @@ Error NativeRegisterContextLinux::DoWriteRegisterValue(
PTRACE_POKEUSER, m_thread.GetID(), reinterpret_cast<void *>(offset), buf);
}
-Error NativeRegisterContextLinux::DoReadGPR(void *buf, size_t buf_size) {
+Status NativeRegisterContextLinux::DoReadGPR(void *buf, size_t buf_size) {
return NativeProcessLinux::PtraceWrapper(PTRACE_GETREGS, m_thread.GetID(),
nullptr, buf, buf_size);
}
-Error NativeRegisterContextLinux::DoWriteGPR(void *buf, size_t buf_size) {
+Status NativeRegisterContextLinux::DoWriteGPR(void *buf, size_t buf_size) {
return NativeProcessLinux::PtraceWrapper(PTRACE_SETREGS, m_thread.GetID(),
nullptr, buf, buf_size);
}
-Error NativeRegisterContextLinux::DoReadFPR(void *buf, size_t buf_size) {
+Status NativeRegisterContextLinux::DoReadFPR(void *buf, size_t buf_size) {
return NativeProcessLinux::PtraceWrapper(PTRACE_GETFPREGS, m_thread.GetID(),
nullptr, buf, buf_size);
}
-Error NativeRegisterContextLinux::DoWriteFPR(void *buf, size_t buf_size) {
+Status NativeRegisterContextLinux::DoWriteFPR(void *buf, size_t buf_size) {
return NativeProcessLinux::PtraceWrapper(PTRACE_SETFPREGS, m_thread.GetID(),
nullptr, buf, buf_size);
}