path: root/scripts/gdb
diff options
authorStephen Boyd <>2019-05-14 15:45:49 -0700
committerLinus Torvalds <>2019-05-14 19:52:51 -0700
commitdfe4529ee4d39d89f4725fa2599aa9bfa27e5847 (patch)
tree1726920f0693c11f4692833bef10c9ff741a5882 /scripts/gdb
parent4c69add45fec995ce23b21dc90be20f1efd8cdad (diff)
scripts/gdb: find vmlinux where it was before
Patch series "gdb script for kconfig and timer list". This is a handful of changes to the kernel's gdb scripts to do some more debugging with kgdb. The first patch allows the vmlinux to be reloaded from where it was specified on the command line so that this set of scripts can be used from anywhere. The second patch adds a script to dump the config.gz to a file on the host debugging machine. The third patch adds some rb tree utilities and the last patch uses those rb tree walking utilities to dump out the contents of /proc/timer_list from a system under debug. This patch (of 5): If I run 'gdb <path/to/vmlinux>' and there's the file there I can properly see symbols and use the lx commands provided by the GDB scripts. But once I run 'lx-symbols' at the command prompt, gdb reloads the vmlinux symbols assuming that this script was run from the directory that has vmlinux at the root. That isn't always true, but we could just look and see what symbols were already loaded and use that instead. Let's do that so this can work by being invoked anywhere. Link: Signed-off-by: Stephen Boyd <> Cc: Douglas Anderson <> Cc: Nikolay Borisov <> Cc: Kieran Bingham <> Cc: Jan Kiszka <> Cc: Jackie Liu <> Cc: Jason Wessel <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'scripts/gdb')
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/gdb/linux/ b/scripts/gdb/linux/
index 004b0ac7fa72..2f5b95f09fa0 100644
--- a/scripts/gdb/linux/
+++ b/scripts/gdb/linux/
@@ -139,8 +139,12 @@ lx-symbols command."""
saved_states.append({'breakpoint': bp, 'enabled': bp.enabled})
# drop all current symbols and reload vmlinux
+ orig_vmlinux = 'vmlinux'
+ for obj in gdb.objfiles():
+ if obj.filename.endswith('vmlinux'):
+ orig_vmlinux = obj.filename
gdb.execute("symbol-file", to_string=True)
- gdb.execute("symbol-file vmlinux")
+ gdb.execute("symbol-file {0}".format(orig_vmlinux))
self.loaded_modules = []
module_list = modules.module_list()