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/sapi/include/rtems/chain.h | 15 +++++++++++++++ cpukit/sapi/include/rtems/rbheap.h | 1 + 2 files changed, 16 insertions(+) (limited to 'cpukit/sapi/include/rtems') diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h index 3d8a860f20..25f02c9ba8 100644 --- a/cpukit/sapi/include/rtems/chain.h +++ b/cpukit/sapi/include/rtems/chain.h @@ -187,6 +187,21 @@ RTEMS_INLINE_ROUTINE void rtems_chain_set_off_chain( _Chain_Set_off_chain( node ); } +/** + * @brief Initializes a chain node. + * + * In debug configurations, the node is set off chain. In all other + * configurations, this function does nothing. + * + * @param[in] the_node The chain node to initialize. + */ +RTEMS_INLINE_ROUTINE void rtems_chain_initialize_node( + rtems_chain_node *node +) +{ + _Chain_Initialize_node( node ); +} + /** * @brief Is the node off chain. * diff --git a/cpukit/sapi/include/rtems/rbheap.h b/cpukit/sapi/include/rtems/rbheap.h index c008721b23..735aa6c8fd 100644 --- a/cpukit/sapi/include/rtems/rbheap.h +++ b/cpukit/sapi/include/rtems/rbheap.h @@ -210,6 +210,7 @@ static inline void rtems_rbheap_add_to_spare_descriptor_chain( rtems_chain_control *chain = rtems_rbheap_get_spare_descriptor_chain(control); + rtems_chain_initialize_node(&chunk->chain_node); rtems_chain_prepend_unprotected(chain, &chunk->chain_node); } -- cgit v1.2.3