[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #99736)
Robert O'Callahan via lldb-commits
lldb-commits at lists.llvm.org
Sat Jul 20 05:31:03 PDT 2024
================
@@ -0,0 +1,79 @@
+import lldb
+import unittest
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test.gdbclientutils import *
+from lldbsuite.test.lldbreverse import ReverseTestBase
+from lldbsuite.test import lldbutil
+
+
+class TestReverseContinueBreakpoints(ReverseTestBase):
+ @add_test_categories(["dwarf"])
+ def test_reverse_continue(self):
+ target, process, initial_threads = self.setup_recording()
+
+ # Reverse-continue. We'll stop at the point where we started recording.
+ status = process.ReverseContinue()
+ self.assertSuccess(status)
+ self.expect(
+ "thread list",
+ STOPPED_DUE_TO_HISTORY_BOUNDARY,
+ substrs=["stopped", "stop reason = history boundary"],
+ )
+
+ # Continue forward normally until the target exits.
+ status = process.Continue()
+ self.assertSuccess(status)
+ self.assertState(process.GetState(), lldb.eStateExited)
+ self.assertEqual(process.GetExitStatus(), 0)
+
+ @add_test_categories(["dwarf"])
+ def test_reverse_continue_breakpoint(self):
+ target, process, initial_threads = self.setup_recording()
+
+ # Reverse-continue to the function "trigger_breakpoint".
+ trigger_bkpt = target.BreakpointCreateByName("trigger_breakpoint", None)
+ status = process.ReverseContinue()
+ self.assertSuccess(status)
+ threads_now = lldbutil.get_threads_stopped_at_breakpoint(process, trigger_bkpt)
+ self.assertEqual(threads_now, initial_threads)
+
+ @add_test_categories(["dwarf"])
+ def test_reverse_continue_skip_breakpoint(self):
+ target, process, initial_threads = self.setup_recording()
+
+ # Reverse-continue, skipping a disabled breakpoint at "trigger_breakpoint".
+ trigger_bkpt = target.BreakpointCreateByName("trigger_breakpoint", None)
+ trigger_bkpt.SetCondition("0")
----------------
rocallahan wrote:
Sorry, my comment was misleading. The goal here is to test reverse-continuing over a conditional breakpoint whose condition is false. We need to continue in the same direction we were going --- if we're not careful we continue forwards from the breakpoint instead, which is broken :-). I've fixed the comment.
https://github.com/llvm/llvm-project/pull/99736
More information about the lldb-commits
mailing list