hi, I am trying to cross-compile gdb to debug Linux kernel module with kgdb support. The host is Mac Leopard and the target machine is x86_64 Linux.
After building the crosstool chain the gdb 6.5 coming from http://www.kegel.com/crosstool/, I tried several different gdb, 6.5, 6.8 and the latest CVS gdb. BTW, the simple.ko is from linux kernel driver edition 3, which is compiled with -O0 -ggdb3. Your comments will be highly appreciated! > /Users/cjia/downloads/gdb-6.5/gdb/gdb vmlinux GNU gdb 6.5 Copyright (C) 2006 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 "--host=i386-apple-darwin9.4.0 --target=x86_64-unknown-linux-gnu"... (gdb) target remote udp:192.168.1.102:6443 warning: The remote protocol may be unreliable over UDP. Some events may be lost, rendering further debugging impossible. Remote debugging using udp:192.168.1.102:6443 breakpoint () at kernel/kgdb.c:1772 1772 atomic_set(&kgdb_setting_breakpoint, 0); warning: shared library handler failed to enable breakpoint (gdb) add-symbol-file ../ldd3_code/simple/simple.ko 0xffffffff883ab000 -s .data 0xffffffff883ac100 -s .bss 0xffffffff883ae600 add symbol table from file "../ldd3_code/simple/simple.ko" at .text_addr = 0x883ab000 .data_addr = 0x883ac100 .bss_addr = 0x883ae600 (y or n) y Reading symbols from /Users/cjia/workareas/linux_kernels/ldd3_code/simple/simple.ko...done. (gdb) b simple_vma_ simple_vma_close simple_vma_nopage simple_vma_open (gdb) b simple_vma_open Breakpoint 1 at 0xffffffff883ab084: file include/linux/clocksource.h, line 108. (gdb) With the gdb 6.8 release version: ( this looks more promising at least it didn't point to a header file anymore.) > /Users/cjia/Downloads/gdb-6.8/gdb/gdb vmlinux GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i386-apple-darwin9.4.0 --target=x86_64-unknown-linux-gnu"... (gdb) target remote udp:192.168.1.102:6443 warning: The remote protocol may be unreliable over UDP. Some events may be lost, rendering further debugging impossible. Remote debugging using udp:192.168.1.102:6443 breakpoint () at kernel/kgdb.c:1772 1772 atomic_set(&kgdb_setting_breakpoint, 0); (gdb) add-symbol-file ../ldd3_code/simple/simple.ko 0xffffffff883ab000 -s .data 0xffffffff883ac100 -s .bss 0xffffffff883ae600 add symbol table from file "../ldd3_code/simple/simple.ko" at .text_addr = 0x883ab000 .data_addr = 0x883ac100 .bss_addr = 0x883ae600 (y or n) y Reading symbols from /Users/cjia/workareas/linux_kernels/ldd3_code/simple/simple.ko...done. (gdb) b simple_vma_open Breakpoint 1 at 0xffffffff883ab084 (gdb) gdb from CVS: > /Users/cjia/Downloads/gdb-6.8/gdb/gdb vmlinux GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i386-apple-darwin9.4.0 --target=x86_64-unknown-linux-gnu"... (gdb) target remote udp:192.168.1.102:6443 warning: The remote protocol may be unreliable over UDP. Some events may be lost, rendering further debugging impossible. Remote debugging using udp:192.168.1.102:6443 breakpoint () at kernel/kgdb.c:1772 1772 atomic_set(&kgdb_setting_breakpoint, 0); (gdb) add-symbol-file ../ldd3_code/simple/simple.ko 0xffffffff883ab000 -s .data 0xffffffff883ac100 -s .bss 0xffffffff883ae600 add symbol table from file "../ldd3_code/simple/simple.ko" at .text_addr = 0x883ab000 .data_addr = 0x883ac100 .bss_addr = 0x883ae600 (y or n) y Reading symbols from /Users/cjia/workareas/linux_kernels/ldd3_code/simple/simple.ko...done. (gdb) b simple_vma_open Breakpoint 1 at 0xffffffff883ab084 (gdb) -- I would remember that if researchers were not ambitious probably today we haven't the technology we are using!
