The kgdb module notification patch (kgdbmod) expects the kernel to be called
"vmlinux". This is often not the case (e.g. vmlinux-2.6.21.1). When invoked on a
kernel that does not match vmlinux, gdb does not complain, and debugs the kernel
almost as normal, except that it does not notice any kernel modules.

When gdb is run under xemacs, if the target filename is a symlink, xemacs will
helpfully dereference the link, so that M-x gdb vmlinux ends up with gdb seeing
vmlinux-2.6.21.1 and consequently failing to notice kernel modules.

The patch fixes this by only requiring a partial match against the given string
(e.g. "vmlinux"), so that vmlinux-2.6.16 etc. will match okay.

Tim


Index: gdb-6.4-kgdbmod/gdb/defs.h
===================================================================
--- gdb-6.4-kgdbmod.orig/gdb/defs.h
+++ gdb-6.4-kgdbmod/gdb/defs.h
@@ -1217,4 +1217,6 @@ extern int use_windows;
 extern ULONGEST align_up (ULONGEST v, int n);
 extern ULONGEST align_down (ULONGEST v, int n);
 
+#define LINUX_KERNEL_NAME_STEM "vmlinux"
+
 #endif /* #ifndef DEFS_H */
Index: gdb-6.4-kgdbmod/gdb/symfile.c
===================================================================
--- gdb-6.4-kgdbmod.orig/gdb/symfile.c
+++ gdb-6.4-kgdbmod/gdb/symfile.c
@@ -869,7 +869,8 @@ new_symfile_objfile (struct objfile *obj
       filename = symfile_objfile->name;
       while (dir = strchr(filename, '/'))
         filename = dir + 1;
-      if (!strcmp(filename, "vmlinux"))
+      /* only require the given characters to match, so that longer filenames 
will still match */
+      if (!strncmp(filename, LINUX_KERNEL_NAME_STEM, 
strlen(LINUX_KERNEL_NAME_STEM)))
         {
           sym = lookup_symbol ("start_kernel", NULL, VAR_DOMAIN, NULL, NULL);
           if (sym)

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to