score: Add debug support to chains

This helps to detect

 * double insert, append, prepend errors, and
 * get from empty chain errors.
This commit is contained in:
Sebastian Huber
2016-07-22 09:13:07 +02:00
parent 3cdda03c5a
commit 059529e685
17 changed files with 116 additions and 11 deletions
+15
View File
@@ -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.
*
+1
View File
@@ -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);
}
+1
View File
@@ -76,6 +76,7 @@ static void add_to_chain(
rtems_rbheap_chunk *chunk
)
{
rtems_chain_initialize_node(&chunk->chain_node);
rtems_chain_prepend_unprotected(chain, &chunk->chain_node);
}