2020-12-17 08:19:42

by Johannes Berg

[permalink] [raw]
Subject: [PATCH v2] gdb: lx-symbols: store the abspath()

From: Johannes Berg <[email protected]>

If we store the relative path, the user might later cd to a
different directory, and that would break the automatic symbol
resolving that happens when a module is loaded into the target
kernel. Fix this by storing the abspath() of each path given,
just like we already do for the cwd (os.getcwd() is absolute.)

Signed-off-by: Johannes Berg <[email protected]>
---
v2: break the long line
---
scripts/gdb/linux/symbols.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
index 1be9763cf8bb..08d264ac328b 100644
--- a/scripts/gdb/linux/symbols.py
+++ b/scripts/gdb/linux/symbols.py
@@ -164,7 +164,8 @@ lx-symbols command."""
saved_state['breakpoint'].enabled = saved_state['enabled']

def invoke(self, arg, from_tty):
- self.module_paths = [os.path.expanduser(p) for p in arg.split()]
+ self.module_paths = [os.path.abspath(os.path.expanduser(p))
+ for p in arg.split()]
self.module_paths.append(os.getcwd())

# enforce update
--
2.26.2


2020-12-17 08:33:44

by Jan Kiszka

[permalink] [raw]
Subject: Re: [PATCH v2] gdb: lx-symbols: store the abspath()

On 17.12.20 09:17, Johannes Berg wrote:
> From: Johannes Berg <[email protected]>
>
> If we store the relative path, the user might later cd to a
> different directory, and that would break the automatic symbol
> resolving that happens when a module is loaded into the target
> kernel. Fix this by storing the abspath() of each path given,
> just like we already do for the cwd (os.getcwd() is absolute.)
>
> Signed-off-by: Johannes Berg <[email protected]>
> ---
> v2: break the long line
> ---
> scripts/gdb/linux/symbols.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
> index 1be9763cf8bb..08d264ac328b 100644
> --- a/scripts/gdb/linux/symbols.py
> +++ b/scripts/gdb/linux/symbols.py
> @@ -164,7 +164,8 @@ lx-symbols command."""
> saved_state['breakpoint'].enabled = saved_state['enabled']
>
> def invoke(self, arg, from_tty):
> - self.module_paths = [os.path.expanduser(p) for p in arg.split()]
> + self.module_paths = [os.path.abspath(os.path.expanduser(p))
> + for p in arg.split()]
> self.module_paths.append(os.getcwd())
>
> # enforce update
>

Reviewed-by: Jan Kiszka <[email protected]>

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

2021-02-23 15:18:15

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v2] gdb: lx-symbols: store the abspath()

On Thu, 2020-12-17 at 09:31 +0100, Jan Kiszka wrote:
> On 17.12.20 09:17, Johannes Berg wrote:
> > From: Johannes Berg <[email protected]>
> >
> > If we store the relative path, the user might later cd to a
> > different directory, and that would break the automatic symbol
> > resolving that happens when a module is loaded into the target
> > kernel. Fix this by storing the abspath() of each path given,
> > just like we already do for the cwd (os.getcwd() is absolute.)

> Reviewed-by: Jan Kiszka <[email protected]>

So ... I'm still carrying this patch.

Anyone want to send it to Linus? Andrew, maybe you?

Thanks,
johannes

2021-02-24 01:10:26

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v2] gdb: lx-symbols: store the abspath()

On Tue, 23 Feb 2021 16:12:17 +0100 Johannes Berg <[email protected]> wrote:

> On Thu, 2020-12-17 at 09:31 +0100, Jan Kiszka wrote:
> > On 17.12.20 09:17, Johannes Berg wrote:
> > > From: Johannes Berg <[email protected]>
> > >
> > > If we store the relative path, the user might later cd to a
> > > different directory, and that would break the automatic symbol
> > > resolving that happens when a module is loaded into the target
> > > kernel. Fix this by storing the abspath() of each path given,
> > > just like we already do for the cwd (os.getcwd() is absolute.)
>
> > Reviewed-by: Jan Kiszka <[email protected]>
>
> So ... I'm still carrying this patch.
>
> Anyone want to send it to Linus? Andrew, maybe you?

Sure, I'll grab it after -rc1.