[Lldb-commits] [lldb] [llvm] [lldb] [Process/FreeBSD] Assume minimum is FreeBSD 13 (PR #179587)

Minsoo Choo via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 4 07:38:36 PST 2026


https://github.com/mchoo7 updated https://github.com/llvm/llvm-project/pull/179587

>From 4e426ef3b0b79ab790fb3edebb85afc42c0010d4 Mon Sep 17 00:00:00 2001
From: Minsoo Choo <minsoochoo0122 at proton.me>
Date: Tue, 3 Feb 2026 19:53:06 -0500
Subject: [PATCH] [lldb] [Process/FreeBSD] Assume minimum is FreeBSD 14

Signed-off-by: Minsoo Choo <minsoochoo0122 at proton.me>
---
 .../NativeRegisterContextFreeBSD_arm64.cpp    | 24 ++-----------------
 .../NativeRegisterContextFreeBSD_arm64.h      |  6 -----
 llvm/docs/ReleaseNotes.md                     |  3 +++
 3 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
index d21dac221aa22..f50b28e2ebd1d 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp
@@ -54,12 +54,8 @@ NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD(
 NativeRegisterContextFreeBSD_arm64::NativeRegisterContextFreeBSD_arm64(
     const ArchSpec &target_arch, NativeThreadFreeBSD &native_thread)
     : NativeRegisterContextRegisterInfo(
-          native_thread, new RegisterInfoPOSIX_arm64(target_arch, 0))
-#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
-      ,
-      m_read_dbreg(false)
-#endif
-{
+          native_thread, new RegisterInfoPOSIX_arm64(target_arch, 0)),
+      m_read_dbreg(false) {
   g_register_flags_detector.UpdateRegisterInfo(
       GetRegisterInfoInterface().GetRegisterInfo(),
       GetRegisterInfoInterface().GetRegisterCount());
@@ -225,7 +221,6 @@ Status NativeRegisterContextFreeBSD_arm64::WriteAllRegisterValues(
 
 llvm::Error NativeRegisterContextFreeBSD_arm64::CopyHardwareWatchpointsFrom(
     NativeRegisterContextFreeBSD &source) {
-#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
   auto &r_source = static_cast<NativeRegisterContextFreeBSD_arm64 &>(source);
   llvm::Error error = r_source.ReadHardwareDebugInfo();
   if (error)
@@ -240,13 +235,9 @@ llvm::Error NativeRegisterContextFreeBSD_arm64::CopyHardwareWatchpointsFrom(
 
   // on FreeBSD this writes both breakpoints and watchpoints
   return WriteHardwareDebugRegs(eDREGTypeWATCH);
-#else
-  return llvm::Error::success();
-#endif
 }
 
 llvm::Error NativeRegisterContextFreeBSD_arm64::ReadHardwareDebugInfo() {
-#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
   Log *log = GetLog(POSIXLog::Registers);
 
   // we're fully stateful, so no need to reread control registers ever
@@ -267,16 +258,10 @@ llvm::Error NativeRegisterContextFreeBSD_arm64::ReadHardwareDebugInfo() {
 
   m_read_dbreg = true;
   return llvm::Error::success();
-#else
-  return llvm::createStringError(
-      llvm::inconvertibleErrorCode(),
-      "Hardware breakpoints/watchpoints require FreeBSD 14.0");
-#endif
 }
 
 llvm::Error
 NativeRegisterContextFreeBSD_arm64::WriteHardwareDebugRegs(DREGType) {
-#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
   assert(m_read_dbreg && "dbregs must be read before writing them back");
 
   // copy data from m_*_regs to m_dbreg before writing it back
@@ -292,11 +277,6 @@ NativeRegisterContextFreeBSD_arm64::WriteHardwareDebugRegs(DREGType) {
   return NativeProcessFreeBSD::PtraceWrapper(PT_SETDBREGS, m_thread.GetID(),
                                              &m_dbreg)
       .ToError();
-#else
-  return llvm::createStringError(
-      llvm::inconvertibleErrorCode(),
-      "Hardware breakpoints/watchpoints require FreeBSD 14.0");
-#endif
 }
 
 #endif // defined (__aarch64__)
diff --git a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h
index 80ed328f08bdf..20cbd643e95cf 100644
--- a/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h
+++ b/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm64.h
@@ -23,10 +23,6 @@
 
 #include <array>
 
-#if __FreeBSD_version >= 1300139
-#define LLDB_HAS_FREEBSD_WATCHPOINT 1
-#endif
-
 namespace lldb_private {
 namespace process_freebsd {
 
@@ -64,10 +60,8 @@ class NativeRegisterContextFreeBSD_arm64
   // and sizes, so we do not have to worry about these (and we have
   // a unittest to assert that).
   std::array<uint8_t, sizeof(reg) + sizeof(fpreg)> m_reg_data;
-#ifdef LLDB_HAS_FREEBSD_WATCHPOINT
   dbreg m_dbreg;
   bool m_read_dbreg;
-#endif
 
   Status ReadRegisterSet(uint32_t set);
   Status WriteRegisterSet(uint32_t set);
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 2a535dc0530a0..c183b041022e4 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -174,6 +174,9 @@ Changes to the LLVM tools
 Changes to LLDB
 ---------------
 
+* The minimum assumed version of FreeBSD is now 14. The effect of which is that watchpoints are
+  assumed to be supported.
+
 Changes to BOLT
 ---------------
 



More information about the lldb-commits mailing list