This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit afa4e305f4e9f9bc647eff5e7b4435064e2137d9 Author: ligd <[email protected]> AuthorDate: Wed Jun 3 20:23:57 2026 +0800 assert: gate all-thread backtrace dump behind CONFIG_SCHED_DUMP_BACKTRACE Dumping the stack backtrace of every thread on assert is expensive and not always wanted. Add CONFIG_SCHED_DUMP_BACKTRACE (depends on SCHED_BACKTRACE, default y) to gate only the all-thread backtrace walk in dump_tasks(), while the task table dump itself stays unconditional. Signed-off-by: ligd <[email protected]> --- sched/Kconfig | 8 ++++++++ sched/misc/assert.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sched/Kconfig b/sched/Kconfig index b2177ba02a6..2eb958d0ee5 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -2215,6 +2215,14 @@ config SCHED_BACKTRACE compiler or architecture specific approach when ARCH_HAVE_BACKTRACE is selected +config SCHED_DUMP_BACKTRACE + bool "Dump backtrace of all threads on assert" + depends on SCHED_BACKTRACE + default y + ---help--- + Dump the stack backtrace of every thread when an assertion fails. + If not selected, only the backtrace of the crashing thread is dumped. + config GROUP_KILL_CHILDREN_TIMEOUT_MS int "Group kill children timeout" default 0 diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 15086315ce6..c8f276a715d 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -486,7 +486,7 @@ static void dump_task(FAR struct tcb_s *tcb, FAR void *arg) * Name: dump_backtrace ****************************************************************************/ -#ifdef CONFIG_SCHED_BACKTRACE +#ifdef CONFIG_SCHED_DUMP_BACKTRACE static void dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg) { sched_dumpstack(tcb->pid); @@ -586,7 +586,7 @@ static void dump_tasks(void) nxsched_foreach(dump_task, NULL); #endif /* CONFIG_SCHED_DUMP_TASKS */ -#ifdef CONFIG_SCHED_BACKTRACE +#ifdef CONFIG_SCHED_DUMP_BACKTRACE nxsched_foreach(dump_backtrace, NULL); #endif
