Skip to contentSkip to conversation

scripts: fix the sys path for gdb scripts

PATCH Superseded yalin wang 2 participants 3 messages Nov 19, 2015 – Nov 27, 2015 GDB kernel debugging helper scripts

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

yalin wang

author
#0 lore raw

PATCH 1/1 scripts: fix the sys path for gdb scripts

The sys.path should be scripts/gdb,
so that we can import linux lib correctly.

---
 scripts/gdb/vmlinux-gdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +1 -1
index ce82bf5..5a45d1a 100644
@@ -13,7 +13,7 @@
 
 import os
 
-sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
+sys.path.insert(0, os.path.dirname(__file__))
 
 try:
     gdb.parse_and_eval("0")
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 14 lines · yalin wang

The sys.path should be scripts/gdb,
so that we can import linux lib correctly.

---
 scripts/gdb/vmlinux-gdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +0 -0
index ce82bf5..5a45d1a 100644

scripts/gdb/vmlinux-gdb.py line 19

Quoted 8 lines
scripts/gdb/vmlinux-gdb.py +1 -1
@@ -13,7 +13,7 @@
 
 import os
 
-sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
+sys.path.insert(0, os.path.dirname(__file__))
 
 try:
     gdb.parse_and_eval("0")

NACK. This patch is assuming that vmlinux-gdb.py is (only) started from the scripts/gdb folder. But CONFIG_GDB_SCRIPTS places a link to vmlinux-gdb.py aside the vmlinux binary in the top-level folder. That way, the script is auto-loaded by gdb.

If you have a compelling use case for loading the script manually from its original folder, we can discuss augmenting the path. But removing the existing one is wrong.

Andrew, please drop the patch from your queue.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux
author
#2 lore raw
Quoted 32 lines · Jan Kiszka
Quoted 19 lines · yalin wang

The sys.path should be scripts/gdb,
so that we can import linux lib correctly.

---
scripts/gdb/vmlinux-gdb.py | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +0 -0
index ce82bf5..5a45d1a 100644
@@ -13,7 +13,7 @@
 

import os

scripts/gdb/vmlinux-gdb.py +1 -1
-sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb")
+sys.path.insert(0, os.path.dirname(__file__))
Quoted 3 lines

try:

    gdb.parse_and_eval("0")

NACK. This patch is assuming that vmlinux-gdb.py is (only) started from the scripts/gdb folder. But CONFIG_GDB_SCRIPTS places a link to vmlinux-gdb.py aside the vmlinux binary in the top-level folder. That way, the script is auto-loaded by gdb.

Quoted 6 lines

If you have a compelling use case for loading the script manually from its original folder, we can discuss augmenting the path. But removing the existing one is wrong.

Andrew, please drop the patch from your queue.

ok, i will send a V2 patch for this .