You are on page 1of 2

Development m/c: gdb

target m/c: kgdb


--------------------------------------
Files:
kernel source rpm
gdbmod rpm
kgdb patch
================================================================================
=============================================
On target m/c:
---------------
1)
Install the kernel source rpm.
rpm -ivh <source rpm>
2)
cd /usr/src/redhat/SPECS
rpmbuild -bp <spec file>
3)
Patch the kgdb patch
cp /boot/config-2.6.18-53.1.19.el5 /usr/src/redhat/BUILD/kernel-2.6.18/.config
cd /usr/src/redhat/BUILD/kernel-<version>/linux-<version>
patch -p1 < /path/to/patch/file/kgdb-2.6.18-53.1.19.el5.patch

4)
make menuconfig
a) Select "KGDB: kernel debugging with remote gdb"
b) select "KGDB: Console messages through gdb"
c) Enter "Serial port number for KGDB" as 0
5)
vi Makefile
append to the EXTRAVERSION = -kgdb
6)
make
#######################################
7)
make modules_install
In "ls /lib/modules" our kernel entry should be there, like 2.6.18-kgdb
8)
make install
9)
Add 'kgdbwait' at the end of the middle line in /etc/grub.conf as follows:
kernel /vmlinuz-2.6.18-kgdb ro root=/dev/VolGroup01/LogVol00 noapic rhgb quiet c
onsole=tty0 console=ttyS0,115200 kgdbwait
10)
scp -r /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64 <development m/c
IP>:/root/home/guest/
11)
copy the module debugging gdb file (gdbmod) to the <development m/c>
untar the file gdbmod
12) on development machine
a) stty ispeed 115200 ospeed 115200 < /dev/ttyS0
b) stty -a -F /dev/ttyS0
12b)
reboot target m/c
13)
On the development m/c:
cd /root/home/guest/linux-2.6.18.x86_64
../gdbmod-x86_64-x86_64 vmlinux
(gdb)target remote /dev/ttyS0
(gdb)detach

14)
On target m/c
a) Compile disksafe driver
b) Copy compilied disksafe drivers folder (/mnt/ds/workspace/disksafe/disksafe.l
inux/drivers) to the development m/c under /root/home/guest
15)
On development m/c
(gdb) set solib-search-path /root/home/guest/drivers/linux/2.6
(gdb)target remote /dev/ttyS0
(gdb)c
16)
Continue testing on target m/c.

after panic debugging :


A)
(gdb) bt
(gdb) info thr
B)
(gdb) thr <id>
(gdb) bt
Note: we should focus on those threads with no name.

You might also like