From: Nick Desaulniers <ndesaulniers@google.com>
To: Aaron Tomlin <atomlin@redhat.com>
Cc: jan.kiszka@siemens.com, kbingham@kernel.org, atomlin@atomlin.com,
linux-kernel@vger.kernel.org, dianders@chromium.org
Subject: Re: [PATCH v2] scripts/gdb: Ensure the absolute path is generated on initial source
Date: Wed, 14 Dec 2022 10:56:58 -0800 [thread overview]
Message-ID: <20221214185658.fgsqrysq4luk2w4n@google.com> (raw)
In-Reply-To: <20220712110248.1404125-1-atomlin@redhat.com>
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@redhat.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
>
>
next prev parent reply other threads:[~2022-12-14 18:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 11:02 Aaron Tomlin
2022-07-28 7:22 ` Aaron Tomlin
2022-07-28 15:29 ` Doug Anderson
2022-12-14 18:56 ` Nick Desaulniers [this message]
2022-12-14 19:39 ` Nick Desaulniers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221214185658.fgsqrysq4luk2w4n@google.com \
--to=ndesaulniers@google.com \
--cc=atomlin@atomlin.com \
--cc=atomlin@redhat.com \
--cc=dianders@chromium.org \
--cc=jan.kiszka@siemens.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®