2020-12-17 08:13:47

by Jan Kiszka

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

On 16.12.20 14:56, 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]>
> ---
> scripts/gdb/linux/symbols.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
> index 1be9763cf8bb..e651c335deb6 100644
> --- a/scripts/gdb/linux/symbols.py
> +++ b/scripts/gdb/linux/symbols.py
> @@ -164,7 +164,7 @@ 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
>

Looks good, we just tried to stay within 80 chars line length also with
the python scripts.

Jan

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