microsoft / microsoft/vscode-cpptools

Unable to use gdbserver stdin/stdout via ssh

Open
#12,785 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: RHEL 8.10
  • VS Code: 1.93.1
  • C/C++ extension: cppdbg
  • OS and version of remote machine (if applicable): RHEL 8.4
  • GDB / LLDB version: (GDB) Red Hat Enterprise Linux 8.2-15.el8 (same gdbserver version)
Bug Summary and Steps to Reproduce

Bug Summary: Unable to use gdbserver stdin/stdout via ssh

Steps to reproduce:

  1. First of all, I create a .custom-gdbinit to connect via target remote | ssh... with support for stdin/stdout connection.
set solib-search-path /path/to/debug/symbols
target remote | ssh USER@HOST "gdbserver - --attach PID"

The connection with this syntax works well.

  1. "launch" type configuration in the launch.json.

  2. Run debug.

  3. See error:

image

Debugger Configurations

launch.json

{
            "name": "Remote debug",
            "type": "cppdbg",
            "request": "launch", // already tested with attach, it doesn't work because a local PID is required
            "stopAtEntry": true,
            "stopAtConnect": true,
            "program": "/path/to/executable", // The program exists only in the remote host
            "cwd": "${workspaceFolder}",
            "miDebuggerPath": "/usr/bin/gdb",
            "miDebuggerArgs": "--silent -x \"${workspaceFolder}/.custom-gdbinit\"",
            "filterStderr": true,
            "setupCommands": [],
            "customLaunchSetupCommands": [],
            "launchCompleteCommand": "None", // None to avoid the "exec-launch" command
            "preLaunchTask": "pre", // Create the correct environment to start the debugging session
            "postRemoteConnectCommands": [],
            "postDebugTask": "post", // Reset the environment
            "logging": {
                "engineLogging": true,
                "exceptions": true,
                "moduleLoad": true,
                "natvisDiagnostics": true,
                "programOutput": true,
                "trace": true,
                "traceResponse": true
            },
        },

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "pre",
            "command": [
                "${workspaceFolder}/pre.sh"
            ],
            "type": "shell",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false,
                "clear": true,
                "revealProblems": "always"
            }
        },
        {
            "label": "post",
            "command": [
                "${workspaceFolder}/post.sh"
            ],
            "type": "shell",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false,
                "clear": true,
                "revealProblems": "always"
            }
        }
    ]
}
Debugger Logs
launch: program "xxx" does not exist
Other Extensions

No response

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the supplied launch.json, tasks.json, and .custom-gdbinit, checking the logged “program does not exist” failure. Then trace how the cppdbg launch request validates program and handles miDebuggerArgs for the target-remote SSH command. Done means the documented gdbserver stdin/stdout setup can start without requiring the remote-only program to exist locally, with regression coverage for this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.