arch: make the max stack frames configurable
Current on x86 & risc-v that implement stack trace, the maximum depth of the stack trace is defined by a macro. Introduce a new Kconfig:EXCEPTION_STACK_TRACE_MAX_FRAMES so that this is configurable in software. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
2a3d9d0d90
commit
c118cd5a13
3 changed files with 10 additions and 2 deletions
|
@ -20,7 +20,7 @@ uintptr_t z_riscv_get_sp_before_exc(const z_arch_esf_t *esf);
|
||||||
#define PR_REG "%016" PRIxPTR
|
#define PR_REG "%016" PRIxPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_STACK_FRAMES 8
|
#define MAX_STACK_FRAMES CONFIG_EXCEPTION_STACK_TRACE_MAX_FRAMES
|
||||||
|
|
||||||
struct stackframe {
|
struct stackframe {
|
||||||
uintptr_t fp;
|
uintptr_t fp;
|
||||||
|
|
|
@ -140,7 +140,7 @@ struct stack_frame {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_STACK_FRAMES 8
|
#define MAX_STACK_FRAMES CONFIG_EXCEPTION_STACK_TRACE_MAX_FRAMES
|
||||||
|
|
||||||
__pinned_func
|
__pinned_func
|
||||||
static void unwind_stack(uintptr_t base_ptr, uint16_t cs)
|
static void unwind_stack(uintptr_t base_ptr, uint16_t cs)
|
||||||
|
|
|
@ -389,6 +389,14 @@ config EXCEPTION_STACK_TRACE
|
||||||
print a stack trace of function memory addresses when an
|
print a stack trace of function memory addresses when an
|
||||||
exception is reported.
|
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
|
config EXCEPTION_STACK_TRACE_SYMTAB
|
||||||
bool "Print function names in the stack trace"
|
bool "Print function names in the stack trace"
|
||||||
select SYMTAB
|
select SYMTAB
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue