[Lldb-commits] [lldb] [lldb] Member initialise hardware breakpoint structures (PR #197127)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu May 14 04:51:23 PDT 2026
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/197127
>From 9a430c0846d26e53ddf6c802cce79a0e5c1ff811 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at arm.com>
Date: Tue, 12 May 2026 08:46:28 +0000
Subject: [PATCH] [lldb] Member initialise hardware breakpoint structures
These are delcared in NativeRegisterContextDBReg so we should zero-init
them there rather than have everyone memset them later.
ppc64le has its own equivalent that I've made the same change to.
---
.../Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp | 3 ---
.../Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp | 2 --
.../Process/Linux/NativeRegisterContextLinux_arm64.cpp | 2 --
.../Process/Linux/NativeRegisterContextLinux_loongarch64.cpp | 3 ---
.../Process/Linux/NativeRegisterContextLinux_ppc64le.cpp | 1 -
.../Process/Linux/NativeRegisterContextLinux_ppc64le.h | 2 +-
.../Plugins/Process/Utility/NativeRegisterContextDBReg.h | 4 ++--
7 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
index f50b28e2ebd1d..74c55224fed49 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
@@ -59,9 +59,6 @@ NativeRegisterContextFreeBSD_arm64::NativeRegisterContextFreeBSD_arm64(
g_register_flags_detector.UpdateRegisterInfo(
GetRegisterInfoInterface().GetRegisterInfo(),
GetRegisterInfoInterface().GetRegisterCount());
-
- ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
- ::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
}
RegisterInfoPOSIX_arm64 &
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index c83cea2bbf5bd..21b6bb408caad 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -78,8 +78,6 @@ NativeRegisterContextLinux_arm::NativeRegisterContextLinux_arm(
::memset(&m_fpr, 0, sizeof(m_fpr));
::memset(&m_tls, 0, sizeof(m_tls));
::memset(&m_gpr_arm, 0, sizeof(m_gpr_arm));
- ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
- ::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
// 16 is just a maximum value, query hardware for actual watchpoint count
m_max_hwp_supported = 16;
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index c7bd5d7bec252..d61eb29dd0b7e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -216,8 +216,6 @@ NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
::memset(&m_fpr, 0, sizeof(m_fpr));
::memset(&m_gpr_arm64, 0, sizeof(m_gpr_arm64));
- ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
- ::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
::memset(&m_sve_header, 0, sizeof(m_sve_header));
::memset(&m_pac_mask, 0, sizeof(m_pac_mask));
::memset(&m_tls_regs, 0, sizeof(m_tls_regs));
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
index c4841950f1e07..ed3d43ca48020 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp
@@ -103,9 +103,6 @@ NativeRegisterContextLinux_loongarch64::NativeRegisterContextLinux_loongarch64(
::memset(&m_lsx, 0, sizeof(m_lsx));
::memset(&m_lasx, 0, sizeof(m_lasx));
- ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
- ::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
-
// Refer to:
// https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers-related-to-watchpoints
// 14 is just a maximum value, query hardware for actual watchpoint count.
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
index 0b8571a8d6704..f4b539bf2b4c3 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp
@@ -142,7 +142,6 @@ NativeRegisterContextLinux_ppc64le::NativeRegisterContextLinux_ppc64le(
::memset(&m_fpr_ppc64le, 0, sizeof(m_fpr_ppc64le));
::memset(&m_vmx_ppc64le, 0, sizeof(m_vmx_ppc64le));
::memset(&m_vsx_ppc64le, 0, sizeof(m_vsx_ppc64le));
- ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
}
uint32_t NativeRegisterContextLinux_ppc64le::GetRegisterSetCount() const {
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
index 942c65fcd241d..4ca9d43a24926 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.h
@@ -122,7 +122,7 @@ class NativeRegisterContextLinux_ppc64le : public NativeRegisterContextLinux {
int mode; // Defines if watchpoint is read/write/access.
};
- std::array<DREG, 16> m_hwp_regs;
+ std::array<DREG, 16> m_hwp_regs{};
// 16 is just a maximum value, query hardware for actual watchpoint count
uint32_t m_max_hwp_supported = 16;
diff --git a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg.h b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg.h
index 721c15e1ee900..60d1bfa38dd01 100644
--- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg.h
+++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg.h
@@ -65,8 +65,8 @@ class NativeRegisterContextDBReg
};
protected:
- std::array<struct DREG, 16> m_hbp_regs; // hardware breakpoints
- std::array<struct DREG, 16> m_hwp_regs; // hardware watchpoints
+ std::array<struct DREG, 16> m_hbp_regs{}; // hardware breakpoints
+ std::array<struct DREG, 16> m_hwp_regs{}; // hardware watchpoints
uint32_t m_max_hbp_supported;
uint32_t m_max_hwp_supported;
More information about the lldb-commits
mailing list