Author: David Spickett
Date: 2026-08-20T08:57:44+01:00
New Revision: b955ea912ac117de532ce619bcf7d89bf4727de0

URL: 
https://github.com/llvm/llvm-project/commit/b955ea912ac117de532ce619bcf7d89bf4727de0
DIFF: 
https://github.com/llvm/llvm-project/commit/b955ea912ac117de532ce619bcf7d89bf4727de0.diff

LOG: [lldb][debugserver] Fix a bug in FindBreakpointsThatOverlapRange (#217009)

This reverts commit a7ef89ad9796e6de3a085ec75a13f0dfec5a8059 to reland
#216723,
with a fix for the reported failure on MacOS. I think this was due to a
bug in
`DNBBreakpointList::FindBreakpointsThatOverlapRange`.

In the second loop, `pos` is only incremented if `IntersectsRange`
returns true. It will
never return true for a hardware breakpoint because hardware breakpoints
are not
placed into actual memory.

This means that it gets stuck in that final while. I think if I had
access to the logs, I
would see lldb timing out the write memory request.

I made some small changes to the test case:
* Split the final assertion so we can tell if it failed entirely or
partially.
* Renamed the test case, since it's not "copying" anything.

Added: 
    

Modified: 
    
lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
    lldb/tools/debugserver/source/DNBBreakpoint.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
index c82ae24a6d9ab..341ef444c66e0 100644
--- 
a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
+++ 
b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
@@ -13,9 +13,8 @@
 
 class WriteMemoryWithHWBreakpoint(HardwareBreakpointTestBase):
 
-    @skipTestIfFn(HardwareBreakpointTestBase.supports_hw_breakpoints)
-    @skip
-    def test_copy_memory_with_hw_break(self):
+    @skipTestIfFn(HardwareBreakpointTestBase.hw_breakpoints_unsupported)
+    def test_write_memory_with_hw_break(self):
         self.build()
         exe = self.getBuildArtifact("a.out")
 
@@ -46,4 +45,5 @@ def test_copy_memory_with_hw_break(self):
         error = lldb.SBError()
 
         result = process.WriteMemory(address, data, error)
-        self.assertTrue(error.Success() and result == len(bytes))
+        self.assertTrue(error.Success())
+        self.assertEqual(result, len(data))

diff  --git a/lldb/tools/debugserver/source/DNBBreakpoint.cpp 
b/lldb/tools/debugserver/source/DNBBreakpoint.cpp
index e41bf9b4fd905..74f0fb17129f3 100644
--- a/lldb/tools/debugserver/source/DNBBreakpoint.cpp
+++ b/lldb/tools/debugserver/source/DNBBreakpoint.cpp
@@ -147,10 +147,10 @@ size_t DNBBreakpointList::FindBreakpointsThatOverlapRange(
         break;
 
       // Check if this breakpoint overlaps, and if it does, add it to the list
-      if (pos->second.IntersectsRange(addr, size, NULL, NULL, NULL)) {
+      if (pos->second.IntersectsRange(addr, size, NULL, NULL, NULL))
         bps.push_back(&pos->second);
-        ++pos;
-      }
+
+      ++pos;
     }
   }
   return bps.size();


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to