Repository navigation
Description
What
stepBacktakesgranularityandsingleThread. The adapter answers, then sendsstoppedwith reasonstep.reverseContinuetakessingleThread.- One capability,
supportsStepBack, gates both.
Why
- CodeLLDB: sends
supportsStepBackin acapabilitiesevent when the launch configuration hasreverseDebugging: true(debug_session/launch.rs:554-557).handle_step_back(:851) andhandle_reverse_continue(:862) send the GDB remote packetsbsandbc. ItsMANUAL.md(lines 437-442) says the only known working backend is Mozilla's rr, version 5.3.0 or later. - Delve: sends
SupportsStepBack: truein acapabilitiesevent only when the backend is rr (server.go:1400-1401,:2426-2427). Step back usesReverseNext(:3600), and reverse continue usesRewind(:3608). - rdbg (Ruby):
- advertises
supportsStepBack: truealways (lib/debug/server_dap.rb:165); - step back works only while the gem's own TracePoint recorder is on, with the
record oncommand (thread_client.rb:1287,session.rb:1040). It does not use rr. reverseContinuealways fails: "Reverse Continue is not supported. Only "Step back" is supported." (server_dap.rb:455-458).
- advertises
- No: debugpy, vscode-js-debug, lldb-dap, netcoredbg, GDB's DAP, MIEngine, java-debug.
What users miss: stepping back over a line that just ran, or running backwards to the previous breakpoint. This works on rr recordings (Linux) for Go, C, C++ and Rust, and as step back in Ruby.
Today
There is no UI, and supportsStepBack is not read. The XDebugger API of 2024.2 and 2026.3 has no step-back or reverse action either: not in the XDebugProcess methods or in the action groups. So LSP4IJ would add its own actions.
How it could be done
The actions:
DAP.StepBack(iconAllIcons.Actions.Back) andDAP.ReverseContinue(AllIcons.Actions.Play_back). Both icons exist in both versions.registerAdditionalActionsadds them totopToolbar(the stepping toolbar). They are also added toDebuggingActionsGroup, whereOpenDisassemblyActionalready is.- They are always added and shown by
update(), from the live capabilities of the suspend context's client. CodeLLDB and Delve announcesupportsStepBackin acapabilitiesevent after the launch, which LSP4IJ applies since fix(dap): apply the capabilities event of a debug adapter #1974; DAPSupport.md's ❌ for Capabilities is stale. update()(BGT): enabled when the session is suspended with aDAPSuspendContext.
Sending:
stepBackuses the thread of the context. Its granularity followsDAPDebugProcess.getSteppingGranularity: INSTRUCTION when the disassembly is shown. ItssingleThreadfollowsDAPClient.singleThreadStep(DAPClient.java:1340-1361) and theDAP.StepOnlyCurrentThreadsetting.reverseContinuesendssingleThreadthe same way.
Session state:
- On success, call
session.sessionResumed()in the non-async handler, as inDAPDropFrameHandler.restartFrame. The nextstoppedthen builds a new suspend context. - On error, show the adapter's message and stay suspended: rdbg's reverse continue, or rdbg's step back without a recording.
- Breakpoints hit while running backwards arrive as normal
stoppedevents.
Compatibility and docs: hidden without the capability. Mark StepBack and ReverseContinue as supported in DAPSupport.md, and add a UserGuide section that mentions rr.
Test
- Session test, in the style of
DAPStepOnlyCurrentThreadSessionTest:- The server announces
supportsStepBackwithclient.capabilities(...)after configurationDone, and the actions become visible. - Step Back sends
stepBackwith the thread ID and, when set,singleThreadandgranularity. The server'sstoppedwith reasonstepsuspends the session again. - A failed
reverseContinuekeeps the session suspended.
- The server announces
- Unit test: the helpers, with Proxy fakes.
Effort and risk
Medium. The code is small, but a real check needs rr on Linux. Low risk. Open questions: where the actions go, and shortcuts (none by default, to avoid conflicts).
Activity
feat: step back and reverse continue in a DAP debug session whose deb…
feat: step back and reverse continue in a DAP debug session whose deb…