[Lldb-commits] [lldb] r131696 - in /lldb/trunk/source/Plugins/Process/Linux: RegisterContextLinux_i386.cpp RegisterContextLinux_x86_64.cpp RegisterContextLinux_x86_64.h

Johnny Chen johnny.chen at apple.com
Thu May 19 16:08:42 PDT 2011


Author: johnny
Date: Thu May 19 18:08:41 2011
New Revision: 131696

URL: http://llvm.org/viewvc/llvm-project?rev=131696&view=rev
Log:
A bit of clean up.

Removed ifdeffed out functions and added the implementation of
WriteRegister for x86_64 architecture.

Signed-off-by: Johnny Chen <johnny.chen at apple.com>

Modified:
    lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
    lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
    lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h

Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp?rev=131696&r1=131695&r2=131696&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_i386.cpp Thu May 19 18:08:41 2011
@@ -419,71 +419,18 @@
     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

Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp?rev=131696&r1=131695&r2=131696&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp Thu May 19 18:08:41 2011
@@ -475,65 +475,31 @@
         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;

Modified: lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h?rev=131696&r1=131695&r2=131696&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h Thu May 19 18:08:41 2011
@@ -41,14 +41,6 @@
     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 @@
     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);





More information about the lldb-commits mailing list