From c25433f3d218c502f0c24d346b51fb6ce0d3cc16 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Thu, 19 May 2011 23:08:41 +0000 Subject: [PATCH] A bit of clean up. Removed ifdeffed out functions and added the implementation of WriteRegister for x86_64 architecture. Signed-off-by: Johnny Chen llvm-svn: 131696 --- .../Linux/RegisterContextLinux_i386.cpp | 59 +------------------ .../Linux/RegisterContextLinux_x86_64.cpp | 46 ++------------- .../Linux/RegisterContextLinux_x86_64.h | 17 ------ 3 files changed, 9 insertions(+), 113 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp index 0a8ec5a1c0db..cc669d53a163 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp +++ b/lldb/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(&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/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp index 012690ffac4f..a3ce221383d7 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp +++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp @@ -475,64 +475,30 @@ 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(&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) { diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h index 2d210c61541e..d288d53685a6 100644 --- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h +++ b/lldb/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);