[
Developemnt machine]--
Null-Modem Serial Cable --[
target machine ]
1. connect target and development machine using Null-Modem Cable
2. kernel should be compiled for kgdb (kernel gdb) support. Either we can compile the kernel in the target machine itself or cross compile in the development system
3. If compiled in the target machine then copy the vmlinux and source code to development machine.
4. If compiled in the development machine then copy the bzImage to target system /boot directory and update the boot loader
5. Include the following kernel command line option "kgdbwait kgdb8250=0,115200" in the target kernel option
6. After booting, the target machine will wait for the host development machine to connect, by displaying the message :- Waiting for connection from remote gdb...
7. In the development machine,
root# gdb vmlinux
(gdb) shell echo -e "\003" > /dev/ttyS0
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
breakpoint () at kernel/kgdb.c:1212
1212 atomic_set(&kgdb_setting_breakpoint, 0);
warning: shared library handler failed to enable breakpoint
(gdb)
8. Give c
"continue" (gdb) to boot the target machine.
9. If any crash in the target system then (gdb) in the development machine will break and using
bt (back trace) you can get the exact kernel crash location