Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arch: riscv: implement frame-pointer based stack unwinding
Influenced heavily by: https://lists.denx.de/pipermail/u-boot/2023-May/518216.html the implementation in x86 and others in Meta. `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 ``` qemu_riscv64 output when using an illegal instruction, timestamp is removed to fit into the column limit: ```log *** Booting Zephyr OS build zephyr-v3.5.0-3687-gdd23d5b175cf *** <err> os: <err> os: mcause: 2, Illegal instruction <err> os: mtval: 7777777 <err> os: a0: 000000000000000c t0: 0000000000000000 <err> os: a1: 0000000010000000 t1: 000000008000f4d0 <err> os: a2: 000000000000000a t2: 0000000000000000 <err> os: a3: 0000000080010e00 t3: 0000000000000000 <err> os: a4: 0000000000000001 t4: 0000000000000000 <err> os: a5: 000000008000c3d3 t5: 0000000000000000 <err> os: a6: 000000008000cd00 t6: 0000000000000000 <err> os: a7: 0000000080010e28 <err> os: ra: 0000000080000472 <err> os: mepc: 0000000080000472 <err> os: mstatus: 0000000a00001880 <err> os: <err> os: Call Trace begin: <err> os: 0: fp: 0000000080010e40 ra: 00000000800004a6 <err> os: 1: fp: 0000000080010e60 ra: 00000000800004ca <err> os: 2: fp: 0000000080010e70 ra: 00000000800054e2 <err> os: 3: fp: 0000000080010e80 ra: 000000008000136a <err> os: Call Trace end <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 <err> os: Current thread: 0x8000eb60 (unknown) <err> os: Halting system ``` Signed-off-by: Yong Cong Sin <ycsin@meta.com>
- Loading branch information