Will soon be used for loading symbols, printing global variables or
listing modules.

Signed-off-by: Jan Kiszka <jan.kis...@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.kis...@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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to