knurling-rs / probe-run

Run embedded programs just like native ones
Apache License 2.0
645 stars 75 forks source link

[PoC] spawn a GDB server on panics and hardfaults #315

Open japaric opened 2 years ago

japaric commented 2 years ago

when the --gdb flag is passed, probe-run will spawn a GDB server when the program panics or encounters a hardware fault (HardFault)

a GDB client can then connect to inspect the failure probe-run-gdb

blockers

open questions

$ arm-none-eabi-gdb -q target/thumbv7em-none-eabihf/debug/overflow
Reading symbols from target/thumbv7em-none-eabihf/debug/overflow...
(gdb) target remote :1337
Remote debugging using :1337
HardFaultTrampoline () at asm.S:19
19      asm.S: No such file or directory.
(gdb) backtrace
#0  HardFaultTrampoline () at asm.S:19
#1  <signal handler called>
Backtrace stopped: Cannot access memory at address 0x1ffff9a8
(gdb) frame 2
No frame at level 2.
(gdb) info registers
r0             0x7                 7
r1             0x1                 1
r2             0x2003fcdb          537132251
r3             0x2003fcdb          537132251
r4             0x1ffff9bc          536869308
r5             0x0                 0
r6             0x0                 0
r7             0x200039cc          536885708
r8             0x0                 0
r9             0x0                 0
r10            0x0                 0
r11            0x0                 0
r12            0x200079dc          536902108
sp             0x1ffff990          0x1ffff990
lr             0xfffffff9          4294967289
pc             0x16c8              0x16c8 <HardFaultTrampoline>
cpsr           0x21000003          553648131

alternative / possible extension