summaryrefslogtreecommitdiff
path: root/scripts/gdb/linux/rbtree.py
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2024-09-30 11:28:07 +0200
committerJerome Brunet <jbrunet@baylibre.com>2024-09-30 11:28:07 +0200
commit3fd6c59042dbba50391e30862beac979491145fe (patch)
tree63d729254efdf6446d4d4a05e7a8a0dd803eedec /scripts/gdb/linux/rbtree.py
parent1d7ec62374bf049349c47f07f0b95a6524bb1b98 (diff)
parent9852d85ec9d492ebef56dc5f229416c925758edc (diff)
Merge tag 'v6.12-rc1' into clk-meson-next
Linux 6.12-rc1
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():