From: Angus Gratton Date: Thu, 8 Jun 2017 05:27:50 +0000 (+1000) Subject: panic handler: Print backtraces with calling address not return address X-Git-Tag: v2.1-rc1~42^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d7bffea2b03f50ebef4ce37086a1f6bbcde1007;p=esp-idf 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.) --- diff --git a/components/esp32/panic.c b/components/esp32/panic.c index 39d0560870..4d83864467 100644 --- a/components/esp32/panic.c +++ b/components/esp32/panic.c @@ -375,7 +375,7 @@ static void doBacktrace(XtExcFrame *frame) break; } 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)); if (pc < 0x40000000) { break;