arch/src/armv7-m: Add function to show tasks info
Adds 'up_showtasks' function in crash dump state
'up_showtasks' prints list of all tasks in the system
with PID and amount of stack used
@@ -178,6 +178,43 @@ static inline void up_registerdump(void)
#define up_registerdump()
#endif
+/****************************************************************************
+ * Name: up_taskdump
+ ****************************************************************************/
+
+#ifdef CONFIG_STACK_COLORATION
+static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
+{
+ /* Dump interesting properties of this task */
+
+#if CONFIG_TASK_NAME_SIZE > 0
+ lldbg("%s: PID=%d Stack Used=%lu of %lu\n",
+ tcb->name, tcb->pid, (unsigned long)up_check_tcbstack(tcb),
+ (unsigned long)tcb->adj_stack_size);
+#else
+ lldbg("PID: %d Stack Used=%lu of %lu\n",
+ tcb->pid, (unsigned long)up_check_tcbstack(tcb),
+ (unsigned long)tcb->adj_stack_size);
+#endif
+}
+#endif
+
+/****************************************************************************
+ * Name: up_showtasks
+ ****************************************************************************/
+
+#ifdef CONFIG_STACK_COLORATION
+static inline void up_showtasks(void)
+{
+ /* Dump interesting properties of each task in the crash environment */
+
+ sched_foreach(up_taskdump, NULL);
+}
+#else
+#define up_showtasks()
+#endif
+
+
/****************************************************************************
* Name: assert_tracecallback
****************************************************************************/
@@ -305,9 +342,20 @@ static void up_dumpstate(void)
/* Then dump the registers (if available) */
up_registerdump();
+
+ /* Dump the state of all tasks (if available) */
+
+ lldbg("*******************************************\n");
+ lldbg("List of all tasks in the system:\n");
+ lldbg("*******************************************\n");
+ up_showtasks();
+
+ /* Dump MPU regions info */
+
#ifdef CONFIG_ARMV7M_MPU
mpu_show_regioninfo();
#endif
+
#ifdef CONFIG_ARCH_USBDUMP
/* Dump USB trace data */
