summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/stackchk/check.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-12 09:25:56 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-01-13 08:10:24 +0100
commit7ced9d9bb2fd51cfef2ce33d22e779adfed604c2 (patch)
treee8388a0a3ad4776b6b11777719b391ffe2127064 /cpukit/libmisc/stackchk/check.c
parentscore: Add Thread_queue_Queue::name (diff)
downloadrtems-7ced9d9bb2fd51cfef2ce33d22e779adfed604c2.tar.bz2
score: Add and use _Thread_Get_name()
Update #2858.
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/stackchk/check.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index b054e78eee..afc276165f 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -43,6 +43,7 @@
#include <rtems/printer.h>
#include <rtems/stackchk.h>
#include <rtems/score/percpu.h>
+#include <rtems/score/threadimpl.h>
/*
* This structure is used to fill in and compare the "end of stack"
@@ -238,10 +239,8 @@ static void Stack_check_report_blown_task(
"task name: 0x%08" PRIx32 "\n",
running->Object.name.name_u32
);
- printk(
- "task name string: %s\n",
- rtems_object_get_name(running->Object.id, sizeof(name), name)
- );
+ _Thread_Get_name(running, name, sizeof(name));
+ printk("task name string: %s\n", name);
printk(
"task stack area (%lu Bytes): 0x%08" PRIxPTR " .. 0x%08" PRIxPTR "\n",
(unsigned long) stack->size,
@@ -362,8 +361,9 @@ static bool Stack_check_Dump_threads_usage(
void *high_water_mark;
void *current;
Stack_Control *stack;
- char name[5];
+ char name[ 22 ];
const rtems_printer *printer;
+ uint32_t id;
printer = arg;
@@ -394,37 +394,32 @@ static bool Stack_check_Dump_threads_usage(
else
used = 0;
-
- #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
- if ( the_thread )
- #endif
- {
- rtems_printf(
- printer,
- "0x%08" PRIx32 " %4s",
- the_thread->Object.id,
- rtems_object_get_name( the_thread->Object.id, sizeof(name), name )
- );
- }
- #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
- else {
- rtems_printf( printer, "0x%08x INTR", ~0 );
- }
- #endif
+#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
+ if ( the_thread == NULL ) {
+ id = 0xffffffff;
+ strlcpy( name, "INTR", sizeof( name ) );
+ } else
+#endif
+ {
+ id = the_thread->Object.id;
+ _Thread_Get_name( the_thread, name, sizeof( name ) );
+ }
rtems_printf(
printer,
- " %p - %p %p %8" PRId32 " ",
- stack->area,
- stack->area + stack->size - 1,
- current,
+ "0x%08" PRIx32 " %-21s 0x%08" PRIuPTR " 0x%08" PRIuPTR " 0x%08" PRIuPTR " %6" PRId32 " ",
+ id,
+ name,
+ (uintptr_t) stack->area,
+ (uintptr_t) stack->area + (uintptr_t) stack->size - 1,
+ (uintptr_t) current,
size
);
if (Stack_check_Initialized == 0) {
- rtems_printf( printer, "Unavailable\n" );
+ rtems_printf( printer, "N/A\n" );
} else {
- rtems_printf( printer, "%8" PRId32 "\n", used );
+ rtems_printf( printer, "%6" PRId32 "\n", used );
}
return false;
@@ -453,9 +448,10 @@ void rtems_stack_checker_report_usage_with_plugin(
const rtems_printer* printer
)
{
- rtems_printf( printer, "Stack usage by thread\n");
- rtems_printf( printer,
-" ID NAME LOW HIGH CURRENT AVAILABLE USED\n"
+ rtems_printf(
+ printer,
+ " STACK USAGE BY THREAD\n"
+ "ID NAME LOW HIGH CURRENT AVAIL USED\n"
);
/* iterate over all threads and dump the usage */
@@ -471,8 +467,6 @@ void rtems_stack_checker_report_usage_with_plugin(
RTEMS_DECONST( rtems_printer *, printer )
);
#endif
-
- printer = NULL;
}
void rtems_stack_checker_report_usage( void )