Skip to contentSkip to conversation

scripts/gdb: Account for changes in module data structure

PATCH In review Jan Kiszka 2 participants 2 messages Mar 13, 2016 – Mar 14, 2016 GDB kernel debugging helper scripts

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 scripts/gdb: Account for changes in module data structure

From: Jan Kiszka <[email protected]>

Commit 7523e4dc50 factored out the module_layout structure. Adjust the symbol loader and the lsmod command to this.

---

Probably too late for 4.5, still a regression.

 scripts/gdb/linux/modules.py | 5 +++--
 scripts/gdb/linux/symbols.py | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
scripts/gdb/linux/modules.py +3 -2
index 25db8cf..0a35d6d 100644
@@ -73,10 +73,11 @@ class LxLsmod(gdb.Command):
                 "        " if utils.get_long_type().sizeof == 8 else ""))
 
         for module in module_list():
+            layout = module['core_layout']
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(module['module_core']).split()[0],
+                address=str(layout['base']).split()[0],
                 name=module['name'].string(),
-                size=str(module['core_size']),
+                size=str(layout['size']),
                 ref=str(module['refcnt']['counter'])))
 
             source_list = module['source_list']
scripts/gdb/linux/symbols.py +1 -1
index 627750c..9a0f892 100644
@@ -108,7 +108,7 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_addr = str(module['core_layout']['base']).split()[0]
 
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:
Signature · 1 line
2.1.4
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Commit 7523e4dc50 factored out the module_layout structure. Adjust the symbol loader and the lsmod command to this.

Testing this has shown me that the module ko search path can find old modules versions in preference to newer ones, but that does not block this patch and can be investigated separately :

--
Regards

Kieran

Quoted 40 lines

---

Probably too late for 4.5, still a regression.

 scripts/gdb/linux/modules.py | 5 +++--
 scripts/gdb/linux/symbols.py | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
scripts/gdb/linux/modules.py +3 -2
index 25db8cf..0a35d6d 100644
@@ -73,10 +73,11 @@ class LxLsmod(gdb.Command):
                 "        " if utils.get_long_type().sizeof == 8 else ""))
 
         for module in module_list():
+            layout = module['core_layout']
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(module['module_core']).split()[0],
+                address=str(layout['base']).split()[0],
                 name=module['name'].string(),
-                size=str(module['core_size']),
+                size=str(layout['size']),
                 ref=str(module['refcnt']['counter'])))
 
             source_list = module['source_list']
scripts/gdb/linux/symbols.py +1 -1
index 627750c..9a0f892 100644
@@ -108,7 +108,7 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_addr = str(module['core_layout']['base']).split()[0]
 
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated: