code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

Remote debug

Open peter197321 opened this issue 5 years ago • 0 comments

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?

peter197321 avatar Feb 05 '20 15:02 peter197321