Debugging with openocd and gdb on remote host
Hi.
I have been developing an application on a STM32F4 MCU and found Clion very helpful with its compatability with STM32CubeMx and OpenOCD.
As I've been having some issues with toolchains on different operating systems, I decided to move everything to a docker container so the environment is repeatable, easy to play around in and so I can use ubuntu/linux (I'm stuck on Windows, so sadly it's not an option to use another OS on the host).
I followed this Jetbrains blog post and I have a working setup with a similiar dockerfile presented in the post with the extension of installing gcc-arm-none-eabi.
When I build my target in docker and run OpenOCD Download and Run in debug mode, the build is run in the container and outputs an elf file, OpenOCD is run on windows, the MCU is programmed, so far so good.
If I have my docker toolchain set as default in Clion settings, it complains that it can't find the path to the gdb (my guess is that OpenOCD Download and Run tries to run the default toolchain gdb on the host)
If I have my MinGW as default toolchain, then I can manage to debug it a little, but I only get the disassembly of the file. None of my breakpoints are working, as the red dot marker is exchanged to a stop sign with the text "Breakpoint will not currently be hit. No executable code is associated with this line"
Is it possible to get the breakpoints running in some other configuration?
Thank you for any help you can provide!
请先登录再写评论。
Hello!
Remote mode for the embedded development is not yet supported: https://youtrack.jetbrains.com/issue/CPP-15490. Feel free to comment or upvote the issue in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.
Hello,
I think your binary is assembled in docker, and the debug info contains unix-style file paths, and, thus, debugger which is run under windows, can't map that paths to your sources. There is "Source path mapping" feature in gdb for such cases. You may try to setup that path mapping via project .gdbinit.
More details here: https://sourceware.org/gdb/current/onlinedocs/gdb/Source-Path.html
Sorry for the late reply, thank you for your answers!
I have updated the description above, as Ilia pointed out, the binary is assembled in the docker container, which I wasn't that clear about.
I'll look into that option of .gdbinit, I'm not very familiar with gdb so feedback might take a little while.