arch: arm64: use symtab to print function name in stack trace

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>
This commit is contained in:
Yong Cong Sin 2024-05-18 17:36:43 +08:00 committed by Anas Nashif
commit 2a3d9d0d90
3 changed files with 15 additions and 0 deletions

View file

@ -13,6 +13,7 @@
* exceptions
*/
#include <zephyr/debug/symtab.h>
#include <zephyr/drivers/pm_cpu_ops.h>
#include <zephyr/arch/common/exc_handle.h>
#include <zephyr/kernel.h>
@ -224,8 +225,16 @@ static void esf_unwind(const z_arch_esf_t *esf)
LOG_ERR("");
while (fp != NULL) {
lr = fp[1];
#ifdef CONFIG_SYMTAB
uint32_t offset = 0;
const char *name = symtab_find_symbol_name(lr, &offset);
LOG_ERR("backtrace %2d: fp: 0x%016llx lr: 0x%016llx [%s+0x%x]",
count++, (uint64_t) fp, lr, name, offset);
#else
LOG_ERR("backtrace %2d: fp: 0x%016llx lr: 0x%016llx",
count++, (uint64_t) fp, lr);
#endif
fp = (uint64_t *) fp[0];
}
LOG_ERR("");

View file

@ -71,6 +71,10 @@ Architectures
* ARM
* ARM64
* Implemented symbol names in the backtraces, enable by selecting :kconfig:option:`CONFIG_SYMTAB`
* RISC-V
* The fatal error message triggered from a fault now contains the callee-saved-registers states.

View file

@ -53,9 +53,11 @@ tests:
arch.common.stack_unwind.symtab:
arch_allow:
- riscv
- arm64
integration_platforms:
- qemu_riscv32
- qemu_riscv64
- qemu_cortex_a53
extra_args: OVERLAY_CONFIG="enable_fp.conf"
harness_config:
type: multi_line