-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
arch: riscv: implement frame-pointer based stack unwinding #69912
Conversation
dd23d5b
to
a7942b1
Compare
@ycsin - LGTM - I wonder if it's possible to add a check to a new or existing testsuite. |
Maybe in https://github.com/zephyrproject-rtos/zephyr/tree/main/tests/kernel/fatal/exception ? I'll try. |
Hey @ycsin, This looks really cool. I am away now, but I can give this a try out next week? |
36b1403
to
462d088
Compare
aa0e5f9
to
7a5c717
Compare
7a5c717
to
720c114
Compare
5e1edf9
to
3814feb
Compare
3814feb
to
7f9debb
Compare
Influenced heavily by the RISCV64 stack unwinding implementation in the Linux kernel. `CONFIG_RISCV_EXCEPTION_STACK_TRACE` can be enabled by configuring the following Kconfigs: ```prj.conf CONFIG_DEBUG_INFO=y CONFIG_EXCEPTION_STACK_TRACE=y CONFIG_OVERRIDE_FRAME_POINTER_DEFAULT=y CONFIG_OMIT_FRAME_POINTER=n ``` Signed-off-by: Yong Cong Sin <[email protected]>
Added test for archs that support it. It triggers an exception and verify that the fatal message has stack unwind info. Signed-off-by: Yong Cong Sin <[email protected]>
7f9debb
to
14149b1
Compare
Rebased on top of #71388, CI is green now. |
Add an entry in the RISC-V arch section about the implementation of frame-pointer based stack unwinding. Signed-off-by: Yong Cong Sin <[email protected]>
@@ -38,6 +38,24 @@ config RISCV_ALWAYS_SWITCH_THROUGH_ECALL | |||
and most people should say n here to minimize context switching | |||
overhead. | |||
|
|||
config RISCV_ENABLE_FRAME_POINTER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to make this a generic arch kconfig (CONFIG_FRAME_POINTER), we now have two architectures doing this
and OMIT_FRAME_POINTER. It is automatically enabled when the frame | ||
pointer unwinding is enabled. | ||
|
||
config RISCV_EXCEPTION_STACK_TRACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Influenced heavily by the RISCV64 stack unwinding implementation in the Linux kernel.
zephyr/tests/arch/common/stack_unwind/src/main.c
Lines 15 to 39 in 14149b1