Skip to content

Remote debug #207

Open
Open
@peter197321

Description

@peter197321

Hi guys,

I've created a simple c project, I am using VSCode, Win10 and WSL (Ubuntu). The C-simple I can compile on my localhost machine with aarch64-linux-gnu-g++ cross-compiler in WSL(Ubuntu) environment.

Here is a task.json for compilation setting:

{
        "type": "shell",
        "label": "aarch64-linux-gnu-g++",
        "command": "/usr/bin/aarch64-linux-gnu-g++",
        "args": [
            "-ggdb",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}.arm64"
        ],
        "options": {
            "cwd": "/usr/bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        }
    }

My launch.json should allow me to debug this C-project

    {
        "type": "gdb",
        "request": "launch",
        "name": "Launch Program (SSH)",
        "target": "./main.arm64",
        "cwd": "${workspaceRoot}",
        "preLaunchTask": "aarch64-linux-gnu-g++",
        "ssh": {
           "host": "10.171.89.215",
           "cwd": "/home/root/c_sample",
           "user": "root",
           "password": "",
           "port": 22,
           "useAgent": false,
           "forwardX11": false,
        },
    }

Unfortunately, I need to have sources and built binaries on target to do debug. I assume that just build main.arm64 needed and debugging is happening on localhost which I want to avoid.
How to remotely debug to avoid copying sources on the target (remote) machine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionwslDebugging on Windows to a WSL instance on the same machine.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions