All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@redhat.com>
To: jan.kiszka@siemens.com, kbingham@kernel.org
Cc: atomlin@atomlin.com, linux-kernel@vger.kernel.org
Subject: [PATCH] scripts/gdb: Ensure the absolute path is generated on initial source
Date: Tue, 12 Jul 2022 12:00:03 +0100	[thread overview]
Message-ID: <20220712110003.1400015-1-atomlin@redhat.com> (raw)

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@redhat.com>
---
 scripts/gdb/vmlinux-gdb.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py
index 4136dc2c59df..8d84e5968d30 100644
--- a/scripts/gdb/vmlinux-gdb.py
+++ b/scripts/gdb/vmlinux-gdb.py
@@ -13,7 +13,8 @@
 
 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")
+print(sys.path)
 
 try:
     gdb.parse_and_eval("0")
-- 
2.34.3


                 reply	other threads:[~2022-07-12 11:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220712110003.1400015-1-atomlin@redhat.com \
    --to=atomlin@redhat.com \
    --cc=atomlin@atomlin.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.