简体   繁体   中英

having issues getting Visual Studio Code + Remote-SSH & Native debug to connect to openocd (i.e. gdbserver)

Is there a way to turn on some kind of log output from Visual Studio Code to figure out what is going on with a debug connection to a gdbserver (in this case openocd)?

I am running Visual Studio Code on MacOs with the Microsoft extension Remote-SSH and Native debug. Using the Remote-SSH I am connecting to a CentOS system and have been able to edit and debug code there. I can debug command line C & python using gdb without issues, but have been unable to connect to an openocd gdbserver using the following setup in my launch.json file:

    ```{
        "name": "gdb remote",
        "type": "gdb",
        "request": "attach",
        "remote":true,
        "executable": "${WorkspaceFolder}/build/xyz.elf",
        "gdbpath": "/usr/bin/gdb",
        "debugger_args": ["-ex \"source ~/platform.gdb\""], //sets the correct architecture
        "target": "A.B.C.D:10010",
    },```

When I try to run the remote gdb debug in the launch.json above everything looks happy at first. I get the debug bar with all the expected buttons on it, but it won't do anything. If I check the openocd output it does not tell me that there have been any gdb connections. If I run gdb from the command line on the remote system, set the appropriate architecture and execute "target remote ABC.D:10010" I connect without issues and openocd informs me that there has been a connection. Any suggestions or help in debugging why VSCode doesn't really connect would be greatly appreciated.

PS I am a recent convert to Visual Studio code from another editor and am not completely familiar with all of its settings. This recent switch in editors is due to the recent work from home mandate making my old XWindows editor impossible to use over VPN. VSCode with the Remote-SSH seems to be the best solution I have found so far, so I am very eager to get the gdb with target remote working.

Just to see the logged output of VSCode wrt SSH, which is not directly solving your problem, try this in VSCode on your Mac:

  1. View -> Output. A window should show up in a panel named "OUTPUT". There may be several other panels, such as "PROBLEMS", "DEBUG CONSOLE", "TERMINAL".
  2. Each of these panels has a dropdown in the upper right hand corner.
  3. In "OUTPUT", select the drop-down, and you should be able to find "Remote - SSH" that will show a log of what happens when you connect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM