History

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 vmlinux-gdb.py 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.

Stephen Boyd committed 7 years ago

Commit dfe45291 parent 4c69add1 file · +5 −1Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/gdb/linux/symbols.py+5−1
@@ -139,8 +139,12 @@ lx-symbols command.""" · 138 unmodified lines
139 saved_states.append({'breakpoint': bp, 'enabled': bp.enabled})139 saved_states.append({'breakpoint': bp, 'enabled': bp.enabled})
140 140
141 # drop all current symbols and reload vmlinux141 # drop all current symbols and reload vmlinux
142 orig_vmlinux = 'vmlinux'
143 for obj in gdb.objfiles():
144 if obj.filename.endswith('vmlinux'):
145 orig_vmlinux = obj.filename
142 gdb.execute("symbol-file", to_string=True)146 gdb.execute("symbol-file", to_string=True)
143 gdb.execute("symbol-file vmlinux")147 gdb.execute("symbol-file {0}".format(orig_vmlinux))
144 148
145 self.loaded_modules = []149 self.loaded_modules = []
146 module_list = modules.module_list()150 module_list = modules.module_list()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t