[Lldb-commits] [Differential] D83753: Remove use of multiple reg index enums by RegisterContextPOSIX_arm64

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 20 02:55:30 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG4923dca9bd8f: Remove use of multiple reg index enums by RegisterContextPOSIX_arm64 (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83753/new/


  https://reviews.llvm.org/D83753

Files:
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
  lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h



Index: lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
===================================================================
--- lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
+++ lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
@@ -11,7 +11,6 @@
 
 #include "RegisterInfoInterface.h"
 #include "RegisterInfoPOSIX_arm64.h"
-#include "lldb-arm64-register-enums.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Utility/Log.h"
 
@@ -46,13 +45,6 @@
   const char *GetRegisterName(unsigned reg);
 
 protected:
-  uint64_t m_gpr_arm64[lldb_private::k_num_gpr_registers_arm64]; // 64-bit
-                                                                 // general
-                                                                 // purpose
-                                                                 // registers.
-
-  struct RegisterInfoPOSIX_arm64::FPU
-      m_fpr; // floating-point registers including extended register sets.
   std::unique_ptr<RegisterInfoPOSIX_arm64> m_register_info_up;
 
   virtual const lldb_private::RegisterInfo *GetRegisterInfo();
Index: lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
===================================================================
--- lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
+++ lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
@@ -43,10 +43,7 @@
     lldb_private::Thread &thread,
     std::unique_ptr<RegisterInfoPOSIX_arm64> register_info)
     : lldb_private::RegisterContext(thread, 0),
-      m_register_info_up(std::move(register_info)) {
-
-  ::memset(&m_fpr, 0, sizeof m_fpr);
-}
+      m_register_info_up(std::move(register_info)) {}
 
 RegisterContextPOSIX_arm64::~RegisterContextPOSIX_arm64() {}
 
Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
===================================================================
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
@@ -71,6 +71,11 @@
   uint32_t NumSupportedHardwareWatchpoints();
 
 private:
+  RegisterInfoPOSIX_arm64::GPR m_gpr_arm64; // 64-bit general purpose registers.
+
+  RegisterInfoPOSIX_arm64::FPU
+      m_fpr; // floating-point registers including extended register sets.
+
   ProcessMonitor &GetMonitor();
 };
 
Index: lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
===================================================================
--- lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
+++ lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
@@ -24,7 +24,10 @@
     RegisterContextPOSIXProcessMonitor_arm64(
         lldb_private::Thread &thread,
         std::unique_ptr<RegisterInfoPOSIX_arm64> register_info)
-    : RegisterContextPOSIX_arm64(thread, std::move(register_info)) {}
+    : RegisterContextPOSIX_arm64(thread, std::move(register_info)) {
+  ::memset(&m_fpr, 0, sizeof m_gpr_arm64);
+  ::memset(&m_fpr, 0, sizeof m_fpr);
+}
 
 ProcessMonitor &RegisterContextPOSIXProcessMonitor_arm64::GetMonitor() {
   lldb::ProcessSP base = CalculateProcess();
@@ -226,11 +229,11 @@
 unsigned RegisterContextPOSIXProcessMonitor_arm64::GetRegisterIndexFromOffset(
     unsigned offset) {
   unsigned reg;
-  for (reg = 0; reg < k_num_registers_arm64; reg++) {
+  for (reg = 0; reg < GetRegisterCount(); reg++) {
     if (GetRegisterInfo()[reg].byte_offset == offset)
       break;
   }
-  assert(reg < k_num_registers_arm64 && "Invalid register offset.");
+  assert(reg < GetRegisterCount() && "Invalid register offset.");
   return reg;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83753.278999.patch
Type: text/x-patch
Size: 3745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200720/644e02b6/attachment-0001.bin>


More information about the lldb-commits mailing list