mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
arm/cortex-a/r: enhance the task dump
add irq stack information add cpu loading Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
committed by
Gustavo Henrique Nihei
parent
4f0dd95fe1
commit
a0b61bbf6f
@@ -125,6 +125,167 @@ static inline void arm_registerdump(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_dump_task
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static void arm_dump_task(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
uint32_t stack_used;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
struct cpuload_s cpuload;
|
||||||
|
uint32_t fracpart;
|
||||||
|
uint32_t intpart;
|
||||||
|
uint32_t tmp;
|
||||||
|
|
||||||
|
clock_cpuload(tcb->pid, &cpuload);
|
||||||
|
|
||||||
|
if (cpuload.total > 0)
|
||||||
|
{
|
||||||
|
tmp = (1000 * cpuload.active) / cpuload.total;
|
||||||
|
intpart = tmp / 10;
|
||||||
|
fracpart = tmp - 10 * intpart;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intpart = 0;
|
||||||
|
fracpart = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
stack_used = up_check_tcbstack(tcb);
|
||||||
|
if (tcb->adj_stack_size > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 * stack_used / tcb->adj_stack_size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Dump interesting properties of this task */
|
||||||
|
|
||||||
|
_alert(" %4d %4d"
|
||||||
|
#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"
|
||||||
|
#endif
|
||||||
|
"\n",
|
||||||
|
tcb->pid, tcb->sched_priority,
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
(unsigned long)up_check_tcbstack(tcb),
|
||||||
|
#endif
|
||||||
|
(unsigned long)tcb->adj_stack_size
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
, intpart, fracpart
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
, tcb->name
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_dump_backtrace
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
static void arm_dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
|
{
|
||||||
|
/* Show back trace */
|
||||||
|
|
||||||
|
sched_dumpstack(tcb->pid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_showtasks
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static inline void arm_showtasks(void)
|
||||||
|
{
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_used = up_check_intstack();
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
|
||||||
|
if ((CONFIG_ARCH_INTERRUPTSTACK & ~7) > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 *
|
||||||
|
stack_used / (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Dump interesting properties of each task in the crash environment */
|
||||||
|
|
||||||
|
_alert(" PID PRI"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" USED"
|
||||||
|
#endif
|
||||||
|
" STACK"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" FILLED "
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" CPU"
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" COMMAND"
|
||||||
|
#endif
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
_alert(" ---- ----"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %7lu"
|
||||||
|
# endif
|
||||||
|
" %7lu"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %3" PRId32 ".%1" PRId32 "%%%c"
|
||||||
|
# endif
|
||||||
|
# ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" ----"
|
||||||
|
# endif
|
||||||
|
# if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" irq"
|
||||||
|
# endif
|
||||||
|
"\n"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, (unsigned long)stack_used
|
||||||
|
# endif
|
||||||
|
, (unsigned long)(CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
|
# endif
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nxsched_foreach(arm_dump_task, NULL);
|
||||||
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
nxsched_foreach(arm_dump_backtrace, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: assert_tracecallback
|
* Name: assert_tracecallback
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -250,6 +411,10 @@ static void up_dumpstate(void)
|
|||||||
arm_stackdump(ustackbase, ustackbase + ustacksize);
|
arm_stackdump(ustackbase, ustackbase + ustacksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dump the state of all tasks (if available) */
|
||||||
|
|
||||||
|
arm_showtasks();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_USBDUMP
|
#ifdef CONFIG_ARCH_USBDUMP
|
||||||
/* Dump USB trace data */
|
/* Dump USB trace data */
|
||||||
|
|
||||||
|
|||||||
@@ -129,57 +129,165 @@ static inline void arm_registerdump(FAR volatile uint32_t *regs)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_taskdump
|
* Name: arm_dump_task
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE)
|
static void arm_dump_task(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
uint32_t stack_used;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
struct cpuload_s cpuload;
|
||||||
|
uint32_t fracpart;
|
||||||
|
uint32_t intpart;
|
||||||
|
uint32_t tmp;
|
||||||
|
|
||||||
|
clock_cpuload(tcb->pid, &cpuload);
|
||||||
|
|
||||||
|
if (cpuload.total > 0)
|
||||||
|
{
|
||||||
|
tmp = (1000 * cpuload.active) / cpuload.total;
|
||||||
|
intpart = tmp / 10;
|
||||||
|
fracpart = tmp - 10 * intpart;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intpart = 0;
|
||||||
|
fracpart = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
stack_used = up_check_tcbstack(tcb);
|
||||||
|
if (tcb->adj_stack_size > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 * stack_used / tcb->adj_stack_size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump interesting properties of this task */
|
/* Dump interesting properties of this task */
|
||||||
|
|
||||||
_alert(
|
_alert(" %4d %4d"
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0
|
|
||||||
"%s: "
|
|
||||||
#endif
|
|
||||||
"PID=%d "
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
"Stack Used=%lu of %lu\n",
|
" %7lu"
|
||||||
#else
|
#endif
|
||||||
"Stack=%lu\n",
|
" %7lu"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %3" PRId32 ".%1" PRId32 "%%%c"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" %3" PRId32 ".%01" PRId32 "%%"
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
tcb->name,
|
" %s"
|
||||||
#endif
|
#endif
|
||||||
tcb->pid,
|
"\n",
|
||||||
|
tcb->pid, tcb->sched_priority,
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
(unsigned long)up_check_tcbstack(tcb),
|
(unsigned long)up_check_tcbstack(tcb),
|
||||||
#endif
|
#endif
|
||||||
(unsigned long)tcb->adj_stack_size);
|
(unsigned long)tcb->adj_stack_size
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
/* Show back trace */
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
#ifdef CONFIG_SCHED_BACKTRACE
|
|
||||||
sched_dumpstack(tcb->pid);
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
/* Dump the registers */
|
, intpart, fracpart
|
||||||
|
#endif
|
||||||
arm_registerdump(tcb->xcp.regs);
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
, tcb->name
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_showtasks
|
* Name: arm_dump_backtrace
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void up_showtasks(void)
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
static void arm_dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
{
|
{
|
||||||
|
/* Show back trace */
|
||||||
|
|
||||||
|
sched_dumpstack(tcb->pid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_showtasks
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static inline void arm_showtasks(void)
|
||||||
|
{
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_used = up_check_intstack();
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
|
||||||
|
if ((CONFIG_ARCH_INTERRUPTSTACK & ~7) > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 *
|
||||||
|
stack_used / (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump interesting properties of each task in the crash environment */
|
/* Dump interesting properties of each task in the crash environment */
|
||||||
|
|
||||||
nxsched_foreach(up_taskdump, NULL);
|
_alert(" PID PRI"
|
||||||
}
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
#else
|
" USED"
|
||||||
# define up_showtasks()
|
|
||||||
#endif
|
#endif
|
||||||
|
" STACK"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" FILLED "
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" CPU"
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" COMMAND"
|
||||||
|
#endif
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
_alert(" ---- ----"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %7lu"
|
||||||
|
# endif
|
||||||
|
" %7lu"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %3" PRId32 ".%1" PRId32 "%%%c"
|
||||||
|
# endif
|
||||||
|
# ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" ----"
|
||||||
|
# endif
|
||||||
|
# if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" irq"
|
||||||
|
# endif
|
||||||
|
"\n"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, (unsigned long)stack_used
|
||||||
|
# endif
|
||||||
|
, (unsigned long)(CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
|
# endif
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nxsched_foreach(arm_dump_task, NULL);
|
||||||
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
nxsched_foreach(arm_dump_backtrace, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: assert_tracecallback
|
* Name: assert_tracecallback
|
||||||
@@ -256,9 +364,6 @@ static void up_dumpstate(void)
|
|||||||
_alert("Interrupt stack:\n");
|
_alert("Interrupt stack:\n");
|
||||||
_alert(" base: %08x\n", istackbase);
|
_alert(" base: %08x\n", istackbase);
|
||||||
_alert(" size: %08x\n", istacksize);
|
_alert(" size: %08x\n", istacksize);
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
|
||||||
_alert(" used: %08x\n", up_check_intstack());
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Show user stack info */
|
/* Show user stack info */
|
||||||
@@ -266,9 +371,6 @@ static void up_dumpstate(void)
|
|||||||
_alert("User stack:\n");
|
_alert("User stack:\n");
|
||||||
_alert(" base: %08x\n", ustackbase);
|
_alert(" base: %08x\n", ustackbase);
|
||||||
_alert(" size: %08x\n", ustacksize);
|
_alert(" size: %08x\n", ustacksize);
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
|
||||||
_alert(" used: %08x\n", up_check_tcbstack(rtcb));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_KERNEL_STACK
|
#ifdef CONFIG_ARCH_KERNEL_STACK
|
||||||
/* Does this thread have a kernel stack allocated? */
|
/* Does this thread have a kernel stack allocated? */
|
||||||
@@ -350,7 +452,7 @@ static void up_dumpstate(void)
|
|||||||
|
|
||||||
/* Dump the state of all tasks (if available) */
|
/* Dump the state of all tasks (if available) */
|
||||||
|
|
||||||
up_showtasks();
|
arm_showtasks();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_USBDUMP
|
#ifdef CONFIG_ARCH_USBDUMP
|
||||||
/* Dump USB trace data */
|
/* Dump USB trace data */
|
||||||
|
|||||||
@@ -126,57 +126,165 @@ static inline void arm_registerdump(FAR volatile uint32_t *regs)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_taskdump
|
* Name: arm_dump_task
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_STACK_COLORATION) || defined(CONFIG_SCHED_BACKTRACE)
|
static void arm_dump_task(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
static void up_taskdump(FAR struct tcb_s *tcb, FAR void *arg)
|
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
uint32_t stack_used;
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
struct cpuload_s cpuload;
|
||||||
|
uint32_t fracpart;
|
||||||
|
uint32_t intpart;
|
||||||
|
uint32_t tmp;
|
||||||
|
|
||||||
|
clock_cpuload(tcb->pid, &cpuload);
|
||||||
|
|
||||||
|
if (cpuload.total > 0)
|
||||||
|
{
|
||||||
|
tmp = (1000 * cpuload.active) / cpuload.total;
|
||||||
|
intpart = tmp / 10;
|
||||||
|
fracpart = tmp - 10 * intpart;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intpart = 0;
|
||||||
|
fracpart = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
stack_used = up_check_tcbstack(tcb);
|
||||||
|
if (tcb->adj_stack_size > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 * stack_used / tcb->adj_stack_size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump interesting properties of this task */
|
/* Dump interesting properties of this task */
|
||||||
|
|
||||||
_alert(
|
_alert(" %4d %4d"
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0
|
|
||||||
"%s: "
|
|
||||||
#endif
|
|
||||||
"PID=%d "
|
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
"Stack Used=%lu of %lu\n",
|
" %7lu"
|
||||||
#else
|
#endif
|
||||||
"Stack=%lu\n",
|
" %7lu"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %3" PRId32 ".%1" PRId32 "%%%c"
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" %3" PRId32 ".%01" PRId32 "%%"
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
tcb->name,
|
" %s"
|
||||||
#endif
|
#endif
|
||||||
tcb->pid,
|
"\n",
|
||||||
|
tcb->pid, tcb->sched_priority,
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
(unsigned long)up_check_tcbstack(tcb),
|
(unsigned long)up_check_tcbstack(tcb),
|
||||||
#endif
|
#endif
|
||||||
(unsigned long)tcb->adj_stack_size);
|
(unsigned long)tcb->adj_stack_size
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
/* Show back trace */
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
#ifdef CONFIG_SCHED_BACKTRACE
|
|
||||||
sched_dumpstack(tcb->pid);
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
/* Dump the registers */
|
, intpart, fracpart
|
||||||
|
#endif
|
||||||
arm_registerdump(tcb->xcp.regs);
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
, tcb->name
|
||||||
|
#endif
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_showtasks
|
* Name: arm_dump_backtrace
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static inline void up_showtasks(void)
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
static void arm_dump_backtrace(FAR struct tcb_s *tcb, FAR void *arg)
|
||||||
{
|
{
|
||||||
|
/* Show back trace */
|
||||||
|
|
||||||
|
sched_dumpstack(tcb->pid);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_showtasks
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static inline void arm_showtasks(void)
|
||||||
|
{
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
uint32_t stack_used = up_check_intstack();
|
||||||
|
uint32_t stack_filled = 0;
|
||||||
|
|
||||||
|
if ((CONFIG_ARCH_INTERRUPTSTACK & ~7) > 0 && stack_used > 0)
|
||||||
|
{
|
||||||
|
/* Use fixed-point math with one decimal place */
|
||||||
|
|
||||||
|
stack_filled = 10 * 100 *
|
||||||
|
stack_used / (CONFIG_ARCH_INTERRUPTSTACK & ~7);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Dump interesting properties of each task in the crash environment */
|
/* Dump interesting properties of each task in the crash environment */
|
||||||
|
|
||||||
nxsched_foreach(up_taskdump, NULL);
|
_alert(" PID PRI"
|
||||||
}
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
#else
|
" USED"
|
||||||
# define up_showtasks()
|
|
||||||
#endif
|
#endif
|
||||||
|
" STACK"
|
||||||
|
#ifdef CONFIG_STACK_COLORATION
|
||||||
|
" FILLED "
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" CPU"
|
||||||
|
#endif
|
||||||
|
#if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" COMMAND"
|
||||||
|
#endif
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
#if CONFIG_ARCH_INTERRUPTSTACK > 7
|
||||||
|
_alert(" ---- ----"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %7lu"
|
||||||
|
# endif
|
||||||
|
" %7lu"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
" %3" PRId32 ".%1" PRId32 "%%%c"
|
||||||
|
# endif
|
||||||
|
# ifdef CONFIG_SCHED_CPULOAD
|
||||||
|
" ----"
|
||||||
|
# endif
|
||||||
|
# if CONFIG_TASK_NAME_SIZE > 0
|
||||||
|
" irq"
|
||||||
|
# endif
|
||||||
|
"\n"
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, (unsigned long)stack_used
|
||||||
|
# endif
|
||||||
|
, (unsigned long)(CONFIG_ARCH_INTERRUPTSTACK & ~7)
|
||||||
|
# ifdef CONFIG_STACK_COLORATION
|
||||||
|
, stack_filled / 10, stack_filled % 10,
|
||||||
|
(stack_filled >= 10 * 80 ? '!' : ' ')
|
||||||
|
# endif
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
nxsched_foreach(arm_dump_task, NULL);
|
||||||
|
#ifdef CONFIG_SCHED_BACKTRACE
|
||||||
|
nxsched_foreach(arm_dump_backtrace, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: assert_tracecallback
|
* Name: assert_tracecallback
|
||||||
@@ -249,9 +357,6 @@ static void up_dumpstate(void)
|
|||||||
_alert("Interrupt stack:\n");
|
_alert("Interrupt stack:\n");
|
||||||
_alert(" base: %08x\n", istackbase);
|
_alert(" base: %08x\n", istackbase);
|
||||||
_alert(" size: %08x\n", istacksize);
|
_alert(" size: %08x\n", istacksize);
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
|
||||||
_alert(" used: %08x\n", up_check_intstack());
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Show user stack info */
|
/* Show user stack info */
|
||||||
@@ -259,9 +364,6 @@ static void up_dumpstate(void)
|
|||||||
_alert("User stack:\n");
|
_alert("User stack:\n");
|
||||||
_alert(" base: %08x\n", ustackbase);
|
_alert(" base: %08x\n", ustackbase);
|
||||||
_alert(" size: %08x\n", ustacksize);
|
_alert(" size: %08x\n", ustacksize);
|
||||||
#ifdef CONFIG_STACK_COLORATION
|
|
||||||
_alert(" used: %08x\n", up_check_tcbstack(rtcb));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_KERNEL_STACK
|
#ifdef CONFIG_ARCH_KERNEL_STACK
|
||||||
/* Does this thread have a kernel stack allocated? */
|
/* Does this thread have a kernel stack allocated? */
|
||||||
@@ -337,7 +439,7 @@ static void up_dumpstate(void)
|
|||||||
|
|
||||||
/* Dump the state of all tasks (if available) */
|
/* Dump the state of all tasks (if available) */
|
||||||
|
|
||||||
up_showtasks();
|
arm_showtasks();
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_USBDUMP
|
#ifdef CONFIG_ARCH_USBDUMP
|
||||||
/* Dump USB trace data */
|
/* Dump USB trace data */
|
||||||
|
|||||||
Reference in New Issue
Block a user