diff options
author | Kieran Bingham <kieran.bingham@linaro.org> | 2016-05-23 16:24:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-23 17:04:14 -0700 |
commit | 619ccaf3e94958485fd237000c24e06bce686bd2 (patch) | |
tree | cd6b96e67536750fc550ad4daba2730aea2b65e1 /scripts/gdb | |
parent | a84be61d0e38034634e7cbe076179cc6f1c16d22 (diff) | |
download | op-kernel-dev-619ccaf3e94958485fd237000c24e06bce686bd2.zip op-kernel-dev-619ccaf3e94958485fd237000c24e06bce686bd2.tar.gz |
scripts/gdb: convert modules usage to lists functions
Simplify the module list functions with the new list_for_each_entry
abstractions
Link: http://lkml.kernel.org/r/ad0101c9391088608166fcec26af179868973d86.1462865983.git.jan.kiszka@siemens.com
Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb')
-rw-r--r-- | scripts/gdb/linux/modules.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 38f5d17..62557dd 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -13,7 +13,7 @@ import gdb -from linux import cpus, utils +from linux import cpus, utils, lists module_type = utils.CachedType("struct module") @@ -23,12 +23,9 @@ def module_list(): global module_type module_ptr_type = module_type.get_type().pointer() modules = gdb.parse_and_eval("modules") - entry = modules['next'] - end_of_list = modules.address - while entry != end_of_list: - yield utils.container_of(entry, module_ptr_type, "list") - entry = entry['next'] + for module in lists.list_for_each_entry(modules, module_ptr_type, "list"): + yield module def find_module_by_name(name): @@ -80,17 +77,15 @@ class LxLsmod(gdb.Command): size=str(layout['size']), ref=str(module['refcnt']['counter'] - 1))) - source_list = module['source_list'] t = self._module_use_type.get_type().pointer() - entry = source_list['next'] first = True - while entry != source_list.address: - use = utils.container_of(entry, t, "source_list") + sources = module['source_list'] + for use in lists.list_for_each_entry(sources, t, "source_list"): gdb.write("{separator}{name}".format( separator=" " if first else ",", name=use['source']['name'].string())) first = False - entry = entry['next'] + gdb.write("\n") |