-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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 & arm64: print symbol name in stack trace #72973
Conversation
c63e3c6
to
a152dde
Compare
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.
RISC-V changes from 6a32c2c LGTM
Polished a few things, should be final now. |
2a3ad6e
to
e8078d6
Compare
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.
I have a few ideas to shrink the ROM footprint but that may come later
Use pyelftools to extract the symbol table from the link stage executable. Then, filter out the function names and sort them based on their offsets before writing into the `symtab.c`, this is similar to how the `isr_tables` works. To access the structure, simply include the new header: ```c #include <zephyr/debug/symtab.h> ``` Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Selecting `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` will enable the symtab generation which will be used in the stack trace to print the function name of the return address. Updated the `stack_unwind` test to test the symbols in a stack trace. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
The mepc register is the address of the instruction that was interrupted, it will make debugging easier if we know the name of the symbol, so print it if `CONFIG_SYMTAB` is enabled. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Selecting `CONFIG_SYMTAB` will enable the symtab generation which will be used in the stack trace to print the function name of the return address. Added `arm64` to the `arch.common.stack_unwind.symtab` test. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Current on x86 & risc-v that implement stack trace, the maximum depth of the stack trace is defined by a macro. Introduce a new Kconfig:EXCEPTION_STACK_TRACE_MAX_FRAMES so that this is configurable in software. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Rebased to fix merge conflict |
Failed CI passed locally:
|
See each commit message for details
https://builds.zephyrproject.io/zephyr/pr/72973/docs/releases/release-notes-3.7.html
Standing issue
I was expecting the same can be applied to x86, but
qemu_x86
crashes when I try to use something from the symtab.Testing
RISCV
ARM64
TODO