kgdbµ÷ÊÔlinuxÄÚºË(Õë¶Ô2.6ÄÚºË)
http://kgdb.linsyssoft.com/downloads.htm
ÏÂÔØÏàÓ¦µÄKGDBÄں˲¹¶¡¡£
´ÓlinuxÄں˹ٷ½ÍøÕ¾ÉÏÏÂÔضÔÓ¦µÄ°æ±¾Äںˡ£¶ÔÄں˴ò²¹¶¡£¬´ò²¹¶¡Ê±Òª¸ù¾ÝKGDBµÄREADMEºÍseriesÎļþ˵Ã÷£¬°´Ë³Ðò´ò¡£
ÈíÓ²¼þ×¼±¸
»·¾³£º
һ̨¿ª·¢»údeveloper(192.168.0.1com1)£¬Ò»Ì¨²âÊÔ»útarget(192.168.0.2 com1)£¬¶¼Ô¤×°redhat 9£»Ò»¸ù´®¿ÚÏß
²âÊÔ´®¿ÚÏß
ÎïÀíÁ¬½ÓºÃ´®¿ÚÏߺó£¬Ê¹ÓÃÒ»ÏÂÃüÁî½øÐвâÊÔ£¬stty¿ÉÒÔ¶Ô´®¿Ú²ÎÊý½øÐÐÉèÖÃ
ÔÚdeveloperÉÏÖ´ÐУº
stty ispeed 115200 ospeed 115200 -F /dev/ttyS0
echo hello > /dev/ttyS0
ÔÚtargetÉÏÖ´ÐУº
stty ispeed 115200 ospeed 115200 -F /dev/ttyS0
cat /dev/ttyS1
´®¿ÚÏßûÎÊÌâµÄ»°ÔÚtargetµÄÆÁÄ»ÉÏÏÔʾhello
=========== ͨ¹ý´®¿Ú =============
ÔÚKernel hackingÅäÖÃÏîÖн«ÒÔÏÂÈýÏî±àÒë½øÄÚºË
KGDB: Remote (serial) kernel debugging with gdb
KGDB: Thread analysis
KGDB: Console messages through gdb
*×¢Òâ(1) Serial port number for KGDB Õâ¸öÑ¡Ïî±íʾѡÔñÄĸö´®¿Ú£¬1±íʾttyS1,0±íʾttyS0¡£
ʹÓÃscp½øÐн«Ïà¹ØÎļþ¿½±´µ½targetÉÏ(µ±È»Ò²¿ÉÒÔʹÓÃÆäËüµÄÍøÂ繤¾ß)
#scp arch/i386/boot/bzImage [email protected]:/boot/vmlinuz-2.4.23-kgdb
*ÔÚtarget»úÆ÷ÉÏ
±à¼/etc/grub.confÎļþ£¬¼ÓÈëÒÔÏÂÐУº
#vi /etc/grub.conf
title Red Hat Linux (2.4.23-kgdb)
root (hd0,0)
kernel /boot/vmlinuz-2.4.23-kgdb ro root=/dev/hda1
#
ÖØÆð»úÆ÷
ÔÚdeveloperÉϵĸձàÒëµÄÄÚºËÔ´´úÂëĿ¼Ï£¬Ê¹ÓÃgdbÃüÁîµ÷ÊÔеÄÄںˡ£
# gdb vmlinux
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) set remotebaud 115200
(gdb) target remote /dev/ttyS0
Èç¹û³É¹¦µÄ»°£¬ÏÂÃæ»á³öÏÖ½øÈë¶ÏµãµÄÐÅÏ¢¡£
============ ͨ¹ýÍøÂç ============
±äÒìÄں˵ÄʱºòÑ¡Ôñͨ¹ýÍøÂçµ÷ÊÔ¡£
Method for KGDB communication (KGDB: On ethernet - in kernel)
grubµÄÉèÖÃ
kernel vmlinuz ro root=/dev/hda1 [email protected]/,¡ò192.168.0.1/
¿ÉÒԲο¼READMEÎļþ¡£
ÔÚdeveloperÉϵĸձàÒëµÄÄÚºËÔ´´úÂëĿ¼Ï£¬Ê¹ÓÃgdbÃüÁîµ÷ÊÔеÄÄںˡ£
# gdb vmlinux
(gdb) target remote udp:192.168.0.2:6443
Èç¹û³É¹¦µÄ»°£¬ÏÂÃæ»á³öÏÖ½øÈë¶ÏµãµÄÐÅÏ¢¡£
ºó¼Ç£º
Èç¹ûÖ»vmlinuxÎļþ¿½±´µ½ÆäËû»úÆ÷ÉÏ£¬Ò²¿ÉÒÔµ÷ÊÔ£¬µ«¿´²»µ½¶Ïµã´¦µÄ´úÂ룬ÒòΪvmlinuxËùÔÚµÄĿ¼ÏÂÃæûÓÐÔ´´úÂë¡£¶øÇÒËüʹÓõÄÊǾø¶Ô·¾¶£¬vmlinuxËùÔڵķ¾¶¸Ä±äÁË£¬Ò²»á¿´²»µ½Ô´´úÂë¡£
|