用户操作
[即时聊天] [发私信] [加为好友]
白宇ID:bekars
327631次访问,排名170,好友0人,关注者4人。
bekars的文章
原创 185 篇
翻译 0 篇
转载 157 篇
评论 52 篇
bekars的公告
我的淘宝小店:http://shop33320596.taobao.com/ 主营各类Linux发行版和行业软件
Gold Price per Gram in China Yuan Renminbi Gold Price per ounce in United States Dollars
最近评论
bluehouse1985:Linux 环境下的多核调试
— Intel + Totalview 强强联合!
目前,在软件开发行业,各种性能优异的调试工具层出不穷。但是,它们中的绝大部分都只支持windows环境。即使能支持linux平台,操作起来也很不方便。因此,对于长期在linux上编写程序的开发人员来说,如何调试就成了一个令人头痛的问题!Intel软件 和 Total……
metababy:很好,受用
qutanzi:
thw01:建议上面的这位要是公司有熟悉嵌入式系统的人,可以买便宜的。如果一个人研究,没人指点,最好买贵点的。毕竟贵点的,资料齐全,软件齐全。
szq2k08:太好了!
文章分类
收藏
    相册
    My Photo
    Linux Power Link
    Debian Apt-get Search
    Debian WiKi
    Debian学习小组|Debian.linuxsir.org
    DENX ELDK
    Gentoo Portage File Search
    Gentoo WiKi
    Gentoo中文用户|Gentoo.linuxsir.org
    Gentoo官方中文论坛
    IPCOP
    Linux netfilter Hacking HOWTO
    Linuxsir.Org
    MIZI Linux
    SnapGear Embedded Linux
    中国Linux公社
    中国Linux论坛
    元器件手册
    My Links
    ppstream
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    转载 KGDB Quick Start收藏

    新一篇: Linux 设备驱动 Edition 3 | 旧一篇: Analyzing Kernel Modules Data in OProfile in Fedora Core 3/4 and RHEL4

      Contents
    1. Hardware setup
    2. Software setup
    3. Applying the kgdb patch
    4. Compiling the kernel on the development machine
    5. Starting the debug session
    6. Useful links and miscellaneous information

    Hardware setup

    Use a Null modem serial cable to connect across the Target and Development machines .

    [ Development machine ]----------------------------------[ Target machine ]

    1-Hardware pinout for the null modem serial cable

    OR
     
    2-Hardware pinout for the null modem serial cable

    Testing  the working of the Null-modem serial cable.

    On the Development machine :
    stty ispeed 115200 ospeed 115200 -F /dev/ttyS0
    cat testfile.txt > /dev/ttyS0

    On the Target machine :
    stty ispeed 115200 ospeed 115200 -F /dev/ttyS0
    cat /dev/ttyS0

    Target machine.

    The following settings are used for the Remote debugging session, automatically.

    <root #> stty -F /dev/ttyS0
    speed 115200 baud; line = 0;
    min = 1; time = 0;
    -brkint -icrnl -imaxbel
    -opost -onlcr
    -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

    Top

    Software setup

    1. Downloaded Linux kernel source  : linux-2.6.6.tar.gz
    2. Downloaded the 2.6.7 patch         : patch-2.6.7.bz2
    3. Downloaded the Kgdb patch        : linux-2.6.7-kgdb-2.2.tar.bz2

    4. Unzip the kernel sources & the kernel patch
      cd ${BASE_DIR}
      tar -zxvf linux-2.6.6.tar.gz
      bunzip2  patch-2.6.7.bz2
      ls  ${BASE_DIR} --> linux-2.6.6  patch-2.6.7

    5. mv ${BASE_DIR}/linux-2.6.6  ${BASE_DIR}/linux-2.6.7
    6. cd ${BASE_DIR}/linux-2.6.7
    7. patch -p1 < ${BASE_DIR}/patch-2.6.7

    Applying the kgdb patch

    1. Unzip the kgdb patch
      mkdir  ${BASE_DIR}/patch-kgdb
      cd  ${BASE_DIR}/patch-kgdb
      tar -jxvf linux-2.6.7-kgdb-2.2.tar.bz2
    2. patch -p1 < ${BASE_DIR}/patch-kgdb/core-lite.patch
    3. patch -p1 < ${BASE_DIR}/patch-kgdb/i386-lite.patch
    4. patch -p1 < ${BASE_DIR}/patch-kgdb/8250.patch
    5. patch -p1 < ${BASE_DIR}/patch-kgdb/eth.patch
    6. patch -p1 < ${BASE_DIR}/patch-kgdb/i386.patch
    7. patch -p1 < ${BASE_DIR}/patch-kgdb/core.patch

    Compiling the kernel on the development machine

    1. In the ${BASE_DIR}/linux-2.6.7/Makefile,  set the EXTRAVERSION = -kgdb
    2. make mrproper V=1
    3. make xconfig V=1 or make oldconfig V=1
      Select the options appropriate for the target machine Hardware.
      Select the options pertaining to kgdb under "Kernel hacking" .
      Click to view the snapshot image

    4. make clean V=1
    5. make bzImage V=1
    6. Transfer the built kernel to the Target machine from the Development machine .

      Copy the Kernel image from ${BASE_DIR}/linux-2.6.7/arch/i386/boot/bzImage  to the target machine as /boot/vmlinuz-2.6.7-kgdb
      Copy the Map file from ${BASE_DIR}/linux-2.6.7/System.map  to the target machine as /boot/System.map-2.6.7-kgdb
      Also create  links,
      ln -s  /boot/vmlinuz-2.6.7-kgdb        /boot/vmlinuz
      ln -s  /boot/System.map-2.6.7-kgdb  /boot/System.map

    7. Edit the /boot/grub/grub.conf file in the target machine to have the kgdb enabled kernel entry. 
      Sample is shown below :-

      # Sample grub.conf  which will by default boot the kgdb enabled kernel
      default=1
      timeout=10
      splashimage=(hd0,0)/boot/grub/splash.xpm.gz

      title RH
              root (hd0,0)
              kernel /boot/vmlinuz ro root=/dev/sda1
              initrd /boot/initrd

      title Linux-2.6.7-kgdb
              root (hd0,0)
              kernel /boot/vmlinuz-2.6.7-kgdb ro root=/dev/sda1 rootfstype=ext3 kgdbwait kgdb8250=0,115200
    Top

    Starting the debug session

    1. After  booting the target machine will wait for the host development machine to connect, by displaying the message :- 

      Waiting for connection from remote gdb...

    2. cd ${BASE_DIR}/linux-2.6.7
    3. For setting a debug session with baud rate of 115200 on /dev/ttyS0 , run as "root" user:-

      <root#> gdb ./vmlinux
      GNU gdb Red Hat Linux (6.0post-0.20040223.17rh)
      Copyright 2004 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"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

      (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)

    4. For further commands refer http://kgdb.linsyssoft.com/tockdebug.htm
    Top

    Useful links and Miscellaneous information

    1. Useful Links :
      http://kgdb.sourceforge.net/
      http://kgdb.linsyssoft.com/
      http://kgdb.linsyssoft.com/downloads/

    2. Active Developer :  Amit Kale --> amitkale@linsyssoft.com
    3. Bug Report          :  kgdb-bugreport@lists.sourceforge.net

    发表于 @ 2007年03月30日 17:56:00|评论(loading...)|编辑

    新一篇: Linux 设备驱动 Edition 3 | 旧一篇: Analyzing Kernel Modules Data in OProfile in Fedora Core 3/4 and RHEL4

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © bekars