summaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/rbtree.py
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2024-10-01 18:09:41 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2024-10-01 18:09:41 +0200
commit2cd86f02c017bf9733e5cd891381b7d40f6f37ad (patch)
tree839e63bdf31a2d1ec68fa8d6fb8dc821f8fcf243 /scripts/gdb/linux/rbtree.py
parentabf201f6ce14c4ceeccde5471bdf59614b83a3d8 (diff)
parent43102a2012c2e2f8424d7eef52aede8e73cf2fed (diff)
Merge remote-tracking branch 'drm/drm-fixes' into drm-misc-fixes
Required for a panthor fix that broke when FOP_UNSIGNED_OFFSET was added in place of FMODE_UNSIGNED_OFFSET. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'scripts/gdb/linux/rbtree.py')
-rw-r--r--scripts/gdb/linux/rbtree.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/gdb/linux/rbtree.py b/scripts/gdb/linux/rbtree.py
index fe462855eefd..fcbcc5f4153c 100644
--- a/scripts/gdb/linux/rbtree.py
+++ b/scripts/gdb/linux/rbtree.py
@@ -9,6 +9,18 @@ from linux import utils
rb_root_type = utils.CachedType("struct rb_root")
rb_node_type = utils.CachedType("struct rb_node")
+def rb_inorder_for_each(root):
+ def inorder(node):
+ if node:
+ yield from inorder(node['rb_left'])
+ yield node
+ yield from inorder(node['rb_right'])
+
+ yield from inorder(root['rb_node'])
+
+def rb_inorder_for_each_entry(root, gdbtype, member):
+ for node in rb_inorder_for_each(root):
+ yield utils.container_of(node, gdbtype, member)
def rb_first(root):
if root.type == rb_root_type.get_type():