This can be very useful for trying to debug list corruptions.

Signed-off-by: Jason Ekstrand <[email protected]>
Cc: Ian Romanick <[email protected]>
---
 src/glsl/list.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/glsl/list.h b/src/glsl/list.h
index aac13fd..1d18ec9 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -521,6 +521,20 @@ exec_node_insert_list_before(struct exec_node *n, struct 
exec_list *before)
    exec_list_make_empty(before);
 }
 
+static inline void
+exec_list_validate(struct exec_list *list)
+{
+   assert(list->head->prev == (struct exec_node *) &list->head);
+   assert(list->tail == NULL);
+   assert(list->tail_pred->next == (struct exec_node *) &list->tail);
+
+   for (struct exec_node *node = list->head;
+        node->next != NULL; node = node->next) {
+      assert(node->next->prev == node);
+      assert(node->prev->next == node);
+   }
+}
+
 #ifdef __cplusplus
 inline void exec_list::make_empty()
 {
-- 
2.1.0

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to