Search code examples
gdbembeddedremote-debuggingbootloadercortex-m

How can I debug a bootloader and application in the same GDB session on Cortex-M devices?


Classic setup: There is a bootloader, and application, compiled separately. If everything is right, the bootloader jumps on the application.

I attach a probe, run the gdbserver, start gdb with the bootloader binary. If I run file application.elf then I lose my symbols for the bootloader.

How can I observe the handover, and what the application does exactly right after the jump, by running one instruction at a time?

Probably possible with an SWD commander by tracing the PC step-by-step and using addr2line to decode each step, but I'm hoping for a more proper way.


Solution

  • You can load the symbols with:

    gdb add-symbol-file