[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=WwAO-QDBmfODJ+-8nzN_+m=3drRhMg7mRd-82U4RML=g@mail.gmail.com>
Date: Thu, 28 Jul 2022 08:29:43 -0700
From: Doug Anderson <dianders@...omium.org>
To: Aaron Tomlin <atomlin@...hat.com>
Cc: Jan Kiszka <jan.kiszka@...mens.com>,
Kieran Bingham <kbingham@...nel.org>, atomlin@...mlin.com,
LKML <linux-kernel@...r.kernel.org>,
kgdb-bugreport@...ts.sourceforge.net,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] scripts/gdb: Ensure the absolute path is generated on
initial source
Hi,
On Tue, Jul 12, 2022 at 4:03 AM Aaron Tomlin <atomlin@...hat.com> wrote:
>
> Post 'make scripts_gdb' a symbolic link to scripts/gdb/vmlinux-gdb.py
> is created. Currently 'os.path.dirname(__file__)' does not generate
> the absolute path to scripts/gdb resulting in the following:
>
> (gdb) source vmlinux-gdb.py
> Traceback (most recent call last):
> File "scripts/gdb/vmlinux-gdb.py", line 25, in <module>
> import linux.utils
> ModuleNotFoundError: No module named 'linux'
>
> This patch ensures that the absolute path to scripts/gdb in relation to
> the given file is generated so each module can be located accordingly.
>
> Signed-off-by: Aaron Tomlin <atomlin@...hat.com>
> ---
> scripts/gdb/vmlinux-gdb.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py
> index 4136dc2c59df..3e8d3669f0ce 100644
> --- a/scripts/gdb/vmlinux-gdb.py
> +++ b/scripts/gdb/vmlinux-gdb.py
> @@ -13,7 +13,7 @@
>
> import os
>
> -sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
> +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/scripts/gdb")
It seems to generate an absolute path for me, but some quick web
searches show that it's not guaranteed so I guess you must be hitting
whatever corner cases it ends up being relative.
The fix seems reasonable to me, thus:
Reviewed-by: Douglas Anderson <dianders@...omium.org>
Powered by blists - more mailing lists