Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xtensa: Fix backtrace on exceptions #6136

Merged
merged 3 commits into from
Apr 23, 2022

Conversation

Ouss4
Copy link
Member

@Ouss4 Ouss4 commented Apr 22, 2022

Summary

Full backtrace was not available, because the code responsable for retrieving the correct registers (A0 and A1) was reading them from an incorrect SP.

Impact

Xtensa

Testing

before:

(gdb) bt
#0  xtensa_assert () at common/xtensa_assert.c:129
#1  0x400d402e in xtensa_user_panic (exccause=29, regs=0x3ffe0b88) at common/xtensa_assert.c:311
#2  0x400d39a6 in xtensa_user (exccause=29, regs=0x3ffe0b88) at chip/esp32_user.c:438
#3  0x4008086f in _xtensa_user_handler () at common/xtensa_user_handler.S:276
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

after

(gdb) bt
#0  xtensa_assert () at common/xtensa_assert.c:129
#1  0x400d402e in xtensa_user_panic (exccause=29, regs=0x3ffe0b88) at common/xtensa_assert.c:311
#2  0x400d39a6 in xtensa_user (exccause=29, regs=0x3ffe0b88) at chip/esp32_user.c:438
#3  0x40080875 in _xtensa_user_handler () at common/xtensa_user_handler.S:282
#4  0x400dd66a in hello_main (argc=0, argv=0x0) at hello_main.c:40
#5  0x400d2607 in nxtask_startup (entrypt=0x400dd65c <hello_main>, argc=1, argv=0x3ffe0480) at sched/task_startup.c:70
#6  0x400d13e3 in nxtask_start () at task/task_start.c:133

exception.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
@Ouss4 Ouss4 changed the title Fix backtrace on exceptions xtensa: Fix backtrace on exceptions Apr 22, 2022
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
@Ouss4
Copy link
Member Author

Ouss4 commented Apr 22, 2022

@gustavonihei I added one small commit since last review, PTAL.

frame with the previous frame.  The SP is already saved in A12.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
@xiaoxiang781216 xiaoxiang781216 merged commit 3942f4d into apache:master Apr 23, 2022
@Ouss4 Ouss4 deleted the xtensa_userexc branch April 23, 2022 02:25
@jerpelea jerpelea added this to To-Add in Release Notes - 11.0.0 Aug 30, 2022
@jerpelea jerpelea moved this from To-Add to Added in Release Notes - 11.0.0 Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants