Skip to contentSkip to conversation

scripts/gdb: relax requirement on symlink location

PATCH In review Tobias Waldekranz 2 participants 2 messages Oct 14, 2016 – Oct 17, 2016 GDB kernel debugging helper scripts

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/gdb: relax requirement on symlink location

The current construct for inserting the scripts/gdb/ directory into the python path requires vmlinux-gdb.py to be symlinked in the root of the kernel build tree.

By first resolving the symlink and inserting that path, the symlink can be placed in an arbitrary directory.

---
 scripts/gdb/vmlinux-gdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +1 -1
index ce82bf5..a9029f4 100644
@@ -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.realpath(__file__)))
 
 try:
     gdb.parse_and_eval("0")
Signature · 1 line
1.8.4.357.g8d83871.dirty
maintainer
#1 lore raw
Quoted 6 lines · Tobias Waldekranz

The current construct for inserting the scripts/gdb/ directory into the python path requires vmlinux-gdb.py to be symlinked in the root of the kernel build tree.

By first resolving the symlink and inserting that path, the symlink can be placed in an arbitrary directory.

Can you provide a brief word on what this would enable (i.e. why we want it)?

Quoted 12 lines
---
 scripts/gdb/vmlinux-gdb.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/vmlinux-gdb.py +0 -0
index ce82bf5..a9029f4 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(os.path.realpath(__file__)))
 
 try:
     gdb.parse_and_eval("0")

Unfortunately, this breaks with modules that are generated, namely constants.py. They are located in the build dir. Please suggest a version that was tested successfully against both the existing and the new use case.

Thanks,
Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux