Created
March 3, 2015 16:22
-
-
Save ryao/22d8d4367a2006be3d65 to your computer and use it in GitHub Desktop.
GDB command for loading kernel module symbols from sudo -i chroot /guest/gentoo /usr/bin/gdb /usr/src/linux/vmlinux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define lx-add-module-symbols | |
set $current = modules.next | |
set $offset = ((int)&((struct module *)0).list) | |
while($current.next != modules.next) | |
eval "python from subprocess import check_output; info = check_output(\"modinfo -k %s -n %s\", shell=True).strip().decode(\"ascii\"); gdb.execute('add-symbol-file ' + info + ' %p' )\n", \ | |
init_uts_ns.name.release, \ | |
((struct module *) (((void *) ($current)) - $offset ) )->name ,\ | |
((struct module *) (((void *) ($current)) - $offset ) )->module_core | |
set $current = $current.next | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment