This is an automated email from the ASF dual-hosted git repository. linguini1 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 40bbf67bd3aacc13a74c3a5bcee9fbb27d9117dd Author: Jukka Laitinen <[email protected]> AuthorDate: Thu Jun 4 15:51:52 2026 +0300 sched/misc/assert: Add CONFIG_SCHED_DUMP_TASKS and CONFIG_SCHED_DUMP_STACK Add more refined options for sched/misc/assert to control how verbose crash dumps are printed out: - SCHED_DUMP_TASKS - SCHED_DUMP_STACK These default to y unless DEFAULT_SMALL is defined. The options can be undefined to save flash space on a small system. Signed-off-by: Jukka Laitinen <[email protected]> --- Kconfig | 22 ++++++++++++++++++++++ sched/misc/assert.c | 16 +++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/Kconfig b/Kconfig index def0bcf71a0..b7d2e6f49c6 100644 --- a/Kconfig +++ b/Kconfig @@ -733,6 +733,28 @@ config DEBUG_ALERT bool default n +config SCHED_DUMP_TASKS + bool "Include dumping the task info table in assert/crash output" + default !DEFAULT_SMALL + depends on DEBUG_ALERT + ---help--- + Selects whether the per-task table is printed as part of the + crash dump. + + Defaults to y unless DEFAULT_SMALL is selected. + +config SCHED_DUMP_STACK + bool "Include stack content in assert/crash output" + default !DEFAULT_SMALL + depends on DEBUG_ALERT && ARCH_STACKDUMP + ---help--- + When enabled, the crash dump prints the contents of each stack + (IRQ / kernel / user) as hex words. + + When disabled, only base and size are printed out for each stack. + + Defaults to y unless DEFAULT_SMALL is selected. + config DEBUG_FEATURES bool "Enable Debug Features" default n diff --git a/sched/misc/assert.c b/sched/misc/assert.c index ab6c47bbd4c..57db0448f1f 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -118,7 +118,7 @@ static spinlock_t g_assert_lock = SP_UNLOCKED; static uintptr_t g_last_regs[CONFIG_SMP_NCPUS][XCPTCONTEXT_REGS] aligned_data(XCPTCONTEXT_ALIGN); -#ifdef CONFIG_DEBUG_ALERT +#ifdef CONFIG_SCHED_DUMP_TASKS static FAR const char * const g_policy[4] = { "FIFO", "RR", "SPORADIC" @@ -173,6 +173,7 @@ static void sp_out_of_range(uintptr_t sp) _alert("ERROR: Stack pointer %" PRIxPTR " is not within the stack\n", sp); } +#ifdef CONFIG_SCHED_DUMP_STACK /**************************************************************************** * Name: stack_dump ****************************************************************************/ @@ -192,6 +193,7 @@ static void stack_dump(uintptr_t sp, uintptr_t stack_top) DUMP_PTR(ptr, 5), DUMP_PTR(ptr , 6), DUMP_PTR(ptr, 7)); } } +#endif /**************************************************************************** * Name: dump_stackinfo @@ -200,14 +202,14 @@ static void stack_dump(uintptr_t sp, uintptr_t stack_top) static void dump_stackinfo(FAR const char *tag, uintptr_t sp, uintptr_t base, size_t size, size_t used) { - uintptr_t top = base + size; - _alert("%s Stack:\n", tag); _alert(" base: %p\n", (FAR void *)base); _alert(" size: %08zu\n", size); +#ifdef CONFIG_SCHED_DUMP_STACK if (sp != 0) { + uintptr_t top = base + size; _alert(" sp: %p\n", (FAR void *)sp); /* Get more information */ @@ -237,6 +239,7 @@ static void dump_stackinfo(FAR const char *tag, uintptr_t sp, stack_dump(base, base + size); } +#endif } /**************************************************************************** @@ -346,10 +349,9 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp) ); } } - #endif -#ifdef CONFIG_DEBUG_ALERT +#ifdef CONFIG_SCHED_DUMP_TASKS /**************************************************************************** * Name: dump_task ****************************************************************************/ @@ -481,6 +483,7 @@ static void dump_fdlist(FAR struct tcb_s *tcb, FAR void *arg) static void dump_tasks(void) { +#ifdef CONFIG_SCHED_DUMP_TASKS #if CONFIG_ARCH_INTERRUPTSTACK > 0 int cpu; #endif @@ -551,9 +554,8 @@ static void dump_tasks(void) } #endif -#ifdef CONFIG_DEBUG_ALERT nxsched_foreach(dump_task, NULL); -#endif +#endif /* CONFIG_SCHED_DUMP_TASKS */ #ifdef CONFIG_SCHED_BACKTRACE nxsched_foreach(dump_backtrace, NULL);
