Hide minor edits - Show changes to markup
sudo port install socat
sudo port install socat
sudo port install socat
[@
@]
[@
@]
[@
@]
[@
@]
The process is a little long but effective:
serial0.present = "TRUE" serial0.fileType = "pipe" serial0.yieldOnMsrRead = "TRUE" serial0.startConnected = "TRUE" serial0.fileName = "/Users/upendra/tmp/com_1"
socat -d -d /Users/upendra/tmp/com_1 TCP4-LISTEN:8888
gdb vmlinux target remote <ipaddress of your machine>:8888
so for example, on my machine I run the following command and I think exactly same command should work on your machine also gdb vmlinux target remote 192.168.44.1:8888
... your are done ... happy kernel debugging ....
socat ("socket cat") utility. It's installed on the elab machines, or you can install it from FC5 RPM or CentOS 4 RPM.
socat -d -d /tmp/com_1 PTY:
-bash-3.00$ socat -d -d /tmp/com_2 PTY: 2006/10/17 10:44:46 socat[20383] N successfully connected via 2006/10/17 10:44:46 socat[20383] N PTY is '''/dev/pts/7''' 2006/10/17 10:44:46 socat[20383] N starting data transfer loop ...
-bash-3.00$ gdb vmlinux.kgdb
GNU gdb Red Hat Linux (6.3.0.0-1.96rh)
[...]
(gdb) target remote /dev/pts/7
Remote debugging using /dev/pts/7
0xc012c138 in .text.lock.kgdbstub () at kgdbstub.c:1007
1007 kgdbstub.c: No such file or directory.
in kgdbstub.c
warning: shared library handler failed to enable breakpoint
(gdb)
And now you're up and running.
I haven't tested it yet, but you can create a named pipe for a serial port - make it something like /tmp/com_1, and then in gdb you should be able to just use the command target remote /tmp/com_1.
No, you need to use socat, which allows you to connect ...
(:title Using KGDB with VMWare:)
KGDB is a set of kernel patches that allows a second machine running a debugger (gdb) to control the target machine over a serial port. This page describes:
lba32 install=text boot=/dev/hda
image=/vmlinuz
label=CRUX
root=/dev/hda2
read-only
append="gdb gdbbaud=115000" @]-]
By default the 2.4 KGDB will use /dev/ttyS0, or COM1.
append="gdb gdbbaud=115000" @]-]
Note that the default image is the first in the file; the "prompt" and "timeout" arguments will allow you to specify which image to use at boot time. Don't forget to run lilo so it can save the parameters from /etc/lilo.conf.
No, you need to use socat, which allows you to connect ...
append="gdb gdbbaud=115000" @]
append="gdb gdbbaud=115000" @]-]
cd /usr/src/linux-2.4.23 patch -p1 < /tmp/linux-2.4.23-kgdb-1.9.patch
make menuconfig, and under "Kernel Hacking" enable "KGDB" and "KGDB Thread Analysis"
make dep and make bzImage)
lba32
install=text
boot=/dev/hda
prompt
timeout=100
image=/vmlinuz
label=CRUX
root=/dev/hda2
read-only
image=/vmlinuz.kgdb
label=KGDB
root=/dev/hda2
read-only
append="gdb gdbbaud=115000"
By default the 2.4 KGDB will use /dev/ttyS0, or COM1.
cd linux-2.6.15.6
patch -b -p1 < ../linux-2.6.15.5-kgdb-2.4/core-lite.patch
patch -b -p1 < ../ ... core.patch
patch -b -p1 < ../ ... i386-lite.patch
i386.patch
8250.patch
target remote ip_addr:8111 where ip_addr is the windows host IP address that this virtual machine sees. (e.g. on my machine 192.168.149.1, and the VM gets address 192.168.149.128)
KGDB should connect, and away you go.
Caveats - note that I've had a lot of trouble with the DHCP server in VMWare if I'm running multiple machines at once, as it tends to give the same address to each one. You may wish to hardcode the ip address, route, and DNS resolver instead on each VM.
I haven't tested it yet, but you can create a named pipe for a serial port - make it something like /tmp/com_1, and then in gdb you should be able to just use the command target remote /tmp/com_1.