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

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.
This commit is contained in:
Robert O'Callahan
2025-01-22 20:37:17 +13:00
committed by GitHub
parent 830bd0e8f2
commit b7b9ccf449
40 changed files with 1333 additions and 47 deletions

View File

@@ -182,10 +182,15 @@ void ScriptedProcess::DidResume() {
m_pid = GetInterface().GetProcessID();
}
Status ScriptedProcess::DoResume() {
Status ScriptedProcess::DoResume(RunDirection direction) {
LLDB_LOGF(GetLog(LLDBLog::Process), "ScriptedProcess::%s resuming process", __FUNCTION__);
return GetInterface().Resume();
if (direction == RunDirection::eRunForward)
return GetInterface().Resume();
// FIXME: Pipe reverse continue through Scripted Processes
return Status::FromErrorStringWithFormatv(
"error: {0} does not support reverse execution of processes",
GetPluginName());
}
Status ScriptedProcess::DoAttach(const ProcessAttachInfo &attach_info) {