[Mesa-dev] [PATCH] glsl/list: Add an exec_list_validate function
Jason Ekstrand
jason at jlekstrand.net
Wed Nov 5 14:00:37 PST 2014
This can be very useful for trying to debug list corruptions.
Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
Cc: Ian Romanick <idr at freedesktop.org>
---
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
More information about the mesa-dev
mailing list