Repository navigation
feat: when the selected thread of a DAP session continues alone, the session selects the thread where it stays suspended - #2218
Conversation
…session selects the thread where it stays suspended When a thread other than the one where the session is suspended continues alone (a 'continued' event with allThreadsContinued: false) while one of its frames is the current frame, the session now selects the top frame of the thread where it stays suspended. The Variables view and the execution point follow that thread, and so do Step and Resume, which act on the thread of the active stack of the suspend context: before, they sent their request for the thread which runs. The selection moves on the EDT with XDebugSession.setCurrentStackFrame, which also reaches the frontend of the split debugger, and only while the session is still at the same stop with the same current frame: a newer stop, or a frame selected meanwhile, stays. The selection of a thread which is still stopped stays too. Fixes redhat-developer#2184
… thread where it stays suspended, and steps it DAPThreadRunStateSessionTest: 'main' stops and the worker is selected; once the worker continues alone, the current frame becomes the top frame of 'main' and a step sends 'next' for 'main'. When the worker continues alone while a frame of 'main' is selected, that frame stays the current frame.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2218 +/- ##
==========================================
+ Coverage 54.95% 54.97% +0.01%
==========================================
Files 836 836
Lines 35478 35502 +24
Branches 7317 7325 +8
==========================================
+ Hits 19497 19517 +20
+ Misses 13126 13123 -3
- Partials 2855 2862 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action not completed
|
|
@coderabbitai review |
Action performed
|
Fixes #2184
What
Since #2181, when a thread other than the one where a DAP session is suspended continues alone (
continuedwithallThreadsContinued: false), the session stays suspended and the Frames view says the thread is running. But if that thread was the selected one, the selection stayed on the frame of its stop:Change
DAPClient: when another thread continues alone, after the views are rebuilt, the newselectStoppedThreadruns.invokeLater, withModalityState.any(), expiring with the project). The 2024.2 Frames view asserts it's there.session.setCurrentStackFrame(stoppedStack, topFrame, true), which moves the Variables view and the execution point.setCurrentStackFrameis public API; on 2026.3 the backend sends the change to the split debugger's frontend.DAPSuspendContext.getExecutionStack(threadId), andDAPExecutionStack.hasStackFrame(frame), which compares by identity.Not in this PR:
invalidatedevent reloaded the continued thread's frames since it was selected, the frame objects differ and the selection isn't moved, as before.DAPExecutionStack.computeStackFramesmakes a stack the active one only when its frames were already loaded. The first time a thread whose frames aren't loaded is picked, its stack isn't made active after the load. Whether that shows up depends on how often the Frames view asks for the frames; I haven't confirmed that, so it isn't filed yet. The tests ask for the frames twice, as the view does.Tests
DAPThreadRunStateSessionTestgets two tests. Its test server givesmaina second frame and answersnext.mainstops, the worker is selected, and the worker continues alone. A bounded wait requires the current frame to become a different object withmain's frame id. It must bemain's top frame, Step's thread must bemain, and a step must sendnextformain.main's caller frame is selected, and the worker continues alone. The same frame object stays current, and a step sendsnextformain.Red-green: without the change, the first test fails ("the current frame moves to the top frame of 'main', but it is the frame 12"). The second passes both ways, as it guards against moving a selection that shouldn't move.
dap.*tests pass on all three: 496 each, 0 failures, 0 skipped.Behaviour change