From: Lei Y. <ly...@ec...> - 2004-10-17 23:10:42
|
Hi there, I've been playing around UML for some time. I finally got a working uml box but when I tried to debug a kernel module inside it, problems came along. I found from the UML site that : "In order to debug the kernel, you need build it from source. See this page <http://user-mode-linux.sourceforge.net/compile.html> for information on doing that. Make sure that you enable CONFIG_DEBUGSYM and CONFIG_PT_PROXY during the config. These will compile the kernel with -g, and enable the ptrace proxy so that gdb works with UML, respectively." --I did this. You can have the kernel running under the control of gdb from the beginning by putting 'debug' on the command line. -- I did "./linux debug". Surprisingly, the uml just boot as usual. I didn't see any gdb info. So I tried " gdb ./linux", gdb starts and I keep type 'c' to get kernel boot. However, there would be segmentation faults. GNU gdb 5.3.92 Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i586-suse-linux"... (gdb) run Starting program: /home/lei/uml/suse_rootfs/linux Program received signal SIGTRAP, Trace/breakpoint trap. 0xa000c000 in _start () at proc_fs.h:154 154 res->data=data; (gdb) c Continuing. Checking for the skas3 patch in the host...found Checking for /proc/mm...found Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) c Continuing. Checking for /dev/anon on the host...Not available (open failed with errno 2) Linux version 2.4.26-3um (root@suzhou) (gcc version 3.3.1 (SuSE Linux)) #3 Thu Sep 30 15:53:55 CDT 2004 On node 0 totalpages: 8192 zone(0): 8192 pages. zone(1): 0 pages. zone(2): 0 pages. Kernel command line: root=/dev/ubd0 Calibrating delay loop... 2549.35 BogoMIPS Memory: 28828k available Dentry cache hash table entries: 4096 (order: 3, 32768 bytes) Inode cache hash table entries: 2048 (order: 2, 16384 bytes) Mount cache hash table entries: 512 (order: 0, 4096 bytes) Buffer cache hash table entries: 1024 (order: 0, 4096 bytes) Page-cache hash table entries: 8192 (order: 3, 32768 bytes) Checking for host processor cmov support...Yes Checking for host processor xmm support...No Checking that ptrace can change system call numbers...OK Checking that host ptys support output SIGIO...Yes Checking that host ptys support SIGIO on close...No, enabling workaround POSIX conformance testing by UNIFIX Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) c Continuing. Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Initializing RT netlink socket Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) c Continuing. Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) c Continuing. Starting kswapd Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) c Continuing. Program received signal SIGUSR1, User defined signal 1. 0xa0168741 in kill () at swab.h:160 160 { (gdb) n Program received signal SIGSEGV, Segmentation fault. __libc_siglongjmp (env=0x1, val=0) at ../sysdeps/generic/longjmp.c:33 33 ../sysdeps/generic/longjmp.c: No such file or directory. in ../sysdeps/generic/longjmp.c (gdb) c Continuing. Kernel panic: Segfault with no mm <6>SysRq : Show Regs EIP: 0023:[<a0168741>] CPU: 0 Not tainted ESP: 002b:40001fb4 EFLAGS: 00000206 Not tainted EAX: 00000000 EBX: 0000094e ECX: 00000013 EDX: 0000094e ESI: 00000000 EDI: 00000000 EBP: 40001fd0 DS: 002b ES: 002b Call Trace: [<a00ea447>] [<a01c82fb>] [<a01cb4ce>] [<a00ea3d6>] [<a00d498b>] [<a001e47a>] [<a0160dcc>] [<a01cfa2c>] [<a001144d>] [<a001142f>] [<a00d3e0d>] [<a01cada5>] [<a0168795>] [<a00d1d84>] [<a00d4269>] [<a0168741>] [<a00d415d>] [<a00da857>] [<a00da84e>] [<a00d42c1>] [<a01686a8>] [<a016841e>] [<a0168795>] [<a00d1d1f>] [<a016841e>] [<a0039186>] [<a00d9914>] [<a0039186>] [<a00d98fd>] [<a0039186>] [<a00d9e01>] [<a01686a8>] [<a0168741>] Program received signal SIGSEGV, Segmentation fault. 0xa017f25d in __opendir (name=0xa2800000 "") at opendir.c:159 159 opendir.c: No such file or directory. in opendir.c (gdb) c Continuing. Program exited with code 01. (gdb) *********************************************************************************** Any hints? TIA Lei |