[Lldb-commits] [lldb] r328770 - NativeThreadProtocol: delete dead code

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 29 03:09:11 PDT 2018


Author: labath
Date: Thu Mar 29 03:09:11 2018
New Revision: 328770

URL: http://llvm.org/viewvc/llvm-project?rev=328770&view=rev
Log:
NativeThreadProtocol: delete dead code

These functions were unused as everyone just went straight for the
direct operations on the register context. In fact, the
Save/RestoreAllRegisters actually appear to be wrong (inverted). Thanks
to Tatyana for pointing this out.

These functions are not very useful now that we can guarantee that each
thread always contains a valid register context, so I just delete them.

Modified:
    lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h
    lldb/trunk/source/Host/common/NativeThreadProtocol.cpp

Modified: lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h?rev=328770&r1=328769&r2=328770&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h (original)
+++ lldb/trunk/include/lldb/Host/common/NativeThreadProtocol.h Thu Mar 29 03:09:11 2018
@@ -32,14 +32,6 @@ public:
 
   virtual NativeRegisterContext &GetRegisterContext() = 0;
 
-  virtual Status ReadRegister(uint32_t reg, RegisterValue &reg_value);
-
-  virtual Status WriteRegister(uint32_t reg, const RegisterValue &reg_value);
-
-  virtual Status SaveAllRegisters(lldb::DataBufferSP &data_sp);
-
-  virtual Status RestoreAllRegisters(lldb::DataBufferSP &data_sp);
-
   virtual bool GetStopReason(ThreadStopInfo &stop_info,
                              std::string &description) = 0;
 

Modified: lldb/trunk/source/Host/common/NativeThreadProtocol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/NativeThreadProtocol.cpp?rev=328770&r1=328769&r2=328770&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/NativeThreadProtocol.cpp (original)
+++ lldb/trunk/source/Host/common/NativeThreadProtocol.cpp Thu Mar 29 03:09:11 2018
@@ -19,36 +19,3 @@ using namespace lldb_private;
 NativeThreadProtocol::NativeThreadProtocol(NativeProcessProtocol &process,
                                            lldb::tid_t tid)
     : m_process(process), m_tid(tid) {}
-
-Status NativeThreadProtocol::ReadRegister(uint32_t reg,
-                                          RegisterValue &reg_value) {
-  NativeRegisterContext &register_context = GetRegisterContext();
-
-  const RegisterInfo *const reg_info =
-      register_context.GetRegisterInfoAtIndex(reg);
-  if (!reg_info)
-    return Status("no register info for reg num %" PRIu32, reg);
-
-  return register_context.ReadRegister(reg_info, reg_value);
-  ;
-}
-
-Status NativeThreadProtocol::WriteRegister(uint32_t reg,
-                                           const RegisterValue &reg_value) {
-  NativeRegisterContext& register_context = GetRegisterContext();
-
-  const RegisterInfo *const reg_info =
-      register_context.GetRegisterInfoAtIndex(reg);
-  if (!reg_info)
-    return Status("no register info for reg num %" PRIu32, reg);
-
-  return register_context.WriteRegister(reg_info, reg_value);
-}
-
-Status NativeThreadProtocol::SaveAllRegisters(lldb::DataBufferSP &data_sp) {
-  return GetRegisterContext().WriteAllRegisterValues(data_sp);
-}
-
-Status NativeThreadProtocol::RestoreAllRegisters(lldb::DataBufferSP &data_sp) {
-  return GetRegisterContext().ReadAllRegisterValues(data_sp);
-}




More information about the lldb-commits mailing list