Messages in this thread Patch in this message |  | | From | Jan Kiszka <> | Subject | [PATCH v5 04/20] scripts/gdb: Add module iteration helper | Date | Tue, 29 Jan 2013 13:37:47 +0100 |
| |
Will soon be used for loading symbols, printing global variables or listing modules.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> --- scripts/gdb/module.py | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) create mode 100644 scripts/gdb/module.py
diff --git a/scripts/gdb/module.py b/scripts/gdb/module.py new file mode 100644 index 0000000..01b23df --- /dev/null +++ b/scripts/gdb/module.py @@ -0,0 +1,28 @@ +# +# gdb helper commands and functions for Linux kernel debugging +# +# module tools +# +# Copyright (c) Siemens AG, 2013 +# +# Authors: +# Jan Kiszka <jan.kiszka@siemens.com> +# +# This work is licensed under the terms of the GNU GPL version 2. +# + +import gdb + +from utils import * + +module_type = CachedType("struct module") + +def for_each_module(func, arg = None): + global module_type + module_ptr_type = module_type.get_type().pointer() + modules = gdb.parse_and_eval("modules") + entry = modules['next'] + while entry != modules.address: + module = container_of(entry, module_ptr_type, "list") + func(module, arg) + entry = entry['next'] -- 1.7.3.4
|  |