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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 20 02:32:54 PST 2025


================
@@ -0,0 +1,32 @@
+import lldb
+import unittest
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from lldbsuite.test import lldbutil
+
+
+class TestReverseContinueNotSupported(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    def test_reverse_continue_not_supported(self):
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+        target = self.dbg.CreateTarget(exe)
+        self.assertTrue(target, VALID_TARGET)
+
+        main_bkpt = target.BreakpointCreateByName("main", None)
+        self.assertTrue(main_bkpt, VALID_BREAKPOINT)
+
+        process = target.LaunchSimple(None, None, self.get_process_working_directory())
+        self.assertTrue(process, PROCESS_IS_VALID)
+
+        # This will fail gracefully.
+        status = process.ContinueInDirection(lldb.eRunReverse)
+        self.assertFailure(
+            status, "error: gdb-remote does not support reverse execution of processes"
+        )
+
+        status = process.ContinueInDirection(lldb.eRunForward)
+        self.assertSuccess(status)
----------------
labath wrote:

I'd put these on the same line. Besides being one line shorter, they're also slightly more useful, as in the case of a test failure, the python backtrace will contain the text of the line which failed.

```suggestion
        self.assertSuccess(process.ContinueInDirection(lldb.eRunForward))
```

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


More information about the lldb-commits mailing list