define hf_backtrace
set $pc = ((uint32_t*)$psp)[6]
set $lr = ((uint32_t*)$psp)[5]
set $r12 = ((uint32_t*)$psp)[4]
set $r3 = ((uint32_t*)$psp)[3]
set $r2 = ((uint32_t*)$psp)[2]
set $r1 = ((uint32_t*)$psp)[1]
set $r0 = ((uint32_t*)$psp)[0]
# Use 4*26 with FPU, 4*8 without FPU
set $sp = $psp + 4*26
bt
end
Basically it emulates an exception return and gdb can then backtrace from the position where the exception occurred.
I'm using a macro like this as a workaround:
define hf_backtrace t*)$psp) [6] t*)$psp) [5] t*)$psp) [4] t*)$psp) [3] t*)$psp) [2] t*)$psp) [1] t*)$psp) [0]
set $pc = ((uint32_
set $lr = ((uint32_
set $r12 = ((uint32_
set $r3 = ((uint32_
set $r2 = ((uint32_
set $r1 = ((uint32_
set $r0 = ((uint32_
# Use 4*26 with FPU, 4*8 without FPU
set $sp = $psp + 4*26
bt
end
Basically it emulates an exception return and gdb can then backtrace from the position where the exception occurred.