Skip to content

DAP: a line typed in the Debug console goes nowhere #1862

Closed

Description

@lagergren

A line typed in a debug session's Console is shown and then goes nowhere:

  • A program that reads its standard input can't get any, so a program that prompts for input can't be debugged.
  • The console can't evaluate an expression. VS Code's Debug Console sends a typed line as an evaluate request with the context repl, in the selected stack frame, and prints the result.

The cause is DAPConsoleView.DAPConsoleState.attachTo, which attaches the console to the debug adapter's process handler with output only:

return new ConsoleViewRunningState(console, processHandler, this, true, false);

The last argument is attachToStdIn, so ConsoleViewImpl keeps what the user types to itself.

A proposal: send each typed line as an evaluate request with the context repl and the selected frame's id, if any, and print its result, or its error message, in the console. An adapter that takes the program's input over the debug connection can then take the line as input while the program runs, as VS Code's do; one whose process takes input could have the console attach with input instead.

Seen with 0.21.0 and main (1988ab6c). We ran into it with the Ecstasy language's debug adapter (XVM): a card game that waits for Enter at every turn can't be played under IntelliJ's debugger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions