diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-06-08 14:02:16 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-06-08 14:02:16 +0300 |
commit | 8e8c668927b029f6ccc350eb1aa936864cc4eb6f (patch) | |
tree | f91ec6d49e2b01de5b4b3d517209d13b216a3f0f /scripts/gdb/linux/modules.py | |
parent | f0133acc7d4835cfbb86393b7d2a4fba7519585b (diff) | |
parent | 970442c599b22ccd644ebfe94d1d303bf6f87c05 (diff) | |
download | linux-8e8c668927b029f6ccc350eb1aa936864cc4eb6f.tar.xz |
Merge branch 'x86/urgent' into x86/cpu, to pick up dependency
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'scripts/gdb/linux/modules.py')
-rw-r--r-- | scripts/gdb/linux/modules.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 0a35d6dbfb80..441b23239896 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") @@ -21,14 +21,14 @@ module_type = utils.CachedType("struct module") def module_list(): global module_type + modules = utils.gdb_eval_or_none("modules") + if modules is None: + return + 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): @@ -78,19 +78,17 @@ class LxLsmod(gdb.Command): address=str(layout['base']).split()[0], name=module['name'].string(), size=str(layout['size']), - ref=str(module['refcnt']['counter']))) + 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") |