diff options
author | Tony Lindgren <tony@atomide.com> | 2019-05-20 18:32:11 +0300 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2019-05-20 18:32:11 +0300 |
commit | f29f24b5568fd6169e0363c78f1a80db38d0e7e9 (patch) | |
tree | 835abaf6e1bb95b9d388f4249f355618e9da1489 /scripts/gdb/linux/lists.py | |
parent | 1ba12322e2f0934383f111a5e695702aaf46b812 (diff) | |
parent | 34b1b8061de3215208db9accfe60cc3f5b40178f (diff) | |
download | linux-f29f24b5568fd6169e0363c78f1a80db38d0e7e9.tar.xz |
Merge branch 'fixes-dra7' into fixes
Diffstat (limited to 'scripts/gdb/linux/lists.py')
-rw-r--r-- | scripts/gdb/linux/lists.py | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py index 2f335fbd86fd..c487ddf09d38 100644 --- a/scripts/gdb/linux/lists.py +++ b/scripts/gdb/linux/lists.py @@ -16,13 +16,15 @@ import gdb from linux import utils list_head = utils.CachedType("struct list_head") +hlist_head = utils.CachedType("struct hlist_head") +hlist_node = utils.CachedType("struct hlist_node") def list_for_each(head): if head.type == list_head.get_type().pointer(): head = head.dereference() elif head.type != list_head.get_type(): - raise gdb.GdbError("Must be struct list_head not {}" + raise TypeError("Must be struct list_head not {}" .format(head.type)) node = head['next'].dereference() @@ -33,9 +35,24 @@ def list_for_each(head): def list_for_each_entry(head, gdbtype, member): for node in list_for_each(head): - if node.type != list_head.get_type().pointer(): - raise TypeError("Type {} found. Expected struct list_head *." - .format(node.type)) + yield utils.container_of(node, gdbtype, member) + + +def hlist_for_each(head): + if head.type == hlist_head.get_type().pointer(): + head = head.dereference() + elif head.type != hlist_head.get_type(): + raise TypeError("Must be struct hlist_head not {}" + .format(head.type)) + + node = head['first'].dereference() + while node.address: + yield node.address + node = node['next'].dereference() + + +def hlist_for_each_entry(head, gdbtype, member): + for node in hlist_for_each(head): yield utils.container_of(node, gdbtype, member) @@ -110,4 +127,5 @@ class LxListChk(gdb.Command): raise gdb.GdbError("lx-list-check takes one argument") list_check(gdb.parse_and_eval(argv[0])) + LxListChk() |