From: "Matthias Urlichs" Update Documentation/i386/kgdb/gdbinit-modules to conform to the current kernel's module data structure. Signed-Off-By: Matthias Urlichs Signed-off-by: Andrew Morton --- 25-akpm/Documentation/i386/kgdb/gdbinit-modules | 111 ++++++++++++------------ 1 files changed, 57 insertions(+), 54 deletions(-) diff -puN Documentation/i386/kgdb/gdbinit-modules~kgdb-documentation-fix Documentation/i386/kgdb/gdbinit-modules --- 25/Documentation/i386/kgdb/gdbinit-modules~kgdb-documentation-fix 2005-02-23 00:00:12.000000000 -0800 +++ 25-akpm/Documentation/i386/kgdb/gdbinit-modules 2005-02-23 00:00:12.000000000 -0800 @@ -60,87 +60,90 @@ # $mod is set to NULL. This ensure to not add symbols for a wrong # address. # +# +# Sat Feb 12 20:05:47 CET 2005 +# +# Adapted to the 2.6.* module data structure. +# (Getting miffed at gdb for not having "offsetof" in the process :-/ ) +# +# Autogenerate add-symbol-file statements from the module list instead +# of relying on a no-longer-working loadmodule.sh program. +# +# Matthias Urlichs +# +# # Have a nice hacking day ! # # define mod-list - set $mod = (struct module*)module_list - # the last module is the kernel, ignore it - while $mod != &kernel_module - printf "%p\t%s\n", (long)$mod, ($mod)->name - set $mod = $mod->next + set $lmod = modules->next + # This is a circular data structure + while $lmod != &modules + set $mod = (struct module *)(((char *)$lmod) - ((int)&(((struct module *)0) -> list))) + printf "%p\t%s\n", $mod, $mod->name + set $lmod = $lmod->next end end document mod-list +mod-list List all modules in the form: Use the as the argument for the other mod-commands: mod-print-symbols, mod-add-symbols. end +define mod-list-syms + set $lmod = modules->next + # This is a circular data structure + while $lmod != &modules + set $mod = (struct module *)(((char *)$lmod) - ((int)&(((struct module *)0) -> list))) + printf "add-symbol-file %s.ko %p\n", $mod->name, $mod->module_core + set $lmod = $lmod->next + end +end +document mod-list-syms +mod-list-syms +List all modules in the form: add-symbol-file +for adding modules' symbol tables without loadmodule.sh. +end + define mod-validate - set $mod = (struct module*)module_list - while ($mod != $arg0) && ($mod != &kernel_module) - set $mod = $mod->next + set $lmod = modules->next + set $mod = (struct module *)(((char *)$lmod) - ((int)&(((struct module *)0) -> list))) + while ($lmod != &modules) && ($mod != $arg0) + set $lmod = $lmod->next + set $mod = (struct module *)(((char *)$lmod) - ((int)&(((struct module *)0) -> list))) end - if $mod == &kernel_module - set $mod = 0 - printf "%p is not a module\n", $arg0 + if $lmod == &modules + set $mod = 0 + printf "%p is not a module\n", $arg0 end end document mod-validate mod-validate Internal user-command used to validate the module parameter. -If is a real loaded module, set $mod to it otherwise set $mod to 0. +If is a real loaded module, set $mod to it, otherwise set $mod +to 0. end - define mod-print-symbols mod-validate $arg0 if $mod != 0 - set $i = 0 - while $i < $mod->nsyms - set $sym = $mod->syms[$i] - printf "%p\t%s\n", $sym->value, $sym->name - set $i = $i + 1 - end + set $i = 0 + while $i < $mod->num_syms + set $sym = $mod->syms[$i] + printf "%p\t%s\n", $sym->value, $sym->name + set $i = $i + 1 + end + set $i = 0 + while $i < $mod->num_gpl_syms + set $sym = $mod->gpl_syms[$i] + printf "%p\t%s\n", $sym->value, $sym->name + set $i = $i + 1 + end end end document mod-print-symbols mod-print-symbols -Print all exported symbols of the module. see mod-list +Print all exported symbols of the module. See mod-list end - -define mod-add-symbols-align - mod-validate $arg0 - if $mod != 0 - set $mod_base = ($mod->size_of_struct + (long)$mod) - if ($arg2 != 0) && (($mod_base & ($arg2 - 1)) != 0) - set $mod_base = ($mod_base | ($arg2 - 1)) + 1 - end - add-symbol-file $arg1 $mod_base - end -end -document mod-add-symbols-align -mod-add-symbols-align -Load the symbols table of the module from the object file where -first section aligment is . -To retreive alignment, use `objdump -h '. -end - -define mod-add-symbols - mod-add-symbols-align $arg0 $arg1 sizeof(long) -end -document mod-add-symbols -mod-add-symbols -Load the symbols table of the module from the object file. -Default alignment is 4. See mod-add-symbols-align. -end - -define mod-add-lis - mod-add-symbols-align $arg0 /usr/src/LiS/streams.o 16 -end -document mod-add-lis -mod-add-lis -Does mod-add-symbols /usr/src/LiS/streams.o -end _