vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Unable to use gdbserver stdin/stdout via ssh

Open jfuentesa opened this issue 1 year ago • 0 comments

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

jfuentesa avatar Sep 30 '24 13:09 jfuentesa