Skip to contentSkip to conversation

scripts/gdb: Fix loading of modules information

PATCH Superseded Daniel Wagner 2 participants 6 messages Mar 29, 2016 – Mar 31, 2016 GDB kernel debugging helper scripts

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/gdb: Fix loading of modules information

From: Daniel Wagner <[email protected]>

The module_core symbols is not available due to

7523e4dc5057 ("module: use a structure to encapsulate layout.")

The base address of the module is now stored inside struct module_layout.

Cc Jiri Kosina <[email protected]>
Cc Rusty Russell <[email protected]>
---
 scripts/gdb/linux/modules.py | 3 ++-
 scripts/gdb/linux/symbols.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
scripts/gdb/linux/modules.py +2 -1
index 25db8cf..cffe078 100644
@@ -74,7 +74,8 @@ class LxLsmod(gdb.Command):
 
         for module in module_list():
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(module['module_core']).split()[0],
+                module_layout=module['core_layout']
+                addressr=str(module_layout['base'])
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 ref=str(module['refcnt']['counter'])))
scripts/gdb/linux/symbols.py +2 -1
index 627750c..8650ede 100644
@@ -108,7 +108,8 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_layout = module['core_layout']
+        module_addr = str(module_layout['base'])
 
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:
Signature · 1 line
2.5.5
#1 lore raw

PATCH v2 1/1 scripts/gdb: Fix loading of modules information

From: Daniel Wagner <[email protected]>

The module_core symbols is not available due to

7523e4dc5057 ("module: use a structure to encapsulate layout.")

The base address of the module is now stored inside struct module_layout.

Cc Jiri Kosina <[email protected]>
Cc Rusty Russell <[email protected]>

---
Obviously, it's too early to send patches. This times it even works.

scripts/gdb/linux/modules.py | 3 ++-

 scripts/gdb/linux/symbols.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
scripts/gdb/linux/modules.py +2 -1
index 25db8cf..a1ec0f3 100644
@@ -73,8 +73,9 @@ class LxLsmod(gdb.Command):
                 "        " if utils.get_long_type().sizeof == 8 else ""))
 
         for module in module_list():
+            module_layout=module['core_layout']
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(module['module_core']).split()[0],
+                address=str(module_layout['base']),
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 ref=str(module['refcnt']['counter'])))
scripts/gdb/linux/symbols.py +2 -1
index 627750c..8650ede 100644
@@ -108,7 +108,8 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_layout = module['core_layout']
+        module_addr = str(module_layout['base'])
 
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:
Signature · 1 line
2.5.5
maintainer
#2 lore raw
In reply to Daniel Wagner
Quoted 22 lines · Daniel Wagner

From: Daniel Wagner <[email protected]>

The module_core symbols is not available due to

7523e4dc5057 ("module: use a structure to encapsulate layout.")

The base address of the module is now stored inside struct module_layout.

Cc Jiri Kosina <[email protected]>
Cc Rusty Russell <[email protected]>
---
 scripts/gdb/linux/modules.py | 3 ++-
 scripts/gdb/linux/symbols.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
scripts/gdb/linux/modules.py +0 -0
index 25db8cf..cffe078 100644

scripts/gdb/linux/modules.py class LxLsmod(gdb.Command): · line 78

Quoted 6 lines
scripts/gdb/linux/modules.py +2 -1
@@ -74,7 +74,8 @@ class LxLsmod(gdb.Command):
 
         for module in module_list():
             gdb.write("{address} {name:<19} {size:>8}  {ref}".format(
-                address=str(module['module_core']).split()[0],
+                module_layout=module['core_layout']
+                addressr=str(module_layout['base'])

This looks untested.

Quoted 9 lines
scripts/gdb/linux/modules.py +0 -0
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 ref=str(module['refcnt']['counter'])))
scripts/gdb/linux/symbols.py +0 -0
index 627750c..8650ede 100644

scripts/gdb/linux/symbols.py lx-symbols command.""" · line 115

Quoted 9 lines
scripts/gdb/linux/symbols.py +2 -1
@@ -108,7 +108,8 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_layout = module['core_layout']
+        module_addr = str(module_layout['base'])
 
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:

Thanks, but ad4db3b24a should already be on its way into stable.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 8 lines · Jan Kiszka

scripts/gdb/linux/modules.py class LxLsmod(gdb.Command): · line 78

Quoted 5 lines · Daniel Wagner

for module in module_list():
gdb.write("{address} {name:<19} {size:>8} {ref}".format(

scripts/gdb/linux/modules.py +2 -1
-                address=str(module['module_core']).split()[0],
+                module_layout=module['core_layout']
+                addressr=str(module_layout['base'])

This looks untested.

Yep, I send out the untested version. Need more coffee...

Quoted 15 lines
Quoted 15 lines
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 ref=str(module['refcnt']['counter'])))
scripts/gdb/linux/symbols.py +2 -1
index 627750c..8650ede 100644
@@ -108,7 +108,8 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_layout = module['core_layout']
+        module_addr = str(module_layout['base'])
 
Quoted 5 lines

scripts/gdb/linux/symbols.py lx-symbols command.""" · line 115

Quoted 3 lines
scripts/gdb/linux/symbols.py +0 -0
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:

Thanks, but ad4db3b24a should already be on its way into stable.

Ah, I haven't got that fix yet because I am still on a older branch. Also my google-foo didn't help.

Sorry about that noise.

cheers,
daniel

maintainer
#4 lore raw
Quoted 33 lines · Daniel Wagner
Quoted 8 lines · Jan Kiszka

scripts/gdb/linux/modules.py class LxLsmod(gdb.Command): · line 78

Quoted 5 lines · Daniel Wagner

for module in module_list():
gdb.write("{address} {name:<19} {size:>8} {ref}".format(

scripts/gdb/linux/modules.py +2 -1
-                address=str(module['module_core']).split()[0],
+                module_layout=module['core_layout']
+                addressr=str(module_layout['base'])

This looks untested.

Yep, I send out the untested version. Need more coffee...

Quoted 15 lines
Quoted 15 lines
                 name=module['name'].string(),
                 size=str(module['core_size']),
                 ref=str(module['refcnt']['counter'])))
scripts/gdb/linux/symbols.py +2 -1
index 627750c..8650ede 100644
@@ -108,7 +108,8 @@ lx-symbols command."""
 
     def load_module_symbols(self, module):
         module_name = module['name'].string()
-        module_addr = str(module['module_core']).split()[0]
+        module_layout = module['core_layout']
+        module_addr = str(module_layout['base'])
 
Quoted 5 lines

scripts/gdb/linux/symbols.py lx-symbols command.""" · line 115

Quoted 3 lines
scripts/gdb/linux/symbols.py +0 -0
         module_file = self._get_module_file(module_name)
         if not module_file and not self.module_files_updated:

Thanks, but ad4db3b24a should already be on its way into stable.

Quoted 4 lines

Ah, I haven't got that fix yet because I am still on a older branch. Also my google-foo didn't help.

Sorry about that noise.

No problem. At least we now know another frequent user.

BTW, Kieran and some other people at Linaro started to think about how to auto-test for such regressions - probably the only reliable way to catch them.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw
Quoted 1 line · Jan Kiszka

No problem. At least we now know another frequent user.

Let's say sometimes :)

Quoted 3 lines

BTW, Kieran and some other people at Linaro started to think about how to auto-test for such regressions - probably the only reliable way to catch them.

Good idea. I am happy to test if you got something.

cheers,
daniel