static void stkmon_task(FAR struct tcb_s *tcb, FAR void *arg)
{
#if CONFIG_TASK_NAME_SIZE > 0
  syslog(LOG_INFO, "%5d %6d %6d %s\n",
         tcb->pid, tcb->adj_stack_size, up_check_tcbstack(tcb), tcb->name);
#else
  syslog(LOG_INFO, "%5d %6d %6d\n",
         tcb->pid, tcb->adj_stack_size, up_check_tcbstack(tcb));
#endif
}
Esempio n. 2
0
static void _stkmon_disp(FAR struct tcb_s *tcb, FAR void *arg)
{
#if CONFIG_TASK_NAME_SIZE > 0
  strncpy(buff,tcb->name,CONFIG_TASK_NAME_SIZE);
  buff[CONFIG_TASK_NAME_SIZE] = '\0';
  syslog(LOG_INFO, "%5d %6d %6d %s\n",
         tcb->pid, tcb->adj_stack_size, up_check_tcbstack(tcb), buff);
#else
  syslog(LOG_INFO, "%5d %6d %6d\n",
         tcb->pid, tcb->adj_stack_size, up_check_tcbstack(tcb));
#endif
}
Esempio n. 3
0
/****************************************************************************
 * write_stack_detail
 ****************************************************************************/
static int write_stack_detail(bool inValid, _stack_s *si, char *sp_name,
			      char *buffer, int max, int fd)
{

	int n = 0;
	uint32_t sbot = si->top - si->size;
	n =   snprintf(&buffer[n], max - n, " %s stack: \n", sp_name);
	n +=  snprintf(&buffer[n], max - n, "  top:    0x%08x\n", si->top);
	n +=  snprintf(&buffer[n], max - n, "  sp:     0x%08x %s\n", si->sp, (inValid ? "Invalid" : "Valid"));

	if (n != write(fd, buffer, n)) {
		return -EIO;
	}

	n = 0;
	n +=  snprintf(&buffer[n], max - n, "  bottom: 0x%08x\n", sbot);
	n +=  snprintf(&buffer[n], max - n, "  size:   0x%08x\n",  si->size);

	if (n != write(fd, buffer, n)) {
		return -EIO;
	}

#ifdef CONFIG_STACK_COLORATION
	FAR struct tcb_s tcb;
	tcb.stack_alloc_ptr = (void *) sbot;
	tcb.adj_stack_size = si->size;
	n = snprintf(buffer, max,         "  used:   %08x\n", up_check_tcbstack(&tcb));

	if (n != write(fd, buffer, n)) {
		return -EIO;
	}

#endif
	return OK;
}
Esempio n. 4
0
static ssize_t proc_stack(FAR struct proc_file_s *procfile,
                          FAR struct tcb_s *tcb, FAR char *buffer,
                          size_t buflen, off_t offset)
{
  size_t remaining;
  size_t linesize;
  size_t copysize;
  size_t totalsize;

  remaining = buflen;
  totalsize = 0;

  /* Show the stack base address */

  linesize   = snprintf(procfile->line, STATUS_LINELEN, "%-12s0x%p\n",
                        "StackBase:", tcb->adj_stack_ptr);
  copysize   = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);

  totalsize += copysize;
  buffer    += copysize;
  remaining -= copysize;

  if (totalsize >= buflen)
    {
      return totalsize;
    }

  /* Show the stack size */

  linesize   = snprintf(procfile->line, STATUS_LINELEN, "%-12s%ld\n",
                        "StackSize:", (long)tcb->adj_stack_size);
  copysize   = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);

  totalsize += copysize;
  buffer    += copysize;
  remaining -= copysize;

#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_STACK)
  if (totalsize >= buflen)
    {
      return totalsize;
    }

  /* Show the stack size */

  linesize   = snprintf(procfile->line, STATUS_LINELEN, "%-12s%ld\n",
                        "StackUsed:", (long)up_check_tcbstack(tcb));
  copysize   = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);

  totalsize += copysize;
  buffer    += copysize;
  remaining -= copysize;
#endif

  return totalsize;
}
Esempio n. 5
0
size_t up_check_stack(void)
{
  return up_check_tcbstack((FAR struct tcb_s*)g_readytorun.head);
}
Esempio n. 6
0
ssize_t up_check_tcbstack_remain(FAR struct tcb_s *tcb)
{
  return (ssize_t)tcb->adj_stack_size - (ssize_t)up_check_tcbstack(tcb);
}
Esempio n. 7
0
size_t up_check_stack(void)
{
  return up_check_tcbstack(this_task());
}