C-based game crashing only on device

After a hard crash we log all of the registers we can to /crashlog.txt; e.g.:

--- crash at 2022/05/02 19:18:59---
build:655189161362_dirty-dave_custom-synth-generators-and-signals-dev.20220502135538-dave
   r0:00000002    r1:20030ff0     r2:00000001    r3: 00000000
  r12:006d3000    lr:0802eabb     pc:0802eabe   psr: 61000000
 cfsr:00000000  hfsr:40000000  mmfar:00000000  bfar: 00000000
rcccsr:00000000
heap allocated: 131264
Lua totalbytes=0 GCdebt=0 GCestimate=0 stacksize=0

The first thing you want to look at is pc and lr there--pc should be the address where the crash was (or maybe the address after) and lr points to the calling function, unless the current function is using it for something else. If you load your pdex.elf file into gdb and do info line *0x<address> it'll tell you what the functions are, if they're in the scope of the elf file.

6 Likes