Skip to contentSkip to conversation

scripts/gdb: Ensure the absolute path is generated on initial source

PATCH Superseded Aaron Tomlin 1 participant 1 message Jul 12, 2022 GDB kernel debugging helper scripts

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/gdb: Ensure the absolute path is generated on initial source

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.

---
 scripts/gdb/vmlinux-gdb.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +2 -1
index 4136dc2c59df..8d84e5968d30 100644
@@ -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")
Signature · 1 line
2.34.3