Skip to content

debug server startup fails due to stdout buffering #9388

@tlyu

Description

@tlyu

Issue Type: Bug

This is probably actually a problem in MIEngine.

I'm using the Arduino extension on macOS, and debugging with avarice and avr-gdb, but this problem also occurs if I configure a plain cppdbg instance in launch.json instead of using the Arduino extension's debugger.

If specifying a debug server to start, it apparently gets launched with pipes, not a pseudo-terminal. If it doesn't flush its stdout, then VS Code will probably never see its startup message, and therefore time out on starting it.

This category of bug seems to have been reported multiple times, usually without resolution, and usually by people working with gdb debug servers.

On macOS, there is a workaround of using /usr/bin/env as debugServerPath, and specifying STDBUF1=L with the rest of the debug server path and arguments.

Arguably, authors of debug servers should line-buffer or explicitly flush their status messages sent to stdout, but this is a subtle interaction that is unlikely to be reported or well-troubleshooted.

Extension version: 1.9.8
VS Code version: Code 1.67.2 (Universal) (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:20:57.384Z)
OS version: Darwin x64 19.6.0
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz (8 x 3100)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.08GB free)
Process Argv --crash-reporter-id 8c334355-bde7-413a-8609-0fd7d4a582f2
Screen Reader no
VM 22%

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions