[PATCH]Handle symbols from modules with CONFIG_MODVERSIONS
Masahiro Adegawa
adegawa at zerosoft.co.jp
Wed Oct 13 01:48:38 PDT 1999
Hi,
i remaked the patch, and added new patchs.
1) modules symble with CONFIG_MODVERSIONS (remake)
`insmod scsi_mod'
kdb> id scsi_register
scsi_register_R0cb08d04: pushl %ebp
scsi_register_R0cb08d04+0x1: movl %esp,%ebp
scsi_register_R0cb08d04+0x3: pushl %esi
scsi_register_R0cb08d04+0x4: pushl %ebx
scsi_register_R0cb08d04+0x5: movl 0x8(%ebp),%esi
scsi_register_R0cb08d04+0x8: movl 0xc(%ebp),%ebx
2) added current task mark: command ps
kdb> ps
Task Addr Pid Parent cpu lcpu Tss Command
0xc7fea000 0000000001 0000000000 0000 0000 0xc7fea1dc init
0xc7fd8000 0000000002 0000000001 0000 0000 0xc7fd81dc kflushd
0xc7fd6000 0000000003 0000000001 0000 0000 0xc7fd61dc kupdate
0xc7fd4000 0000000004 0000000001 0000 0000 0xc7fd41dc kpiod
0xc7fd2000 0000000005 0000000001 0000 0000 0xc7fd21dc kswapd
0xc7b2a000 0000000067 0000000001 0000 0000 0xc7b2a1dc kerneld
0xc7a98000 0000000202 0000000001 0000 0000 0xc7a981dc portmap
0xc7a6e000 0000000216 0000000001 0000 0000 0xc7a6e1dc syslogd
0xc7d48000 0000000225 0000000001 0000 0000 0xc7d481dc*klogd
0xc7916000 0000000236 0000000001 0000 0000 0xc79161dc atd
<snip>
now, current task is klogd.
3) call SysRq from kdb
kdb> ?
Command Usage Description
----------------------------------------------------------
md <vaddr> Display Memory Contents
<snip>
reboot Reboot the machine immediately
sr <key> Magic SysRq key
kdb> sr m
<6>SysRq: Show Memory
Mem-info:
Free pages: 102236kB
( Free: 25559 (255 510 765)
5*4kB 3*8kB 5*16kB 5*32kB 7*64kB 5*128kB 6*256kB 2*512kB 2*1024kB 47*2048kB = 102236kB)
Swap cache: add 0, delete 0, find 0/0
<snip>
thanks,
-Adegawa Masahiro
--------------------------------------------------------------------------
diff -urN linux-2.2.11-b/arch/i386/kdb/kdb.c linux/arch/i386/kdb/
--- linux-2.2.11-b/arch/i386/kdb/kdb.c Mon Aug 16 19:02:09 1999
+++ linux/arch/i386/kdb/kdb.c Wed Oct 13 12:46:48 1999
@@ -1165,6 +1165,19 @@
return kdbdumpregs(regs, argv[1], argv[2]);
}
+#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
+int
+kdb_sr(int argc, const char **argv, const char **envp, struct pt_regs *regs)
+{
+ if (argc != 1) {
+ return KDB_ARGCOUNT;
+ }
+ handle_sysrq(*argv[1], regs, 0, 0);
+
+ return 0;
+}
+#endif
+
/*
* kdb_rm
*
@@ -1483,10 +1496,11 @@
kdb_printf("Task Addr Pid Parent cpu lcpu Tss Command\n");
for_each_task(p) {
- kdb_printf("0x%8.8x %10.10d %10.10d %4.4d %4.4d 0x%8.8x %s\n",
+ kdb_printf("0x%8.8x %10.10d %10.10d %4.4d %4.4d 0x%8.8x%c%s\n",
p, p->pid, p->p_pptr->pid, p->processor,
p->last_processor,
&p->tss,
+ (p == current) ? '*' : ' ',
p->comm);
}
@@ -1752,5 +1766,8 @@
#endif /* __SMP__ */
kdb_register("ps", kdb_ps, "", "Display active task list", 0);
kdb_register("reboot", kdb_reboot, "", "Reboot the machine immediately", 0);
+#ifdef CONFIG_MAGIC_SYSRQ
+ kdb_register("sr", kdb_sr, "<key>", "Magic SysRq key", 0);
+#endif
}
diff -urN linux-2.2.11-b/arch/i386/kdb/kdbsupport.c linux/arch/i386/kdb/
--- linux-2.2.11-b/arch/i386/kdb/kdbsupport.c Mon Aug 16 19:02:09 1999
+++ linux/arch/i386/kdb/kdbsupport.c Wed Oct 13 12:42:04 1999
@@ -449,6 +449,22 @@
if (ksp->name && (strcmp(ksp->name, symname)==0)) {
return ksp;
}
+#ifdef CONFIG_MODVERSIONS
+
+#ifdef CONFIG_SMP
+#define FLAG_STR "_Rsmp_"
+#else
+#define FLAG_STR "_R"
+#endif
+#define VER_NO_LENGTH 8
+#define FLAG_STR_LENGTH (sizeof(FLAG_STR)-1)
+
+ if (ksp->name && !memcmp(ksp->name, symname, strlen(symname)) &&
+ !memcmp(ksp->name+strlen(symname), FLAG_STR, FLAG_STR_LENGTH) &&
+ strlen(ksp->name)==(strlen(symname)+FLAG_STR_LENGTH+VER_NO_LENGTH)) {
+ return ksp;
+ }
+#endif
}
return NULL;
More information about the kdb
mailing list