Hello everyone,
I’m currently stuck trying to set up debugging using a black magic probe (a hardware debugger based on gdb, used for debugging microcontrollers; see here for details: https://black-magic.org/ ).
What I managed so far was debugging regular C/C++ programs (running locally on my PC) using nvim-dap and nvim-dap-ui → This works completely according to my expectations.
What I can also do, is start gdb manually and flash and debug programs on a microcontroller using the black magic probe. The basic workflow here is:
- In bash: gdb
- In gdb-shell: target extended-remote /dev/ttyACM0 (–> connect gdb to the probe)
- In gdb-shell: monitor swdp_scan
- In gdb-shell: attach 1
- In gdb-shell: file /path/to/my/program.elf
- In gdb-shell: load
But I was not able, to set up a working nvim-dap config that does the above. The launch-request doesn’t work because the program is of the wrong architecture and the program isn’t even supposed to be run on the local machine but on the controller.
The attach-request also doesn’t work. As far as I can tell because attach is only intended for “remote” targets and not for “extended-remote” (which would be the case with the black magic probe). So when I try to use it, it comes to the conclusion that on the remote site, no debug session is active, and therefore exits immediately after starting.
Looking into the gdb-dap documentation (Debugging with GDB), it says that targets are always considered “remote” and there’s no option for “extended-remote”.
So now I wonder if what I’m trying to do is impossible, or if maybe I’m just doing it wrong. If this topic isn’t appropriate for this forum, please tell me, where it might fit better (it’s a bit difficult to tell since it’s in the middle between neovim; the nvim-dap plugin; and gdb).
Best Regards,
Neovimbat