microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.53k stars 1.56k forks source link

No stdout from remote target when debugging over a "target remote" pipe #4977

Open RafaGago opened 4 years ago

RafaGago commented 4 years ago

Type: Debugger gdb

I don't know if it's the same as: https://github.com/Microsoft/vscode-cpptools/issues/827

But as the issue was 2.5 years old I open a new one.

I'm unable to see gdbserver's output. The output is sent back to VSCode, so it's a parsing error.

I'm running my application through a "target remote" pipe in "customLaunchSetupCommands", as the docker container has no connectivity and I don't own the container. The relevant parts of my configuration:

"customLaunchSetupCommands": [
      {
        "description": "Pipe launch gdbserver",
        "text": "target remote | docker exec -i <container> gdbserver - ${workspaceFolder}/<app>",
        "ignoreFailures": false
      },
      {
        "description": "Some apps include relative dirs",
        "text": "cd ${workspaceFolder}",
        "ignoreFailures": false
      },
      {
        "description": "Stop at main",
        "text": "b main",
        "ignoreFailures": false
      }
    ],

I have logging enabled:

"logging": {
    "trace": true,
     "traceResponse": true,
     "engineLogging": true
},

I see in the logs that gdbserver is generating the output, it's just that it's not correctly parsed.e.g:

--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (23145) ->&\" 4 FAILED TESTS\\n\"\n"},"seq":803}
1: (23145) ->&" 4 FAILED TESTS\n"
pieandcakes commented 4 years ago

can you see if setting filterStdout to false in your launch.json will fix the issue?

RafaGago commented 4 years ago

Unfortunately not.

BTW, I updated VS Code to 1.42 yesterday.

RafaGago commented 4 years ago

Maybe you can reproduce it by running the same commands, but piping "ssh" instead of "docker" to your local host.

mattofak commented 12 months ago

This appears to still be an issue in v1.84.1.

In an attempt to patch this myself, I've looked through the MIEngine and vscode-cpptools repositories to try and determine where input from the debugger is parsed, but not found it in the soup. I probably need to work backwards from whatever feeds the Debug Console/emits the logging data.

starball5 commented 11 months ago

Related on Stack Overflow: VSCode Output Capture when using GDB Remote Targets