From 5d7bffea2b03f50ebef4ce37086a1f6bbcde1007 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 8 Jun 2017 15:27:50 +1000 Subject: [PATCH] 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.) --- components/esp32/panic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.40.0