[Lldb-commits] [PATCH 2/3] A bit of clean up.
Marco Minutoli
mminutoli at gmail.com
Thu May 19 14:41:31 PDT 2011
Removed ifdeffed out functions and added the implementation of
WriteRegister for x86_64 architecture.
---
.../Process/Linux/RegisterContextLinux_i386.cpp | 59 +-------------------
.../Process/Linux/RegisterContextLinux_x86_64.cpp | 46 ++-------------
.../Process/Linux/RegisterContextLinux_x86_64.h | 17 ------
3 files changed, 9 insertions(+), 113 deletions(-)
diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp b/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
index 0a8ec5a..cc669d5 100644
--- a/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
+++ b/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
@@ -419,71 +419,18 @@ RegisterContextLinux_i386::ReadRegister(const RegisterInfo *reg_info,
return monitor.ReadRegisterValue(GetRegOffset(reg), value);
}
-#if 0
-
-bool
-RegisterContextLinux_i386::ReadRegisterValue(uint32_t reg,
- Scalar &value)
-{
- ProcessMonitor &monitor = GetMonitor();
- return monitor.ReadRegisterValue(GetRegOffset(reg), value);
-}
-
-bool
-RegisterContextLinux_i386::ReadRegisterBytes(uint32_t reg,
- DataExtractor &data)
-{
- uint8_t *buf = reinterpret_cast<uint8_t*>(&user);
- bool status;
-
- if (IsGPR(reg))
- status = ReadGPR();
- else if (IsFPR(reg))
- status = ReadFPR();
- else
- {
- assert(false && "invalid register number");
- status = false;
- }
-
- if (status)
- data.SetData(buf + GetRegOffset(reg), GetRegSize(reg), lldb::endian::InlHostByteOrder());
-
- return status;
-}
-
-#endif
-
bool
RegisterContextLinux_i386::ReadAllRegisterValues(DataBufferSP &data_sp)
{
return false;
}
-#if 0
-
-bool
-RegisterContextLinux_i386::WriteRegisterValue(uint32_t reg,
- const Scalar &value)
-{
- ProcessMonitor &monitor = GetMonitor();
- return monitor.WriteRegisterValue(GetRegOffset(reg), value);
-}
-
-bool
-RegisterContextLinux_i386::WriteRegisterBytes(uint32_t reg,
- DataExtractor &data,
- uint32_t data_offset)
-{
- return false;
-}
-
-#endif
-
bool RegisterContextLinux_i386::WriteRegister(const RegisterInfo *reg_info,
const RegisterValue &value)
{
- return false;
+ const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
+ ProcessMonitor &monitor = GetMonitor();
+ return monitor.WriteRegisterValue(GetRegOffset(reg), value);
}
bool
diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
index 012690f..a3ce221 100644
--- a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
+++ b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
@@ -475,65 +475,31 @@ RegisterContextLinux_x86_64::GetRegisterSet(uint32_t set)
return NULL;
}
-#if 0
bool
-RegisterContextLinux_x86_64::ReadRegisterValue(uint32_t reg,
- Scalar &value)
+RegisterContextLinux_x86_64::ReadRegister(const RegisterInfo *reg_info,
+ RegisterValue &value)
{
+ const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
ProcessMonitor &monitor = GetMonitor();
return monitor.ReadRegisterValue(GetRegOffset(reg), value);
}
bool
-RegisterContextLinux_x86_64::ReadRegisterBytes(uint32_t reg,
- DataExtractor &data)
-{
- uint8_t *buf = reinterpret_cast<uint8_t*>(&user);
- bool status;
-
- if (IsGPR(reg))
- status = ReadGPR();
- else if (IsFPR(reg))
- status = ReadFPR();
- else
- {
- assert(false && "invalid register number");
- status = false;
- }
-
- if (status)
- data.SetData(buf + GetRegOffset(reg), GetRegSize(reg), lldb::endian::InlHostByteOrder());
-
- return status;
-}
-
-#endif
-
-bool
RegisterContextLinux_x86_64::ReadAllRegisterValues(DataBufferSP &data_sp)
{
return false;
}
-#if 0
bool
-RegisterContextLinux_x86_64::WriteRegisterValue(uint32_t reg,
- const Scalar &value)
+RegisterContextLinux_x86_64::WriteRegister(const lldb_private::RegisterInfo *reg_info,
+ const lldb_private::RegisterValue &value)
{
+ const uint32_t reg = reg_info->kinds[eRegisterKindLLDB];
ProcessMonitor &monitor = GetMonitor();
return monitor.WriteRegisterValue(GetRegOffset(reg), value);
}
bool
-RegisterContextLinux_x86_64::WriteRegisterBytes(uint32_t reg,
- DataExtractor &data,
- uint32_t data_offset)
-{
- return false;
-}
-#endif
-
-bool
RegisterContextLinux_x86_64::WriteAllRegisterValues(const DataBufferSP &data)
{
return false;
diff --git a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
index 2d210c6..d288d53 100644
--- a/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
+++ b/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
@@ -41,14 +41,6 @@ public:
const lldb_private::RegisterSet *
GetRegisterSet(uint32_t set);
-#if 0
- bool
- ReadRegisterValue(uint32_t reg, lldb_private::Scalar &value);
-
- bool
- ReadRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data);
-#endif
-
virtual bool
ReadRegister(const lldb_private::RegisterInfo *reg_info,
lldb_private::RegisterValue &value);
@@ -56,15 +48,6 @@ public:
bool
ReadAllRegisterValues(lldb::DataBufferSP &data_sp);
-#if 0
- bool
- WriteRegisterValue(uint32_t reg, const lldb_private::Scalar &value);
-
- bool
- WriteRegisterBytes(uint32_t reg, lldb_private::DataExtractor &data,
- uint32_t data_offset = 0);
-#endif
-
virtual bool
WriteRegister(const lldb_private::RegisterInfo *reg_info,
const lldb_private::RegisterValue &value);
--
1.7.3.4
More information about the lldb-commits
mailing list