diff --git a/arch/riscv/core/stacktrace.c b/arch/riscv/core/stacktrace.c index 1f3676252c6..e0c97b642ba 100644 --- a/arch/riscv/core/stacktrace.c +++ b/arch/riscv/core/stacktrace.c @@ -20,7 +20,7 @@ uintptr_t z_riscv_get_sp_before_exc(const z_arch_esf_t *esf); #define PR_REG "%016" PRIxPTR #endif -#define MAX_STACK_FRAMES 8 +#define MAX_STACK_FRAMES CONFIG_EXCEPTION_STACK_TRACE_MAX_FRAMES struct stackframe { uintptr_t fp; diff --git a/arch/x86/core/fatal.c b/arch/x86/core/fatal.c index 370386d4af9..a2aea657498 100644 --- a/arch/x86/core/fatal.c +++ b/arch/x86/core/fatal.c @@ -140,7 +140,7 @@ struct stack_frame { #endif }; -#define MAX_STACK_FRAMES 8 +#define MAX_STACK_FRAMES CONFIG_EXCEPTION_STACK_TRACE_MAX_FRAMES __pinned_func static void unwind_stack(uintptr_t base_ptr, uint16_t cs) diff --git a/subsys/debug/Kconfig b/subsys/debug/Kconfig index 819d7034353..00243f49be9 100644 --- a/subsys/debug/Kconfig +++ b/subsys/debug/Kconfig @@ -389,6 +389,14 @@ config EXCEPTION_STACK_TRACE print a stack trace of function memory addresses when an exception is reported. +config EXCEPTION_STACK_TRACE_MAX_FRAMES + int "Configures the depth of stack trace" + default 8 + depends on EXCEPTION_STACK_TRACE + help + In the event of a stack trace, this place a limit on the depths + of the stack to examine. + config EXCEPTION_STACK_TRACE_SYMTAB bool "Print function names in the stack trace" select SYMTAB