Repository navigation
Description
What
The Threads tab of a DAP debug session should show which threads run and which are stopped. This matters most when
the debug adapter resumes one thread alone. For example, a continued
event with allThreadsContinued: false for a thread that isn't the one the session is suspended at.
This was left out of #2106 (#2174). With #2174, such an event leaves the session suspended and asks for the threads
again, but the Threads tab still shows the thread as it did before.
Today
The Threads tab doesn't track whether a thread runs:
- A row's status is the
reasonof the lastthread
event of that thread, such asstartedorexited
(ThreadsPanel.refreshThread).
refreshThreads
keeps it when it shows the threads again. - Nothing changes the status when the program stops or resumes: not
stopped, notcontinued, not a resume or a
step of the session. - The icon is
ThreadRunningonly for the statusstarted, andThreadSuspendedfor any other
(getIconForStatus).
So a thread that started shows as running while it is stopped at a breakpoint. A thread that the adapter listed
without athreadevent shows as suspended while the program runs. - The Frames view keeps the stack of a thread that continued alone. VS Code clears the call stack of that thread
(debugSession.ts, in itscontinuedhandler).
How it could be done
-
Keep a run state per thread in the client of the session (the sessions of a tree,
startDebugging, number their
threads each), and update it from:stopped: itsthreadId, or all threads whenallThreadsStoppedistrue;continued: itsthreadId, or all threads unlessallThreadsContinuedisfalse;- the session's own resume and steps: all threads, or the stepped thread alone for a single-thread step (feat(dap): step only the current thread, with DAP's singleThread #1869);
threadwithexited.
-
The Threads tab shows that state: the icon, and the status text.
-
A thread that continued alone: its stack in the Frames view no longer shows the frames of the stop. Options:
- show it without frames;
- show it as running;
- when it is the selected stack, select the stopped thread's.
IntelliJ's suspend context has a fixed list of execution stacks, so this needs a check of what XDebugger allows.
-
Related: after another thread continued alone, Set Value refuses in the thread that is still stopped. feat: set the value of an Evaluate result with the DAP setExpression request #2150 ends
the execution epoch at everycontinued. With a run state per thread, the epoch could end only for the threads that
continued, if the debug adapter's references stay valid for the stopped ones. DAP doesn't say whether they do.
Test
- A unit test of the run state:
stoppedandcontinuedevents, with and withoutallThreadsStoppedand
allThreadsContinued, and the session's resume and single-thread step. - A session test, like
DAPContinuedEventSessionTestin feat: a DAP debug session shows the program running when the debug adapter says that it continued #2174. The main thread stops, then the worker continues
alone: the Threads tab shows the worker as running and the main thread as stopped, and the Frames view no longer
shows frames of the worker's stop.
Related: #2106, #2174, #1869 (single-thread steps), #2153 (terminate threads from the Threads tab).
Activity
test: the Threads tab of a DAP session shows which threads run, and a…
feat: the Threads tab of a DAP debug session shows which threads run,…
feat: the Frames view of a DAP thread which continued alone no longer…
docs: the Threads tab of a DAP debug session shows which threads run,…
test: the Threads tab of a DAP session shows which threads run, and a…
feat: the Threads tab of a DAP debug session shows which threads run,…
feat: the Frames view of a DAP thread which continued alone no longer…
docs: the Threads tab of a DAP debug session shows which threads run,…
test: the Threads tab of a DAP session shows which threads run, and a…
feat: the Threads tab of a DAP debug session shows which threads run,…
feat: the Frames view of a DAP thread which continued alone no longer…
docs: the Threads tab of a DAP debug session shows which threads run,…
test: the Threads tab of a DAP session shows which threads run, and a…