PlatformIO Community

Debugging on Eclipse: Breakpoints only working in Main.cpp

Hi,
I am developing with Arduino framework on a Arduino Mega 2560. I was able to integrate PlatformIO with Eclipse according to Eclipse — PlatformIO latest documentation .

First thing I notice:
It was necessary to manually add the Debug-Configuration in platformio.ini despite the mentioned

“A debugging feature is provided by Debugging and new debug configuration named “PlatformIO Debugger” is created. No need to do extra configuration steps!”

from the above instruction page.
In my case it looks like that (stolen from avr-stub — PlatformIO latest documentation):

;-- debugger settings --
debug_tool = avr-stub
debug_port = COM4
;-- GDB stub implementation --
lib_deps =
    jdolinay/avr-debugger @ ~1.4

And i also have to add the includes:

#include "avr8-stub.h"
#include "app_api.h"

Second thing I notice:
Starting a debug session takes pretty long (like 15s). This is not very handsome but acceptable.

Third thing I notice and that is the real issue: Breakpoints only work in Main.cpp!
I can only set breakpoints in the Main.cpp. There the execution stops, debug session shows as “halted”, instruction stepping and watching etc. works like expected.
But when I place a breakpoint in an other source file, the code execution seems to stop (e.g. some heartbeat LED stops blinking) but I don’t get the debug context in the IDE window. The debugger session is still shown as “running”. This is weird, isn’t it :thinking: :thinking: :thinking:?

Remarks:

  • The breakpoint() instruction works in all files, indeed. But it is not really useful because one has to rebuild the project every time one wants to add/remove a bp.
  • Switching to VSCode is not a real option for me neither (I tried it out). I work with different platforms on Eclipse since several years and for me, Eclipse is simply more ergonomic and better structured than VSCode.

So, any hint / help is welcome!

Thanks,
Marco