panic handler: Print backtraces with calling address not return address

This seems to clean up some of the more wrong addr2line output results (not
sure why, something to do with optimisations I think - perhaps the return
address may also be a jump target from some earlier line of the code.)
This commit is contained in:
Angus Gratton 2017-06-08 15:27:50 +10:00 committed by Angus Gratton
parent 47e789f538
commit 5d7bffea2b

View File

@ -375,7 +375,7 @@ static void doBacktrace(XtExcFrame *frame)
break; break;
} }
sp = *((uint32_t *) (sp - 0x10 + 4)); sp = *((uint32_t *) (sp - 0x10 + 4));
putEntry(pc, sp); putEntry(pc - 3, sp); // stack frame addresses are return addresses, so subtract 3 to get the CALL address
pc = *((uint32_t *) (psp - 0x10)); pc = *((uint32_t *) (psp - 0x10));
if (pc < 0x40000000) { if (pc < 0x40000000) {
break; break;