Having a make target for a GDB script would be nice. Here’s what I’m doing right now.
Load all symbols in the same GDB session:
- Extract the address of each module
- Load each ELF into GDB with
add-symbol-file, passing the address above (for some reason GDB doesn’t use the address in the ELF file as a default and forces you to find that address on your own)
Here’s my script to load GDB with this configuration.
When setting breakpoints, multiple symbols will often match because of the dynalib structure. Set a breakpoint as normal then disable the ones you don’t want.
(gdb) break setup
Breakpoint 1 at 0x806ed2c: setup. (3 locations)
Find out the one you need with
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x0806ed2c in system_part2_init at src/module_system_part2.c:96
1.2 y 0x0806ed2d <setup+4294967295>
1.3 y 0x080a02f0 in setup() at src/application.cpp:40
Disable all except the one in
(gdb) disable 1.1 1.2
Program received signal SIGINT, Interrupt.
setup () at src/application.cpp:40
38 /* This function is called once at start up ----------------------------------*/
39 void setup()
41 //Setup the Tinker application here
42 //Register all the Tinker functions
43 Particle.function("digitalread", tinkerDigitalRead);
44 Particle.function("digitalwrite", tinkerDigitalWrite);