[Lldb-commits] [lldb] [LLDB][lldb-server] Handle writes over software breakpoint sites (PR #217348)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 21 01:58:15 PDT 2026
================
@@ -0,0 +1,157 @@
+"""
+Check that when data is written over a software breakpoint site, it does not
+corrupt the breakpoint instruction, and is later written to memory when the
+breakpoint is removed.
+"""
+
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+
+
+class WriteOverSoftwareBreakpoint(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ # Could not find a way to make place_break_here visible to lldb on Windows.
+ @skipIfWindows
+ # debugserver needs fixing, see https://github.com/llvm/llvm-project/issues/217359.
+ @llgs_test
+ def test_write_over_breakpoint(self):
+ TestBase.setUp(self)
+ self.line = line_number("main.c", "// break here")
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True
+ )
+ self.runCmd("run", RUN_SUCCEEDED)
+ self.expect(
+ "thread list",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=["stopped", "stop reason = breakpoint"],
+ )
+
+ target = self.dbg.GetSelectedTarget()
+ process = target.GetProcess()
+
+ loop_start_breakpoint_addr = (
+ target.breakpoints[0].GetLocationAtIndex(0).GetLoadAddress()
+ )
+
+ # Memory operations and breakpoint actions must be sent to the server
+ # right away instead of waiting for the next continue event.
+ self.runCmd("settings set target.process.disable-memory-cache on")
+ self.runCmd("settings set target.process.use-delayed-breakpoints false")
----------------
DavidSpickett wrote:
It would still pass but we wouldn't be testing what we intend to test.
Also I would hit https://github.com/llvm/llvm-project/issues/205120. So it would actually be a good idea to run it with delayed breakpoints on as well, but let me do that as a follow up.
(I do need the memory cache off either way, because we're testing server behaviour here)
https://github.com/llvm/llvm-project/pull/217348
More information about the lldb-commits
mailing list