summaryrefslogtreecommitdiffstats
path: root/cpukit/score/inline
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-11 20:56:10 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-07-11 20:56:10 +0000
commit55d7626db75b1b5323aa5ba16b3cbc0a985462fe (patch)
treec4268b9ad2466b12170205743fd97d425da18e8a /cpukit/score/inline
parent2007-07-11 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-55d7626db75b1b5323aa5ba16b3cbc0a985462fe.tar.bz2
2007-07-11 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/malloc.c: Clean up Malloc debug code. * score/include/rtems/score/heap.h: Spacing. * score/inline/rtems/score/thread.inl: * score/src/heapfree.c. Clean up and add explicit check of the address being freed actually being in the heap. * score/src/heapwalk.c: Switch to printk and do not call abort.
Diffstat (limited to 'cpukit/score/inline')
-rw-r--r--cpukit/score/inline/rtems/score/thread.inl39
1 files changed, 38 insertions, 1 deletions
diff --git a/cpukit/score/inline/rtems/score/thread.inl b/cpukit/score/inline/rtems/score/thread.inl
index 44d626d71c..dbd95c6ca3 100644
--- a/cpukit/score/inline/rtems/score/thread.inl
+++ b/cpukit/score/inline/rtems/score/thread.inl
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -139,10 +139,47 @@ RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
* This routine prevents dispatching.
*/
+#if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG)
+ #include <rtems/bspIo.h>
+ #include <rtems/fatal.h>
+ #include <rtems/score/sysstate.h>
+ #include <rtems/score/heap.h>
+#endif
+
RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
{
+ extern boolean rtems_stack_checker_is_blown( void );
+ extern void malloc_walk(size_t, size_t);
+
+ /*
+ * This check is very brutal to system performance but is very helpful
+ * at finding blown stack problems. If you have a stack problem and
+ * need help finding it, then uncomment this code. Every system
+ * call will check the stack and since mutexes are used frequently
+ * in most systems, you might get lucky.
+ */
+ #if defined(RTEMS_HEAVY_STACK_DEBUG)
+ if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) {
+ if ( rtems_stack_checker_is_blown() ) {
+ printk( "Stack blown!!\n" );
+ rtems_fatal_error_occurred( 99 );
+ }
+ }
+ #endif
+
_Thread_Dispatch_disable_level += 1;
RTEMS_COMPILER_MEMORY_BARRIER();
+
+ /*
+ * This check is even more brutal than the other one. This enables
+ * malloc heap integrity checking upon entry to every system call.
+ */
+ #if defined(RTEMS_HEAVY_MALLOC_DEBUG)
+ if ( _Thread_Dispatch_disable_level == 1 ) {
+ extern Heap_Control RTEMS_Malloc_Heap;
+ _Heap_Walk( &RTEMS_Malloc_Heap,99, FALSE );
+ }
+ #endif
}
/**