Created
January 7, 2021 19:23
-
-
Save leocelente/7d15896a1a842f8d31a7a45e150b3452 to your computer and use it in GitHub Desktop.
Sync and Debug (gdbserver) C/C++ programs in a Raspberry-Pi with SSH and rsync using VSCode Tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "gdb", | |
"request": "attach", | |
"name": "Attach to gdbserver", | |
"executable": "./a.out", | |
"target": "XXX.XXX.XXX.XXX:2345", | |
"remote": true, | |
"cwd": "${workspaceRoot}", | |
"valuesFormatting": "parseText", | |
"gdbpath": "gdb-multiarch", | |
"autorun": ["set architecture arm", "set sysroot"], | |
}, | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Syncronize Executable", | |
"type": "shell", | |
"command": "rsync", | |
"args": [ | |
"-zravh", | |
"./a.out", | |
"<USER>@XXX.XXX.XXX.XXX:/home/<USER>/" | |
] | |
}, | |
{ | |
"label": "Run gdbserver on target", | |
"type": "shell", | |
"command": "ssh", // uses key-based authentication | |
"args": [ | |
"<USER>@XXX.XXX.XXX.XXX", | |
"gdbserver", | |
":2345", | |
"./a.out" | |
] | |
}, | |
{ | |
"label": "Debug on Target", | |
"dependsOrder": "sequence", | |
"dependsOn": [ | |
"Syncronize Executable", | |
"Run gdbserver on target" | |
], | |
"problemMatcher": [], | |
"group": { // CTRL+SHIFT+B will start the task | |
"kind": "build", | |
"isDefault": true | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment