]> granicus.if.org Git - esp-idf/commitdiff
panic handler: Print backtraces with calling address not return address
authorAngus Gratton <angus@espressif.com>
Thu, 8 Jun 2017 05:27:50 +0000 (15:27 +1000)
committerAngus Gratton <gus@projectgus.com>
Wed, 14 Jun 2017 00:30:04 +0000 (10:30 +1000)
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

index 39d05608707442ed9fb339b573fadef5e4b84115..4d8386446776a59ded92bafa7d60d422c5f6a022 100644 (file)
@@ -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;