[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #99736)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 19 23:43:24 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)
----------------
medismailben wrote:

How does this test that we're actually stopped in `trigger_breakpoint` after running `process.ReverseContinue` ?

https://github.com/llvm/llvm-project/pull/99736


More information about the lldb-commits mailing list