Skip to content

DAP: support the Continued event #2106

Done

Description

@lagergren

What

The continued event tells the client that the program resumed without a client request that implied it. Its body has threadId and allThreadsContinued. When allThreadsContinued is omitted or true, all threads resumed. There is no capability flag.

Why

When the program resumes on its own, the IDE must stop showing it as paused. Adapters that send this event (source read on default branches, 2026-11-22):

  • GDB native DAP: sends it only for resumes that no DAP request caused (gdb/python/lib/gdb/dap/events.py:133-177). An example is continue or next typed as a CLI command in the Debug console. LSP4IJ sends console lines as evaluate with context repl.
  • vscode-js-debug: sends it on every CDP Debugger.resumed, whatever resumed the target, with allThreadsContinued: false (src/adapter/threads.ts:775, :1951-1956). It also sends it when it refreshes a stack (:934).
  • debugpy (pydevd): sends it when a thread resumes after a suspend (pydevd.py:2395, :2451).
  • CodeLLDB: sends it on every change of the process to running or stepping (src/codelldb/src/debug_session.rs:1463, :1500-1504).
  • lldb-dap: the same (lldb/tools/lldb-dap/EventHelper.cpp:361-379, :458-461).
  • Delve: sends it before the response to next, stepIn, stepOut and stepBack (service/dap/server.go:2500-2510).
  • netcoredbg: sends it on Step and Continue.
  • java-debug: sends it for its custom continueAll and continueOthers requests, for terminate, restartFrame and hot code replace.
  • Not sent: rdbg, MIEngine.

Most of these follow a request from the IDE, when IntelliJ already shows the session as running. The ones that matter are the resumes nobody in the IDE asked for.

Today

DAPClient doesn't override continued, and LSP4J's default method does nothing. When the program resumes on its own, the session stays suspended:

  • Frames and Variables show the old stop.
  • Resume and the step actions stay enabled, and Pause stays disabled.
  • A step sends next for a thread that is running.

At the next stop, getSuspendContext reuses the old DAPSuspendContext and adds every thread to it again: addToExecutionStack appends. The thread list can then show each thread twice. This is from reading the code; I did not reproduce it.

How it could be done

  • Override continued(ContinuedEventArguments) in DAPClient.

  • Call getSession().sessionResumed() when all of these hold:

    • the session is suspended;
    • its suspend context is a DAPSuspendContext of this client;
    • allThreadsContinued is not false, or threadId is the context's thread.

    Child sessions started with startDebugging get their own events. A worker's continued must not resume a session suspended in the page's session.

  • When allThreadsContinued is false for another thread, keep the session suspended. Refresh the Threads panel (getThreads(true)) and show that thread as running.

  • XDebugSession.sessionResumed() is public in both 2024.2 and 2026.3, and not internal. In both versions XDebugSessionImpl.sessionResumed() only calls doResume() (bytecode checked). doResume():

    • clears the paused data and fires beforeSessionResume and sessionResumed;
    • does not call XDebugProcess.resume(), so no continue is sent;
    • returns at once when the session isn't paused. So the many continued events that follow a step or a Resume from the IDE do nothing.
  • LSP4IJ already calls sessionResumed() from the LSP4J thread, in DAPDropFrameHandler.restartFrame.

  • Race: stopped is handled asynchronously: threads, then stackTrace, then suspend() through thenAcceptAsync (DAPClient.java:586). A continued that arrives meanwhile would be undone by the late positionReached. The fix:

    • keep a per-client counter that continued increments;
    • stopped captures it;
    • suspend() skips positionReached and breakpointReached if the counter changed.

    js-debug's continued-then-stopped refresh produces exactly this order.

  • Threading: events arrive on LSP4J's reader thread. No read action is needed.

  • Compatibility: adapters that never send continued behave as today. Behaviour change: the views clear when the adapter says the program runs. ContinueResponse.allThreadsContinued stays out of scope.

  • For reference, VS Code clears the call stack of that thread, or of all threads (debugSession.ts:1136-1160).

  • Docs: mark Continued as supported in docs/dap/DAPSupport.md.

Test

  • Unit test: use JUnit 5 with java.lang.reflect.Proxy fakes of XDebugSession, as DAPClientInvalidatedTest and DAPDropFrameHandlerTest do. Extract the decision into a static helper and check that it resumes for:

    • all threads;
    • the context's thread with allThreadsContinued: false.

    Check that it does not resume for:

    • another thread;
    • another client;
    • a session that is not suspended.
  • Session test: use HeavyPlatformTestCase like DAPStepOnlyCurrentThreadSessionTest: an in-process IDebugProtocolServer behind DSPLauncher.createServerLauncher on a loopback socket, and a DAPRunConfiguration in ATTACH mode.

    • After the first stop, the server calls client.continued(...); wait until !session.isSuspended().
    • On the next stop, assert one execution stack per thread.
    • For the race, the server sends stopped and continued back to back. The session must end up not suspended.

Effort and risk

Small. Low risk with the counter. Open questions:

  • Should the Threads panel show a running state per thread?
  • Should ContinueResponse.allThreadsContinued: false be handled as well?

Related: #1766 (invalidated), #1899 (session tree).

Activity

  1. added
    enhancement
    dap
    on Nov 22, 2026
  2. added this to the 0.30.2 milestone on Nov 24, 2026
  3. lagergren commented on Nov 24, 2026

    @lagergren
    CollaboratorAuthor

    #2174 implements this issue, except for one part, deferred for later: showing a thread that continued alone (allThreadsContinued: false) as running in the Threads tab. With #2174, such an event for another thread than the stopped one leaves the session suspended and asks for the threads again, but the Threads tab doesn't track whether a thread runs at all: a row shows the reason of the thread's last thread event, and nothing changes it at a stop or a resume. #2176 tracks it, with the Frames view of such a thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dapenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions