xiaoxiang781216 commented on code in PR #19061:
URL: https://github.com/apache/nuttx/pull/19061#discussion_r3373193456


##########
sched/misc/assert.c:
##########
@@ -347,9 +349,44 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
     }
 }
 
+#else /* CONFIG_SCHED_DUMP_STACK */
+
+/****************************************************************************
+ * Name: dump_stacks
+ ****************************************************************************/
+
+static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
+{
+  UNUSED(sp);
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+#  ifdef CONFIG_SMP
+  int cpu = rtcb->cpu;
+#  else
+  int cpu = this_cpu();
+#  endif
+
+  _alert("IRQ Stack: base: %p size: %u\n",
+         (FAR void *)up_get_intstackbase(cpu),
+         (unsigned)CONFIG_ARCH_INTERRUPTSTACK);

Review Comment:
   remove the cast



##########
sched/misc/assert.c:
##########
@@ -347,9 +349,44 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
     }
 }
 
+#else /* CONFIG_SCHED_DUMP_STACK */
+
+/****************************************************************************
+ * Name: dump_stacks
+ ****************************************************************************/
+
+static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
+{
+  UNUSED(sp);
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+#  ifdef CONFIG_SMP
+  int cpu = rtcb->cpu;
+#  else
+  int cpu = this_cpu();
+#  endif
+
+  _alert("IRQ Stack: base: %p size: %u\n",
+         (FAR void *)up_get_intstackbase(cpu),
+         (unsigned)CONFIG_ARCH_INTERRUPTSTACK);
+#endif
+
+#ifdef CONFIG_ARCH_KERNEL_STACK
+  _alert("Kernel Stack: base: %p size: %u\n",
+         rtcb->xcp.kstack,
+         (unsigned)CONFIG_ARCH_KERNEL_STACKSIZE);

Review Comment:
   remove the cast



##########
sched/misc/assert.c:
##########
@@ -347,9 +349,44 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
     }
 }
 
+#else /* CONFIG_SCHED_DUMP_STACK */
+
+/****************************************************************************
+ * Name: dump_stacks
+ ****************************************************************************/
+
+static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
+{
+  UNUSED(sp);
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+#  ifdef CONFIG_SMP
+  int cpu = rtcb->cpu;
+#  else
+  int cpu = this_cpu();
+#  endif
+
+  _alert("IRQ Stack: base: %p size: %u\n",
+         (FAR void *)up_get_intstackbase(cpu),
+         (unsigned)CONFIG_ARCH_INTERRUPTSTACK);
+#endif
+
+#ifdef CONFIG_ARCH_KERNEL_STACK
+  _alert("Kernel Stack: base: %p size: %u\n",
+         rtcb->xcp.kstack,
+         (unsigned)CONFIG_ARCH_KERNEL_STACKSIZE);
+#endif
+
+  _alert("User Stack: base: %p size: %zu\n",
+         rtcb->stack_base_ptr,
+         (size_t)rtcb->adj_stack_size);

Review Comment:
   remove the cast



##########
sched/misc/assert.c:
##########
@@ -347,9 +349,44 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t 
sp)
     }
 }
 
+#else /* CONFIG_SCHED_DUMP_STACK */
+
+/****************************************************************************
+ * Name: dump_stacks
+ ****************************************************************************/
+
+static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp)
+{
+  UNUSED(sp);
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 0
+#  ifdef CONFIG_SMP
+  int cpu = rtcb->cpu;
+#  else
+  int cpu = this_cpu();
+#  endif
+
+  _alert("IRQ Stack: base: %p size: %u\n",

Review Comment:
   why not add `#ifdef CONFIG_SCHED_DUMP_STACK/#endif` in the origin code



##########
sched/misc/assert.c:
##########
@@ -168,6 +168,8 @@ static int assert_tracecallback(FAR struct usbtrace_s 
*trace, FAR void *arg)
 
 #ifdef CONFIG_ARCH_STACKDUMP

Review Comment:
   why do we need both CONFIG_ARCH_STACKDUMP and CONFIG_SCHED_DUMP_STACK?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to