From 059529e685e059d366ee56aa6117ee0d4e899e66 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Jul 2016 10:15:02 +0200 Subject: score: Add debug support to chains This helps to detect * double insert, append, prepend errors, and * get from empty chain errors. --- cpukit/libcsupport/src/malloc_deferred.c | 6 +++++- cpukit/libcsupport/src/mount-mgr.c | 1 + cpukit/libcsupport/src/printertask.c | 1 + cpukit/libcsupport/src/sup_fs_location.c | 1 + cpukit/libcsupport/src/termios.c | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) (limited to 'cpukit/libcsupport/src') diff --git a/cpukit/libcsupport/src/malloc_deferred.c b/cpukit/libcsupport/src/malloc_deferred.c index 962ae3e81f..f37b852cba 100644 --- a/cpukit/libcsupport/src/malloc_deferred.c +++ b/cpukit/libcsupport/src/malloc_deferred.c @@ -127,9 +127,13 @@ void *rtems_heap_allocate_aligned_with_boundary( void _Malloc_Deferred_free( void *p ) { rtems_interrupt_lock_context lock_context; + rtems_chain_node *node; + + node = (rtems_chain_node *) p; rtems_interrupt_lock_acquire( &_Malloc_GC_lock, &lock_context ); - rtems_chain_append_unprotected( &_Malloc_GC_list, (rtems_chain_node *) p ); + rtems_chain_initialize_node( node ); + rtems_chain_append_unprotected( &_Malloc_GC_list, node ); rtems_interrupt_lock_release( &_Malloc_GC_lock, &lock_context ); } #endif diff --git a/cpukit/libcsupport/src/mount-mgr.c b/cpukit/libcsupport/src/mount-mgr.c index 20c900fe8d..02468208ad 100644 --- a/cpukit/libcsupport/src/mount-mgr.c +++ b/cpukit/libcsupport/src/mount-mgr.c @@ -124,6 +124,7 @@ rtems_filesystem_register( rtems_libio_lock(); if ( rtems_filesystem_get_mount_handler( type ) == NULL ) { + rtems_chain_initialize_node( &fsn->node ); rtems_chain_append_unprotected( chain, &fsn->node ); } else { rtems_libio_unlock(); diff --git a/cpukit/libcsupport/src/printertask.c b/cpukit/libcsupport/src/printertask.c index f358f32bb1..bae623bff3 100644 --- a/cpukit/libcsupport/src/printertask.c +++ b/cpukit/libcsupport/src/printertask.c @@ -194,6 +194,7 @@ void rtems_printer_task_drain( rtems_printer_task_context *ctx ) { printer_task_buffer buffer; + rtems_chain_initialize_node( &buffer.node ); buffer.action_kind = ACTION_DRAIN; buffer.action_data.task = rtems_task_self(); diff --git a/cpukit/libcsupport/src/sup_fs_location.c b/cpukit/libcsupport/src/sup_fs_location.c index ddda4d15eb..2b8126ee8b 100644 --- a/cpukit/libcsupport/src/sup_fs_location.c +++ b/cpukit/libcsupport/src/sup_fs_location.c @@ -48,6 +48,7 @@ rtems_filesystem_location_info_t *rtems_filesystem_location_copy( dst->node_access_2 = src->node_access_2; dst->handlers = src->handlers; dst->mt_entry = src->mt_entry; + rtems_chain_initialize_node(&dst->mt_entry_node); rtems_filesystem_location_add_to_mt_entry(dst); return dst; diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c index d12f9c48d5..d9886f4c01 100644 --- a/cpukit/libcsupport/src/termios.c +++ b/cpukit/libcsupport/src/termios.c @@ -149,6 +149,7 @@ rtems_status_code rtems_termios_device_install( return RTEMS_NO_MEMORY; } + rtems_chain_initialize_node(&new_device_node->node); new_device_node->major = major; new_device_node->minor = minor; new_device_node->handler = handler; -- cgit v1.2.3