With another day of effort I am was able to set up the KGDB with target C1 to host C2. The only change I did was changed my host from FC6 to FC12. Now both my target and host are FC12.
C1(target) <---------------------------------------->C2 (host)
Grub setting on the target is
title Fedora (2.6.34)
root (hd0,0)
kernel /boot/vmlinuz-2.6.34 ro root=UUID=fb7800fb-cfe7-438d-bc7f-c153ba4353d1 LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us console=ttyS0,115200n8 kgdboc=ttyS0,115200 kgdbwait kgdbcon
initrd /boot/initrd-2.6.34.img
On booting the target the kernel is waiting for connection from remote gdb
# On the host following is the scene. I am not able to single step.
[root@localhost kgdb]# gdb vmlinux
GNU gdb (GDB) Fedora (7.0-3.fc12)
Copyright (C) 2009 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 "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/kgdb/vmlinux...done.
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
0xc044d8a9 in ?? ()
(gdb) s
Cannot find bounds of current function
(gdb)
(gdb) add-symbol-file ./vmlinux 0xC1000000 -s .data 0xC12d6000 -s .bss
0xc135d000 -s .rodata 0xc1217000
add symbol table from file "./vmlinux" at
.text_addr = 0xc1000000
.data_addr = 0xc12d6000
.bss_addr = 0xc135d000
.rodata_addr = 0xc1217000
(y or n) y
Reading symbols from /root/kgdb/vmlinux...done.
(gdb) s
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) s
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) n
Cannot find bounds of current function
(gdb) N
Cannot find bounds of current function
(gdb) s
Cannot find bounds of current function
(gdb) c
Can you please help me in doing single stepping, from here.
Thanks,
Prabhu
On Thu, May 12, 2011 at 6:16 AM, Prabhu nath <gprabhunath@xxxxxxxxx> wrote:
Dear All / Spiro,
I tried setting up KGDB on my machine but somehow I am not finding my luck for past few months.
Sprio. in his earlier mail had said about his success of setting up KGDB, Can you please share your notes of how to set up KGDB. If possibe please share the screen shots. Let me feel happy about the gdb prompt.
Following is my set up.
I have two x86 single core machines. C1 and C2.
C1 = target
C2 = Host
On Target I have built a custom kernel 2.6.34 with KGDB enabled. Here is the snapshot of my .config
CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_INFO=y
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
My vmlinux is around 65MB.
Scenario 1:
I connected a null modem cable from C1 to C2. Tested the cable by redirecting the kernel boot logs from C1 to C2 thru the cable and cable is fine.
I connected C1 to a LCD monitor (console=tty0) through a VGA cable so that I used tty0 to view normal kernel booting logs and null modem cable to work with debugger
My grub.conf is
title Fedora (2.6.34)
root (hd0,1)
kernel /vmlinuz-2.6.34 ro root=UUID=4a51e22e-ec12-469f-80ff-17afe3e6f15f rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us
console=tty0 kgdbwaitkgdb8250=ttyS0,115200
initrd /initramfs-2.6.34.img
The result was, on booting up the kernel kgdb was not waiting.
Scenario 2.
I connected a null modem cable from C1 to C2. Tested the cable by redirecting the kernel boot logs from C1 to C2 thru the cable and cable is fine.
I connected C1 to a LCD monitor (console=tty0) through a VGA cable so that I tty0 to view normal kernel booting logs and null modem cable to work with debugger
My grub.conf is
title Fedora (2.6.34)
root (hd0,1)
kernel /vmlinuz-2.6.34 ro root=UUID=4a51e22e-ec12-469f-80ff-17afe3e6f15f rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us
console=tty0 kgdbwaitkgdboc=ttyS0,115200
initrd /initramfs-2.6.34.img
The result is, on booting up the kernel kgdb is waiting for the input ( This log was seen on my LCD monitor) but Alt-SysRq-g did not work here to switch to the debugger
Scenario 3:
I connected a null modem cable from C1 to C2. Tested the cable by redirecting the kernel boot logs from C1 to C2 thru the cable and cable is fine.
My grub.conf is
title Fedora (2.6.34)
root (hd0,1)
kernel /vmlinuz-2.6.34 ro root=UUID=4a51e22e-ec12-469f-80ff-17afe3e6f15f rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us
console=ttyS0,115200n8 kgdbwaitkgdboc=ttyS0,115200 kgdbcon
initrd /initramfs-2.6.34.img
The result is, on booting up the kernel kgdb is waiting for the input ( This log was seen on my minicom console) but Alt-SysRq-g did not work and it threw some garbage.
On the host side I executed the following commands.
# gdb ./vmlinux (gdb) set remotebaud 115200 (gdb) target remote /dev/ttyS0
Some of the documents say that after executing the last command I should see the gdb prompt from where I can set breakpoints, single stepping, but didn't show up for me :(
Note: If it really matters. I was working on my host machine through a putty session.
Request you or anyone to bail me out from the clutches of this precarious problem.
Thanks,
Prabhu
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies