Steps i followed in setting up Kgdb-Serial b/w two Desktop Pc's.
Downloaded kgdb-2.4(eperimental)patches from SourceForge.net: kgdb.
Downloaded Linux kernel-2.6.16.40 from kernel.org.
I used quilt utilty to patch the kernel.
In Dev m/c
$ cd /usr/src/linux-2.6.16.40
$ make mrproper
Now copy target's (kernel) config file to Dev machines target linux source directory
$ scp root@ipaddress:/boot/config-2.6.18-FC6 /usr/src/linux-2.6.16.40/.config
$ make menuconfig
2. Build:
------
Enable following config options (in this order).
1) Kernel hacking ->
KGDB: kernel debugging with remote gdb ->
KGDB: Thread analysis
KGDB: Console messages through gdb
KGDB: Select the serial port(0/1)
[Note: I selected port no as 0, as there is
only com1 is there in my target m/c]
2) Device drivers ->
Character devices ->
Serial drivers ->
KGDB: On generic serial port (8250)
3) Security ->
Disable selinux
$ make clean
$ make bzImage
$ make modules
$ make modules_install
3. Follow the steps for Target machine
----------------------------------
1) Copy /lib/modules/2.6.16.40 in Dev machine to same location in Target machine.
2) Make initrd
$ mkinitrd /boot/initrd-2.6.16-s0404.img /lib/modules/2.6.16.40
3) Copy bzImage from Dev machine(/usr/src/linux2.6.16.40/arch/i386/boot) to Target machines /boot/vmlinuz-2.6.16-s0404
4) Copy System.map from Dev machine(/usr/src/linux2.6.16.40) to Target's /boot/System.map-2.6.16-s0404
5) Boot:
-----
Put 'kgdbwait' on the command line in /boot/grub/menu.lst if you have configured KGDB to use the
serial port you want, and you want KGDB to stop on boot.
Eg:
title Fedora Core (2.6.16-s0404-ttys0)
root (hd0,1)
kernel /boot/vmlinuz-2.6.16-s0404 ro root=LABEL=/ kgdbwait
initrd /boot/initrd-2.6.16-s0404.img
If you pass 'kgdbwait' on the command line, target machine stops at:
"Uncompressing Linux... Ok, booting the kernel."
4.
Now on the development machine start the gdb (@ /usr/src/linux-2.6.16.40) and set the baudrate and serial port as shown below.
% gdb ./vmlinux
(gdb) set remotebaud 115200
(gdb) set debug remote 10
(gdb) target remote /dev/ttyS0
remote debugging using /dev/ttyS0
breakpoint () at kernel/kgdb.c:1889
1889 atomic_set(&kgdb_setting_breakpoint, 0);
warning: shared library handler failed to enable breakpoint
(gdb) c
Continuing.
Hope this listing will be helpful...