From 190777dccf0577645284701f1c33c8c73ee1cf59 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Sat, 25 May 2024 12:52:50 +0800 Subject: [PATCH] arch: arm64: create ARM64_EXCEPTION_STACK_TRACE Currently, the stack trace in ARM64 implementation depends on frame pointer Kconfigs combo to be enabled. Create a dedicated Kconfig for that instead, so that it is consistent with x86 and riscv, and update the source accordingly. Signed-off-by: Yong Cong Sin --- arch/arm64/core/Kconfig | 7 +++++++ arch/arm64/core/fatal.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm64/core/Kconfig b/arch/arm64/core/Kconfig index 7cca2f7045f..367480015c4 100644 --- a/arch/arm64/core/Kconfig +++ b/arch/arm64/core/Kconfig @@ -154,6 +154,13 @@ config ARM64_ENABLE_FRAME_POINTER and OMIT_FRAME_POINTER. It is automatically enabled when the frame pointer unwinding is enabled. +config ARM64_EXCEPTION_STACK_TRACE + bool + default y + depends on FRAME_POINTER + help + Internal config to enable runtime stack traces on fatal exceptions. + config ARM64_SAFE_EXCEPTION_STACK_SIZE int "The stack size of the safe exception stack" default 4096 diff --git a/arch/arm64/core/fatal.c b/arch/arm64/core/fatal.c index 87e5a2441c6..0dbc13228de 100644 --- a/arch/arm64/core/fatal.c +++ b/arch/arm64/core/fatal.c @@ -195,7 +195,7 @@ static void esf_dump(const z_arch_esf_t *esf) LOG_ERR("x18: 0x%016llx lr: 0x%016llx", esf->x18, esf->lr); } -#ifdef CONFIG_FRAME_POINTER +#ifdef CONFIG_ARM64_EXCEPTION_STACK_TRACE static void esf_unwind(const z_arch_esf_t *esf) { /* @@ -363,9 +363,9 @@ void z_arm64_fatal_error(unsigned int reason, z_arch_esf_t *esf) esf_dump(esf); } -#ifdef CONFIG_FRAME_POINTER +#ifdef CONFIG_ARM64_EXCEPTION_STACK_TRACE esf_unwind(esf); -#endif /* CONFIG_FRAME_POINTER */ +#endif /* CONFIG_ARM64_EXCEPTION_STACK_TRACE */ #endif /* CONFIG_EXCEPTION_DEBUG */ z_fatal_error(reason, esf);