diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-23 18:18:42 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-06-23 18:18:42 +0000 |
commit | 2d637b20f66165495ff66994ae8f8161b5228532 (patch) | |
tree | d1f4096889bc1bbdf343b345f5d9dc63aa67ef0a /cpukit/libmisc/stackchk | |
parent | Typo. (diff) | |
download | rtems-2d637b20f66165495ff66994ae8f8161b5228532.tar.bz2 |
2010-06-23 Joel Sherrill <joel.sherrilL@OARcorp.com>
* libmisc/stackchk/check.c: Clean up to improve coverage.
Diffstat (limited to 'cpukit/libmisc/stackchk')
-rw-r--r-- | cpukit/libmisc/stackchk/check.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c index 711bf41d09..f81a47a727 100644 --- a/cpukit/libmisc/stackchk/check.c +++ b/cpukit/libmisc/stackchk/check.c @@ -116,12 +116,13 @@ static inline bool Stack_check_Frame_pointer_in_range( #define Stack_check_usable_stack_size(_the_stack) \ ((_the_stack)->size - sizeof(Stack_check_Control)) -/* - * Do we have an interrupt stack? - * XXX it would sure be nice if the interrupt stack were also - * stored in a "stack" structure! - */ -Stack_Control Stack_check_Interrupt_stack; +#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) + /* + * Did RTEMS allocate the interrupt stack? If so, put it in + * Stack_Control format. + */ + Stack_Control Stack_check_Interrupt_stack; +#endif /* * Fill an entire stack area with BYTE_PATTERN. This will be used @@ -381,28 +382,28 @@ void Stack_check_Dump_threads_usage( Stack_Control *stack; char name[5]; - if ( !the_thread ) - return; - - if ( !print_handler ) - return; + /* + * The pointer passed in for the_thread is guaranteed to be non-NULL from + * rtems_iterate_over_all_threads() so no need to check it here. + */ /* * Obtain interrupt stack information */ - - if (the_thread == (Thread_Control *) -1) { - if (Stack_check_Interrupt_stack.area) { + #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) + if (the_thread == (Thread_Control *) -1) { + if (!Stack_check_Interrupt_stack.area) + return; stack = &Stack_check_Interrupt_stack; the_thread = 0; current = 0; + } else + #else + { + stack = &the_thread->Start.Initial_stack; + current = (void *)_CPU_Context_Get_SP( &the_thread->Registers ); } - else - return; - } else { - stack = &the_thread->Start.Initial_stack; - current = (void *)_CPU_Context_Get_SP( &the_thread->Registers ); - } + #endif low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); @@ -468,6 +469,9 @@ void rtems_stack_checker_report_usage_with_plugin( rtems_printk_plugin_t print ) { + if ( !print ) + return; + print_context = context; print_handler = print; @@ -479,8 +483,10 @@ void rtems_stack_checker_report_usage_with_plugin( /* iterate over all threads and dump the usage */ rtems_iterate_over_all_threads( Stack_check_Dump_threads_usage ); - /* dump interrupt stack info if any */ - Stack_check_Dump_threads_usage((Thread_Control *) -1); + #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE) + /* dump interrupt stack info if any */ + Stack_check_Dump_threads_usage((Thread_Control *) -1); + #endif print_context = NULL; print_handler = NULL; |