Repository navigation
Description
What happens
When the debug adapter refuses a Resume or a step, the debug session shows the program as running anyway, and nothing
says why. The program is still stopped: no frames, no variables, and Resume and the steps stay disabled until the user
pauses it.
The adapter refuses by answering continue, next, stepIn or stepOut with an error. For example:
- the thread isn't stopped any more;
- the adapter doesn't support single-thread stepping for that thread;
- an internal error of the adapter.
Cause
-
IntelliJ shows the session as running first: it clears the paused state before it calls
XDebugProcess.resume/startStepOver/…. -
LSP4IJ then sends the request and ignores the answer:
DAPDebugProcess.resume
callsclient.continue_(threadId)and drops its future;DAPClient.next,stepOutandstepIn
callserver.next(args)etc., and drop the future too.
So an error answer reaches no handler: it isn't shown, and the session isn't suspended again.
-
The execution epoch (feat: set the value of an Evaluate result with the DAP setExpression request #2150) has ended before the request, and isn't restored.
DAPExecutionEpoch.resumeRefusedonly serves the drop-frame handler. -
With feat: the Threads tab of a DAP debug session shows which threads run, which are stopped and which exited #2181, the Threads tab also shows the threads as running, as the session does. CodeRabbit's review of feat: the Threads tab of a DAP debug session shows which threads run, which are stopped and which exited #2181
pointed at this.
Expected
A refused resume or step:
- says so in the session, e.g. as a warning notification, with the adapter's message, as Break on Value Change and
Jump to Value Source report a refusal; - leaves the session suspended where it was, with its frames;
- restores what the request changed before it was sent: the execution epoch (
resumeRefused, as the drop-frame
handler does) and, with feat: the Threads tab of a DAP debug session shows which threads run, which are stopped and which exited #2181, the run states of the threads. A newer event wins.
How it could be done
- Have
continue_,next,stepInandstepOutreturn or handle their futures. - On an error answer:
- report the message;
- call
executionEpoch.resumeRefused(...); - put the session back at its suspend context, with
positionReachedon that context, or on a new one asked from
the adapter; - restore the run states that the request set, if no newer event changed them.
- Check what XDebugger allows for suspending again without a new stop, on 2024.2 and 2026.3.
DAPDropFrameHandler
does something similar for a refusedrestartFrame.
Test
A session test: the debug adapter answers next with an error. The session ends up suspended at the same frame, the
error is reported, and Set Value still works at that frame.
Activity
feat: step back and reverse continue in a DAP debug session whose deb…
fix: Set Value works in a DAP thread which is still stopped after ano…
fix: a Resume or a step that the debug adapter refuses leaves the DAP…