Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to attach to a remote gdb target with vscode?

I'm trying to setup the configuration to attach to a remote C/C++ gdb target running gdbserver with visual studio code. Is this currently supported? If so, how do I get around these limitations:

  1. The address and port options indicate that they aren't supported for C/C++.

  2. I can force code to use the special remote enabled version of gdb, but its trying to run the target application locally and not connecting to the target gdbserver platform.

  3. Will PowerPC remote targets be supported assuming I can solve #1 and #2?

like image 705
Linden Avatar asked Jun 29 '16 02:06

Linden


1 Answers

This is a bit late, but I just set this up right now. I'm debugging an linux application running on a remote ARM device

I installed the Native Debug extension for VS Code.

Here is my launch.json configuration

"configurations": [
    {
        "type": "gdb",
        "request": "attach",
        "name": "Attach to gdbserver",
        "executable": "<path to exe relative to workspace root>",
        "target": "X.X.X.X:9999",
        "remote": true,
        "cwd": "${workspaceRoot}", 
        "gdbpath": "D:/gcc-ma/bin/arm-linux-gnueabihf-gdb.exe"
    }]

So on my arm device running linux:

gdbserver localhost:9999 ./<application>

Then on windows, I attach to that server.

I have gdbpath set up because i need to use a version of gdb that understands arm. I got the correct windows binaries from here

I had lots of help along the way

  • http://austinhanson.com/vscode-gdb-and-debugging-an-os
  • https://github.com/WebFreak001/code-debug
  • https://github.com/Microsoft/vscode-cpptools/issues/78
like image 178
ceiling cat Avatar answered Nov 15 '22 02:11

ceiling cat