You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/05 09:24:44 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request, #6367: dump_task: also dump thread param when dump thread name

xiaoxiang781216 opened a new pull request, #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367

   ## Summary
   and make the column order same as ps output
   
   ## Impact
   up_assert output
   
   ## Testing
   
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367#discussion_r889923049


##########
arch/arm/src/common/arm_assert.c:
##########
@@ -172,44 +175,66 @@ static void arm_dump_task(struct tcb_s *tcb, void *arg)
     }
 #endif
 
+#ifndef CONFIG_DISABLE_PTHREAD
+  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+    {
+      FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
+
+      snprintf(args, sizeof(args), "%p ", ptcb->arg);
+    }
+  else
+#endif
+    {
+      FAR char **argv;
+      size_t npos = 0;
+
+      for (argv = tcb->group->tg_info->argv + 1; *argv; argv++)
+        {
+          npos += strlcpy(args + npos, *argv, sizeof(args) - npos);
+          npos += strlcpy(args + npos, " ", sizeof(args) - npos);

Review Comment:
   Done.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko merged pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367#discussion_r890002391


##########
arch/risc-v/src/common/riscv_assert.c:
##########
@@ -172,44 +175,65 @@ static void riscv_dump_task(struct tcb_s *tcb, void *arg)
     }
 #endif
 
+#ifndef CONFIG_DISABLE_PTHREAD
+  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+    {
+      FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
+
+      snprintf(args, sizeof(args), "%p ", ptcb->arg);
+    }
+  else
+#endif
+    {
+      FAR char **argv = tcb->group->tg_info->argv + 1;
+      size_t npos = 0;
+
+      while (*argv != NULL && npos < sizeof(args))
+        {
+          npos += snprintf(args + npos, sizeof(args) - npos, "%s ", *argv++);
+        }
+    }
+
   /* Dump interesting properties of this task */
 
   _alert("  %4d   %4d"
 #ifdef CONFIG_SMP
          "  %4d"
 #endif
+         "   %7lu"
 #ifdef CONFIG_STACK_COLORATION
          "   %7lu"
 #endif
-         "   %7lu"
 #ifdef CONFIG_STACK_COLORATION
          "   %3" PRId32 ".%1" PRId32 "%%%c"
 #endif
 #ifdef CONFIG_SCHED_CPULOAD
          "   %3" PRId32 ".%01" PRId32 "%%"
 #endif
 #if CONFIG_TASK_NAME_SIZE > 0
-         "   %s"
+         "   %s %s\n"

Review Comment:
   Done.



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367#issuecomment-1147281720

   BTW, since tcb->group->tg_info->argv[0] always point to the task name, I plan to create a new patch in the future:
   
   1. Change tcb->name to FAR const char * and point to tcb->group->tg_info->argv[0] in flat and protected build
   2. Keep tcb->name as the char array in kernel build as before, but prohibit to set CONFIG_TASK_NAME_SIZE=0


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367#discussion_r889947466


##########
arch/risc-v/src/common/riscv_assert.c:
##########
@@ -172,44 +175,65 @@ static void riscv_dump_task(struct tcb_s *tcb, void *arg)
     }
 #endif
 
+#ifndef CONFIG_DISABLE_PTHREAD
+  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+    {
+      FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
+
+      snprintf(args, sizeof(args), "%p ", ptcb->arg);
+    }
+  else
+#endif
+    {
+      FAR char **argv = tcb->group->tg_info->argv + 1;
+      size_t npos = 0;
+
+      while (*argv != NULL && npos < sizeof(args))
+        {
+          npos += snprintf(args + npos, sizeof(args) - npos, "%s ", *argv++);
+        }
+    }
+
   /* Dump interesting properties of this task */
 
   _alert("  %4d   %4d"
 #ifdef CONFIG_SMP
          "  %4d"
 #endif
+         "   %7lu"
 #ifdef CONFIG_STACK_COLORATION
          "   %7lu"
 #endif
-         "   %7lu"
 #ifdef CONFIG_STACK_COLORATION
          "   %3" PRId32 ".%1" PRId32 "%%%c"
 #endif
 #ifdef CONFIG_SCHED_CPULOAD
          "   %3" PRId32 ".%01" PRId32 "%%"
 #endif
 #if CONFIG_TASK_NAME_SIZE > 0
-         "   %s"
+         "   %s %s\n"

Review Comment:
   I just looked into procfs that does similar and there we have
   ```
   #if CONFIG_TASK_NAME_SIZE > 0
     name       = tcb->name;
   #else
     name       = "<noname>";
   #endif
   ```
   maybe we can use similar approach here. What do you think?
   Then we can using format string to `"%s%s\n"` and print args with `" %p"`/`" %s"` instead of `"%p "`/`"%s "`



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6367: dump_task: also dump thread param when dump thread name

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6367:
URL: https://github.com/apache/incubator-nuttx/pull/6367#discussion_r889829134


##########
arch/arm/src/common/arm_assert.c:
##########
@@ -172,44 +175,66 @@ static void arm_dump_task(struct tcb_s *tcb, void *arg)
     }
 #endif
 
+#ifndef CONFIG_DISABLE_PTHREAD
+  if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+    {
+      FAR struct pthread_tcb_s *ptcb = (FAR struct pthread_tcb_s *)tcb;
+
+      snprintf(args, sizeof(args), "%p ", ptcb->arg);
+    }
+  else
+#endif
+    {
+      FAR char **argv;
+      size_t npos = 0;
+
+      for (argv = tcb->group->tg_info->argv + 1; *argv; argv++)
+        {
+          npos += strlcpy(args + npos, *argv, sizeof(args) - npos);
+          npos += strlcpy(args + npos, " ", sizeof(args) - npos);

Review Comment:
   why not to use `snprintf` with `"%s "` here as well?



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org