From: Angus Gratton Date: Mon, 23 Oct 2017 07:46:43 +0000 (+0800) Subject: panic handler: Print correct PC & backtrace for debug exceptions X-Git-Tag: v3.1-dev~131^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c61060e673111e324c6d6968f6f62907c1ee5216;p=esp-idf panic handler: Print correct PC & backtrace for debug exceptions --- diff --git a/components/freertos/xtensa_vector_defaults.S b/components/freertos/xtensa_vector_defaults.S index c800a09eda..592dc323bd 100644 --- a/components/freertos/xtensa_vector_defaults.S +++ b/components/freertos/xtensa_vector_defaults.S @@ -34,8 +34,14 @@ The default behaviour is to just exit the interrupt or call the panic handler on _xt_debugexception: movi a0,PANIC_RSN_DEBUGEXCEPTION wsr a0,EXCCAUSE + /* _xt_panic assumes a level 1 exception. As we're + crashing anyhow, copy EPC & EXCSAVE from DEBUGLEVEL + to level 1. */ + rsr a0,(EPC + XCHAL_DEBUGLEVEL) + wsr a0,EPC_1 + rsr a0,(EXCSAVE + XCHAL_DEBUGLEVEL) + wsr a0,EXCSAVE_1 call0 _xt_panic /* does not return */ - rsr a0, EXCSAVE+XCHAL_DEBUGLEVEL rfi XCHAL_DEBUGLEVEL #endif /* Debug exception */