Skip to contentSkip to conversation

scripts/gdb: fix lx-symbols 'gdb.error' while loading modules

PATCH Applied Stefano Garzarella 3 participants 3 messages Jul 22, 2020 – Jul 23, 2020 GDB kernel debugging helper scripts

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/gdb: fix lx-symbols 'gdb.error' while loading modules

Commit ed66f991bb19 ("module: Refactor section attr into bin attribute") removed the 'name' field from 'struct module_sect_attr' triggering the following error when invoking lx-symbols:

(gdb) lx-symbols
loading vmlinux
scanning for modules in linux/build
loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko Python Exception <class 'gdb.error'> There is no member named name.:
Error occurred in Python: There is no member named name.

This patch fixes the issue taking the module name from the 'struct attribute'.

---
 scripts/gdb/linux/symbols.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/linux/symbols.py +1 -1
index be984aa29b75..1be9763cf8bb 100644
@@ -96,7 +96,7 @@ lx-symbols command."""
             return ""
         attrs = sect_attrs['attrs']
         section_name_to_address = {
-            attrs[n]['name'].string(): attrs[n]['address']
+            attrs[n]['battr']['attr']['name'].string(): attrs[n]['address']
             for n in range(int(sect_attrs['nsections']))}
         args = []
         for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",
Signature · 1 line
2.26.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Stefano Garzarella

Commit ed66f991bb19 ("module: Refactor section attr into bin attribute") removed the 'name' field from 'struct module_sect_attr' triggering the following error when invoking lx-symbols:

(gdb) lx-symbols
loading vmlinux
scanning for modules in linux/build
loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko Python Exception <class 'gdb.error'> There is no member named name.:
Error occurred in Python: There is no member named name.

This patch fixes the issue taking the module name from the 'struct attribute'.

---
  scripts/gdb/linux/symbols.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/linux/symbols.py +0 -0
index be984aa29b75..1be9763cf8bb 100644

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

Quoted 8 lines
scripts/gdb/linux/symbols.py +1 -1
@@ -96,7 +96,7 @@ lx-symbols command."""
              return ""
          attrs = sect_attrs['attrs']
          section_name_to_address = {
-            attrs[n]['name'].string(): attrs[n]['address']
+            attrs[n]['battr']['attr']['name'].string(): attrs[n]['address']
              for n in range(int(sect_attrs['nsections']))}
          args = []
          for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
maintainer Reviewed-by
#2 lore raw

Hi All,

Quoted 12 lines · Jan Kiszka
Quoted 11 lines · Stefano Garzarella

Commit ed66f991bb19 ("module: Refactor section attr into bin attribute") removed the 'name' field from 'struct module_sect_attr' triggering the following error when invoking lx-symbols:

   (gdb) lx-symbols
   loading vmlinux
   scanning for modules in linux/build
   loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko Python Exception <class 'gdb.error'> There is no member named name.:
   Error occurred in Python: There is no member named name.

Quoted 3 lines
Quoted 3 lines

This patch fixes the issue taking the module name from the 'struct attribute'.

It might not be needed if this gets in to v5.8 in time, but perhaps:

Fixes ed66f991bb19 ("module: Refactor section attr into bin attribute")
Quoted 1 line
Quoted 1 line

Otherwise, also looks fine to me.

Quoted 26 lines
Quoted 11 lines

---
  scripts/gdb/linux/symbols.py | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/linux/symbols.py +0 -0
index be984aa29b75..1be9763cf8bb 100644
@@ -96,7 +96,7 @@ lx-symbols command."""

              return ""
          attrs = sect_attrs['attrs']

Quoted 9 lines

          section_name_to_address = {
-            attrs[n]['name'].string(): attrs[n]['address'] +            attrs[n]['battr']['attr']['name'].string():
attrs[n]['address']
              for n in range(int(sect_attrs['nsections']))} args = []
          for section_name in [".data", ".data..read_mostly", ".rodata", ".bss",

Thanks,
Jan

Signature · 2 lines
--
Kieran