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/12/22 09:23:05 UTC
[GitHub] [nuttx] pussuw commented on a diff in pull request #7952: sched/assert: Fix printing argv when address environments are in use
pussuw commented on code in PR #7952:
URL: https://github.com/apache/nuttx/pull/7952#discussion_r1055253442
##########
sched/misc/assert.c:
##########
@@ -209,11 +209,78 @@ static void showstacks(void)
#endif
+/****************************************************************************
+ * Name: get_argv_str
+ *
+ * Description:
+ * Safely read the contents of a task's argument vector, into a a safe
+ * buffer.
+ *
+ ****************************************************************************/
+
+static void get_argv_str(FAR struct tcb_s *tcb, FAR char *args, size_t size)
+{
+ /* Perform sanity checks */
+
+ if (!tcb || !tcb->group || !tcb->group->tg_info)
+ {
+ /* Something is very wrong -> get out */
+
+ *args = '\0';
+ return;
+ }
+
+#ifdef CONFIG_ARCH_ADDRENV
+ save_addrenv_t oldenv;
+ bool saved = false;
+
+ if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
+ {
+ if ((tcb->group->tg_flags & GROUP_FLAG_ADDRENV) == 0)
+ {
+ /* Process should have address environment, but doesn't */
+
+ *args = '\0';
+ return;
+ }
+
+ up_addrenv_select(&tcb->group->tg_addrenv, &oldenv);
+ saved = true;
+ }
+#endif
+
+#ifndef CONFIG_DISABLE_PTHREAD
+ if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_PTHREAD)
+ {
+ struct pthread_tcb_s *ptcb = (struct pthread_tcb_s *)tcb;
Review Comment:
Thanks, I fixed a couple of missing FAR qualifiers but missed these (this code is copy&paste).
--
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