* [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address [not found] <CGME20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b@eucas1p2.samsung.com> @ 2023-04-12 20:25 ` Pankaj Raghav 2023-04-13 0:53 ` Luis Chamberlain 0 siblings, 1 reply; 5+ messages in thread From: Pankaj Raghav @ 2023-04-12 20:25 UTC (permalink / raw) To: jan.kiszka, kbingham; +Cc: gost.dev, linux-kernel, song, mcgrof, p.raghav commit ac3b43283923 ("module: replace module_layout with module_memory") changed the struct module data structure from module_layout to module_memory. The core_layout member which is used while loading modules are not available anymore leading to the following error while running gdb: (gdb) lx-symbols loading vmlinux Python Exception <class 'gdb.error'>: There is no member named core_layout. Error occurred in Python: There is no member named core_layout. Replace core_layout with its new counterpart mem[MOD_TEXT]. Fixes: ac3b43283923 ("module: replace module_layout with module_memory") Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> --- scripts/gdb/linux/constants.py.in | 3 +++ scripts/gdb/linux/modules.py | 4 ++-- scripts/gdb/linux/symbols.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in index 36fd2b145853..471300ba176c 100644 --- a/scripts/gdb/linux/constants.py.in +++ b/scripts/gdb/linux/constants.py.in @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) LX_GDBPARSED(IRQD_LEVEL) LX_GDBPARSED(IRQ_HIDDEN) +/* linux/module.h */ +LX_GDBPARSED(MOD_TEXT) + /* linux/mount.h */ LX_VALUE(MNT_NOSUID) LX_VALUE(MNT_NODEV) diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 441b23239896..261f28640f4c 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -13,7 +13,7 @@ import gdb -from linux import cpus, utils, lists +from linux import cpus, utils, lists, constants module_type = utils.CachedType("struct module") @@ -73,7 +73,7 @@ class LxLsmod(gdb.Command): " " if utils.get_long_type().sizeof == 8 else "")) for module in module_list(): - layout = module['core_layout'] + layout = module['mem'][constants.LX_MOD_TEXT] gdb.write("{address} {name:<19} {size:>8} {ref}".format( address=str(layout['base']).split()[0], name=module['name'].string(), diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index dc07b6d12e30..fdad3f32c747 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -15,7 +15,7 @@ import gdb import os import re -from linux import modules, utils +from linux import modules, utils, constants if hasattr(gdb, 'Breakpoint'): @@ -109,7 +109,7 @@ lx-symbols command.""" def load_module_symbols(self, module): module_name = module['name'].string() - module_addr = str(module['core_layout']['base']).split()[0] + module_addr = str(module['mem'][constants.LX_MOD_TEXT]['base']).split()[0] module_file = self._get_module_file(module_name) if not module_file and not self.module_files_updated: -- 2.39.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address 2023-04-12 20:25 ` [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address Pankaj Raghav @ 2023-04-13 0:53 ` Luis Chamberlain 2023-04-13 7:44 ` Pankaj Raghav 0 siblings, 1 reply; 5+ messages in thread From: Luis Chamberlain @ 2023-04-13 0:53 UTC (permalink / raw) To: Pankaj Raghav; +Cc: jan.kiszka, kbingham, gost.dev, linux-kernel, song On Wed, Apr 12, 2023 at 10:25:18PM +0200, Pankaj Raghav wrote: > commit ac3b43283923 ("module: replace module_layout with module_memory") > changed the struct module data structure from module_layout to > module_memory. The core_layout member which is used while loading > modules are not available anymore leading to the following error while > running gdb: > > (gdb) lx-symbols > loading vmlinux > Python Exception <class 'gdb.error'>: There is no member named core_layout. > Error occurred in Python: There is no member named core_layout. > > Replace core_layout with its new counterpart mem[MOD_TEXT]. > > Fixes: ac3b43283923 ("module: replace module_layout with module_memory") > Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> > --- > scripts/gdb/linux/constants.py.in | 3 +++ > scripts/gdb/linux/modules.py | 4 ++-- > scripts/gdb/linux/symbols.py | 4 ++-- > 3 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in > index 36fd2b145853..471300ba176c 100644 > --- a/scripts/gdb/linux/constants.py.in > +++ b/scripts/gdb/linux/constants.py.in > @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) > LX_GDBPARSED(IRQD_LEVEL) > LX_GDBPARSED(IRQ_HIDDEN) > > +/* linux/module.h */ > +LX_GDBPARSED(MOD_TEXT) Should we just fill in the rest of the other sections too while at it? Luis ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address 2023-04-13 0:53 ` Luis Chamberlain @ 2023-04-13 7:44 ` Pankaj Raghav 2023-04-13 13:47 ` Kieran Bingham 0 siblings, 1 reply; 5+ messages in thread From: Pankaj Raghav @ 2023-04-13 7:44 UTC (permalink / raw) To: Luis Chamberlain Cc: jan.kiszka, kbingham, gost.dev, linux-kernel, song, Florian Fainelli On 2023-04-13 02:53, Luis Chamberlain wrote: > On Wed, Apr 12, 2023 at 10:25:18PM +0200, Pankaj Raghav wrote: >> commit ac3b43283923 ("module: replace module_layout with module_memory") >> changed the struct module data structure from module_layout to >> module_memory. The core_layout member which is used while loading >> modules are not available anymore leading to the following error while >> running gdb: >> >> (gdb) lx-symbols >> loading vmlinux >> Python Exception <class 'gdb.error'>: There is no member named core_layout. >> Error occurred in Python: There is no member named core_layout. >> >> Replace core_layout with its new counterpart mem[MOD_TEXT]. >> >> Fixes: ac3b43283923 ("module: replace module_layout with module_memory") >> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> >> --- >> scripts/gdb/linux/constants.py.in | 3 +++ >> scripts/gdb/linux/modules.py | 4 ++-- >> scripts/gdb/linux/symbols.py | 4 ++-- >> 3 files changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in >> index 36fd2b145853..471300ba176c 100644 >> --- a/scripts/gdb/linux/constants.py.in >> +++ b/scripts/gdb/linux/constants.py.in >> @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) >> LX_GDBPARSED(IRQD_LEVEL) >> LX_GDBPARSED(IRQ_HIDDEN) >> >> +/* linux/module.h */ >> +LX_GDBPARSED(MOD_TEXT) > > Should we just fill in the rest of the other sections too while at it? > I don't see them used in the scripts. Maybe we can add them when needed? > Luis ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address 2023-04-13 7:44 ` Pankaj Raghav @ 2023-04-13 13:47 ` Kieran Bingham 2023-04-13 21:04 ` Luis Chamberlain 0 siblings, 1 reply; 5+ messages in thread From: Kieran Bingham @ 2023-04-13 13:47 UTC (permalink / raw) To: Luis Chamberlain, Pankaj Raghav Cc: jan.kiszka, kbingham, gost.dev, linux-kernel, song, Florian Fainelli Quoting Pankaj Raghav (2023-04-13 08:44:38) > On 2023-04-13 02:53, Luis Chamberlain wrote: > > On Wed, Apr 12, 2023 at 10:25:18PM +0200, Pankaj Raghav wrote: > >> commit ac3b43283923 ("module: replace module_layout with module_memory") > >> changed the struct module data structure from module_layout to > >> module_memory. The core_layout member which is used while loading > >> modules are not available anymore leading to the following error while > >> running gdb: > >> > >> (gdb) lx-symbols > >> loading vmlinux > >> Python Exception <class 'gdb.error'>: There is no member named core_layout. > >> Error occurred in Python: There is no member named core_layout. > >> > >> Replace core_layout with its new counterpart mem[MOD_TEXT]. > >> > >> Fixes: ac3b43283923 ("module: replace module_layout with module_memory") > >> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> > >> --- > >> scripts/gdb/linux/constants.py.in | 3 +++ > >> scripts/gdb/linux/modules.py | 4 ++-- > >> scripts/gdb/linux/symbols.py | 4 ++-- > >> 3 files changed, 7 insertions(+), 4 deletions(-) > >> > >> diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in > >> index 36fd2b145853..471300ba176c 100644 > >> --- a/scripts/gdb/linux/constants.py.in > >> +++ b/scripts/gdb/linux/constants.py.in > >> @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) > >> LX_GDBPARSED(IRQD_LEVEL) > >> LX_GDBPARSED(IRQ_HIDDEN) > >> > >> +/* linux/module.h */ > >> +LX_GDBPARSED(MOD_TEXT) > > > > Should we just fill in the rest of the other sections too while at it? > > > > I don't see them used in the scripts. Maybe we can add them when needed? I think there's a runtime-cost to getting these constants, as we interogate GDB to get the values. Because of that, I think values should only be added when required, unless the python code is only lazy-evaluating these. -- Kieran ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address 2023-04-13 13:47 ` Kieran Bingham @ 2023-04-13 21:04 ` Luis Chamberlain 0 siblings, 0 replies; 5+ messages in thread From: Luis Chamberlain @ 2023-04-13 21:04 UTC (permalink / raw) To: Kieran Bingham Cc: Pankaj Raghav, jan.kiszka, kbingham, gost.dev, linux-kernel, song, Florian Fainelli On Thu, Apr 13, 2023 at 02:47:30PM +0100, Kieran Bingham wrote: > Quoting Pankaj Raghav (2023-04-13 08:44:38) > > On 2023-04-13 02:53, Luis Chamberlain wrote: > > > On Wed, Apr 12, 2023 at 10:25:18PM +0200, Pankaj Raghav wrote: > > >> commit ac3b43283923 ("module: replace module_layout with module_memory") > > >> changed the struct module data structure from module_layout to > > >> module_memory. The core_layout member which is used while loading > > >> modules are not available anymore leading to the following error while > > >> running gdb: > > >> > > >> (gdb) lx-symbols > > >> loading vmlinux > > >> Python Exception <class 'gdb.error'>: There is no member named core_layout. > > >> Error occurred in Python: There is no member named core_layout. > > >> > > >> Replace core_layout with its new counterpart mem[MOD_TEXT]. > > >> > > >> Fixes: ac3b43283923 ("module: replace module_layout with module_memory") > > >> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> > > >> --- > > >> scripts/gdb/linux/constants.py.in | 3 +++ > > >> scripts/gdb/linux/modules.py | 4 ++-- > > >> scripts/gdb/linux/symbols.py | 4 ++-- > > >> 3 files changed, 7 insertions(+), 4 deletions(-) > > >> > > >> diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in > > >> index 36fd2b145853..471300ba176c 100644 > > >> --- a/scripts/gdb/linux/constants.py.in > > >> +++ b/scripts/gdb/linux/constants.py.in > > >> @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) > > >> LX_GDBPARSED(IRQD_LEVEL) > > >> LX_GDBPARSED(IRQ_HIDDEN) > > >> > > >> +/* linux/module.h */ > > >> +LX_GDBPARSED(MOD_TEXT) > > > > > > Should we just fill in the rest of the other sections too while at it? > > > > > > > I don't see them used in the scripts. Maybe we can add them when needed? > > I think there's a runtime-cost to getting these constants, as we > interogate GDB to get the values. > > Because of that, I think values should only be added when required, > unless the python code is only lazy-evaluating these. OK thanks, applied and pushed to modules-next. Luis ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-13 21:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b@eucas1p2.samsung.com>
2023-04-12 20:25 ` [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address Pankaj Raghav
2023-04-13 0:53 ` Luis Chamberlain
2023-04-13 7:44 ` Pankaj Raghav
2023-04-13 13:47 ` Kieran Bingham
2023-04-13 21:04 ` Luis Chamberlain
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®