All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][2.6-mm] kgdb documentation fix
@ 2005-02-13  1:07 Matthias Urlichs
  0 siblings, 0 replies; only message in thread
From: Matthias Urlichs @ 2005-02-13  1:07 UTC (permalink / raw)
  To: george, linux-kernel; +Cc: akpm

[-- Attachment #1: Type: text/plain, Size: 5083 bytes --]

Hi,

Please apply.

--- 

Update Documentation/i386/kgdb/gdbinit-modules to conform
to the current kernel's module data structure.

Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>

--- 

===== Documentation/i386/kgdb/gdbinit-modules 1.1 vs edited =====
--- 1.1/Documentation/i386/kgdb/gdbinit-modules	2005-02-12 12:44:54 +01:00
+++ edited/Documentation/i386/kgdb/gdbinit-modules	2005-02-12 20:12:45 +01:00
@@ -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 <smurf@debian.org>
+#
+#
 # 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: <module-address> <module-name>
 Use the <module-address> 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 <module-path> <module-core>
+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 <module-address>
 Internal user-command used to validate the module parameter.
-If <module> is a real loaded module, set $mod to it otherwise set $mod to 0.
+If <module> 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 <module-address>
-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 <module-address> <object file path name> <align>
-Load the symbols table of the module from the object file where
-first section aligment is <align>.
-To retreive alignment, use `objdump -h <object file path name>'.
+Print all exported symbols of the module.  See mod-list
 end
 
-define mod-add-symbols
-    mod-add-symbols-align $arg0 $arg1 sizeof(long)
-end
-document mod-add-symbols
-mod-add-symbols <module-address> <object file path name>
-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 <module-address>
-Does mod-add-symbols <module-address> /usr/src/LiS/streams.o
-end

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-13  1:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-13  1:07 [PATCH][2.6-mm] kgdb documentation fix Matthias Urlichs

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.