[Lldb-commits] [lldb] 4923dca - 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:22 PDT 2020
Author: Muhammad Omair Javaid
Date: 2020-07-20T14:54:51+05:00
New Revision: 4923dca9bd8fe8a635cbc3d4f8affc4d03bdb0ca
URL: https://github.com/llvm/llvm-project/commit/4923dca9bd8fe8a635cbc3d4f8affc4d03bdb0ca
DIFF: https://github.com/llvm/llvm-project/commit/4923dca9bd8fe8a635cbc3d4f8affc4d03bdb0ca.diff
LOG: Remove use of multiple reg index enums by RegisterContextPOSIX_arm64
Summary:
This patch removes dependence of RegisterContextPOSIX_arm64 on register number enums defined in lldb-arm64-register-enums.h.
RegisterContextPOSIX_arm64 makes use of helper functions to access register numbers defined in RegisterInfos_arm64.h via RegisterInfosPOSIX_arm64.
Reviewers: labath
Reviewed By: labath
Subscribers: emaste, kristof.beyls, arphaman, danielkiss, lldb-commits
Differential Revision: https://reviews.llvm.org/D83753
Added:
Modified:
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
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
index d3eafae1e6de..035bf59cc9c9 100644
--- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.cpp
@@ -24,7 +24,10 @@ RegisterContextPOSIXProcessMonitor_arm64::
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 @@ bool RegisterContextPOSIXProcessMonitor_arm64::UpdateAfterBreakpoint() {
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;
}
diff --git a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
index f100d905e28f..579fa9d8cebb 100644
--- a/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
+++ b/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_arm64.h
@@ -71,6 +71,11 @@ class RegisterContextPOSIXProcessMonitor_arm64
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();
};
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
index 8ef587f13e3a..d88695009fdb 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp
@@ -43,10 +43,7 @@ RegisterContextPOSIX_arm64::RegisterContextPOSIX_arm64(
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() {}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
index c2d5aee7f73c..01c9fee5be6d 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
+++ b/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 @@ class RegisterContextPOSIX_arm64 : public lldb_private::RegisterContext {
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();
More information about the lldb-commits
mailing list