This commit adds support for a `SBProcess::ContinueInDirection()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. For testing purposes, this commit adds a Python implementation of *very limited* record-and-reverse-execute functionality, implemented as a proxy between lldb and lldb-server in `lldbreverse.py`. This should not (and in practice cannot) be used for anything except testing. The tests here are quite minimal but we test that simple breakpoints and watchpoints work as expected during reverse execution, and that conditional breakpoints and watchpoints work when the condition calls a function that must be executed in the forward direction.
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
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"
|
|
)
|
|
|
|
self.assertSuccess(process.ContinueInDirection(lldb.eRunForward))
|
|
self.assertState(process.GetState(), lldb.eStateExited)
|
|
self.assertEqual(process.GetExitStatus(), 0)
|