[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221214185658.fgsqrysq4luk2w4n@google.com>
Date: Wed, 14 Dec 2022 10:56:58 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Aaron Tomlin <atomlin@...hat.com>
Cc: jan.kiszka@...mens.com, kbingham@...nel.org, atomlin@...mlin.com,
linux-kernel@...r.kernel.org, dianders@...omium.org
Subject: Re: [PATCH v2] scripts/gdb: Ensure the absolute path is generated on
initial source
On Tue, Jul 12, 2022 at 12:02:48PM +0100, Aaron Tomlin 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'
So I recently moved to a new machine, and lost my previous .gdbinit.
I've re-added:
add-auto-load-safe-path /path/to/linux/
to my new ~/.gdbinit.
Upon startup, lx-dmesg and friends aren't available.
If I try:
(gdb) source scripts/gdb/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'
Which is exactly the error claimed to be fixed by
commit b99695580bfc ("scripts/gdb: ensure the absolute path is generated on initial source")
even though I have b99695580bfc, which is how I found this thread to
reply to.
(gdb) show auto-load safe-path
List of directories from which it is safe to auto-load files is $debugdir:$datadir/auto-load:/path/to/linux/.
$ gdb-multiarch --version | head -n1
GNU gdb (Debian 12.1-3) 12.1
$ python3 --version
Python 3.10.8
I've also RTFM @
Documentation/dev-tools/gdb-kernel-debugging.rst
though perhaps there's something I've missed?
$ grep -rn GDB_SCRIPTS .config
4162:CONFIG_GDB_SCRIPTS=y
This definitely has worked in the past for me, on my previous
workstation.
(gdb) show configuration
...
--with-python=/usr (relocatable)
--with-python-libdir=/usr/lib (relocatable)
...
(gdb) apropos lx
(gdb)
No warnings from GDB either about the autoload path not being set.
Running gdb in my top level kernel sources.
Am I holding it wrong?
Any tips on how to go about debugging this?
>
> 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")
>
> try:
> gdb.parse_and_eval("0")
> --
> 2.34.3
>
>
Powered by blists - more mailing lists