From 074931057c709c1089472453b4df12607dcd8a10 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 16 Aug 2024 00:32:38 +0800 Subject: [PATCH] subsys/debug: remove `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` Having `CONFIG_EXCEPTION_STACK_TRACE_SYMTAB` to select the `CONFIG_SYMTAB` or to explicitly not print the symbol name during exception stack unwind seems unnecessary, as the extra code to print the symbol name is negligible when compared with the symbol table, so just remove it. Signed-off-by: Yong Cong Sin Signed-off-by: Yong Cong Sin --- arch/riscv/core/stacktrace.c | 8 ++++---- subsys/debug/Kconfig | 9 --------- tests/arch/common/stack_unwind/testcase.yaml | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/arch/riscv/core/stacktrace.c b/arch/riscv/core/stacktrace.c index 99e4655e80b..20f96efd1b0 100644 --- a/arch/riscv/core/stacktrace.c +++ b/arch/riscv/core/stacktrace.c @@ -248,20 +248,20 @@ static bool in_fatal_stack_bound(uintptr_t addr, const struct k_thread *const th #define PR_REG "%016" PRIxPTR #endif -#ifdef CONFIG_EXCEPTION_STACK_TRACE_SYMTAB +#ifdef CONFIG_SYMTAB #define LOG_STACK_TRACE(idx, ra, name, offset) \ LOG_ERR(" %2d: ra: " PR_REG " [%s+0x%x]", idx, ra, name, offset) #else #define LOG_STACK_TRACE(idx, ra, name, offset) LOG_ERR(" %2d: ra: " PR_REG, idx, ra) -#endif /* CONFIG_EXCEPTION_STACK_TRACE_SYMTAB */ +#endif /* CONFIG_SYMTAB */ static bool print_trace_address(void *arg, unsigned long ra) { int *i = arg; -#ifdef CONFIG_EXCEPTION_STACK_TRACE_SYMTAB +#ifdef CONFIG_SYMTAB uint32_t offset = 0; const char *name = symtab_find_symbol_name(ra, &offset); -#endif +#endif /* CONFIG_SYMTAB */ LOG_STACK_TRACE((*i)++, ra, name, offset); diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 0f34f75e68f..70779c2736c 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -387,15 +387,6 @@ config EXCEPTION_STACK_TRACE print a stack trace of function memory addresses when an exception is reported. -config EXCEPTION_STACK_TRACE_SYMTAB - bool "Print function names in the stack trace" - select SYMTAB - depends on EXCEPTION_STACK_TRACE - help - Enable this if you want to print the function names in the - stack trace output. This will generate the symtab and - can consume a lot of ROM if there's a lot of functions. - # # Miscellaneous debugging options # diff --git a/tests/arch/common/stack_unwind/testcase.yaml b/tests/arch/common/stack_unwind/testcase.yaml index 4a7d4994cb2..c10b98757cd 100644 --- a/tests/arch/common/stack_unwind/testcase.yaml +++ b/tests/arch/common/stack_unwind/testcase.yaml @@ -68,7 +68,7 @@ tests: - qemu_cortex_a53 extra_configs: - CONFIG_FRAME_POINTER=y - - CONFIG_EXCEPTION_STACK_TRACE_SYMTAB=y + - CONFIG_SYMTAB=y harness_config: type: multi_line regex: