The patch titled Subject: scripts-gdb-add-rb-tree-iterating-utilities-v2 has been added to the -mm tree. Its filename is scripts-gdb-add-rb-tree-iterating-utilities-v2.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/scripts-gdb-add-rb-tree-iterating-utilities-v2.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/scripts-gdb-add-rb-tree-iterating-utilities-v2.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Stephen Boyd <swboyd@xxxxxxxxxxxx> Subject: scripts-gdb-add-rb-tree-iterating-utilities-v2 Link: http://lkml.kernel.org/r/20190329220844.38234-4-swboyd@xxxxxxxxxxxx Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx> Cc: Douglas Anderson <dianders@xxxxxxxxxxxx> Cc: Nikolay Borisov <n.borisov.lkml@xxxxxxxxx> Cc: Kieran Bingham <kbingham@xxxxxxxxxx> Cc: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> Cc: Jackie Liu <liuyun01@xxxxxxxxxx> Cc: Jason Wessel <jason.wessel@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/gdb/linux/rbtree.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) --- a/scripts/gdb/linux/rbtree.py~scripts-gdb-add-rb-tree-iterating-utilities-v2 +++ a/scripts/gdb/linux/rbtree.py @@ -14,8 +14,7 @@ def rb_first(root): if root.type == rb_root_type.get_type(): node = node.address.cast(rb_root_type.get_type().pointer()) elif root.type != rb_root_type.get_type().pointer(): - raise gdb.GdbError("Must be struct rb_root not {}" - .format(root.type)) + raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) node = root['rb_node'] if node is 0: @@ -26,12 +25,12 @@ def rb_first(root): return node + def rb_last(root): if root.type == rb_root_type.get_type(): node = node.address.cast(rb_root_type.get_type().pointer()) elif root.type != rb_root_type.get_type().pointer(): - raise gdb.GdbError("Must be struct rb_root not {}" - .format(root.type)) + raise gdb.GdbError("Must be struct rb_root not {}".format(root.type)) node = root['rb_node'] if node is 0: @@ -42,19 +41,21 @@ def rb_last(root): return node + def rb_parent(node): parent = gdb.Value(node['__rb_parent_color'] & ~3) return parent.cast(rb_node_type.get_type().pointer()) + def rb_empty_node(node): return node['__rb_parent_color'] == node.address + def rb_next(node): if node.type == rb_node_type.get_type(): node = node.address.cast(rb_node_type.get_type().pointer()) elif node.type != rb_node_type.get_type().pointer(): - raise gdb.GdbError("Must be struct rb_node not {}" - .format(node.type)) + raise gdb.GdbError("Must be struct rb_node not {}".format(node.type)) if rb_empty_node(node): return None @@ -72,12 +73,12 @@ def rb_next(node): return parent + def rb_prev(node): if node.type == rb_node_type.get_type(): node = node.address.cast(rb_node_type.get_type().pointer()) elif node.type != rb_node_type.get_type().pointer(): - raise gdb.GdbError("Must be struct rb_node not {}" - .format(node.type)) + raise gdb.GdbError("Must be struct rb_node not {}".format(node.type)) if rb_empty_node(node): return None @@ -112,8 +113,10 @@ If index is omitted, the root node is de return result + LxRbFirst() + class LxRbLast(gdb.Function): """Lookup and return a node from an RBTree. @@ -130,8 +133,10 @@ If index is omitted, the root node is de return result + LxRbLast() + class LxRbNext(gdb.Function): """Lookup and return a node from an RBTree. @@ -148,8 +153,10 @@ If index is omitted, the root node is de return result + LxRbNext() + class LxRbPrev(gdb.Function): """Lookup and return a node from an RBTree. @@ -166,4 +173,5 @@ If index is omitted, the root node is de return result + LxRbPrev() _ Patches currently in -mm which might be from swboyd@xxxxxxxxxxxx are scripts-gdb-find-vmlinux-where-it-was-before.patch scripts-gdb-add-kernel-config-dumping-command.patch scripts-gdb-add-kernel-config-dumping-command-v2.patch scripts-gdb-add-rb-tree-iterating-utilities.patch scripts-gdb-add-rb-tree-iterating-utilities-v2.patch scripts-gdb-add-a-timer-list-command.patch scripts-gdb-add-a-timer-list-command-v2.patch scripts-gdb-silence-pep8-checks.patch