<menu id="w8yyk"><menu id="w8yyk"></menu></menu>
  • <dd id="w8yyk"><nav id="w8yyk"></nav></dd>
    <menu id="w8yyk"></menu>
    <menu id="w8yyk"><code id="w8yyk"></code></menu>
    <menu id="w8yyk"></menu>
    <xmp id="w8yyk">
    <xmp id="w8yyk"><nav id="w8yyk"></nav>
  • 網站首頁 > 物聯資訊 > 技術分享

    arm-linux-gdb+gdbserver環境搭建以及遠程調試

    2016-09-28 00:00:00 廣州睿豐德信息科技有限公司 閱讀
    睿豐德科技 專注RFID識別技術和條碼識別技術與管理軟件的集成項目。質量追溯系統、MES系統、金蝶與條碼系統對接、用友與條碼系統對接

    0) gdb源碼下載:http://ftp.gnu.org/gnu/gdb/

    1) 編譯arm-linux-gdb

        指定交叉編譯工具鏈的位置

        export PATH=$PATH:/usr/local/arm/3.4.1/bin
        開始配置和編譯

        $cd gdb-6.6
        $./configure --target=arm-linux --prefix=/usr/local/arm/gdb -v
       $make
       

    中間會出現一些地方編譯過去,如

    gdb declared with attribute warn_unused_result

     檢查了下,發現是由于檢查太嚴格了,把 Makefile 里面 -Wall 類似的強制警告檢查都去掉就可以過了

     

    2) 編譯gdbserver
        $cd gdb/gdbserver
        $./configure --target=arm-linux --host=arm-linux
          target含義同前,host指明編譯生成的gdbserver運行在arm-linux上,前者沒有設定host的原因是
          arm-linux-gdb是在pc linux上運行的,就像arm-linux-gcc (很好理解的:))
        $
    make CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc

     

       #gdbserver 192.168.1.200:7777 test
         Process test created; pid                                                                                   
         Listening on port 7777

       主機shell下
       $cd ~/tftpboot
       $arm-linux-gdb test
        GNU gdb 6.6 
        Copyright (C) 2006 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 "--host=i686-pc-linux-gnu --target=arm-linux"...
        (gdb)
        注意一下顯示信息的最后--host=i686-pc-linux-gnu --target=arm-linux,明白了吧。。。
        target remote 192.168.1.168:7777   --連接gdbserver
        Remote debugging using 192.168.1.168:7777
        0x40000dd0 in _start () from /lib/ld-linux.so.2
        表示連接上了服務器,:),接下來就可以調試了。arm-linux-gdb和GDB的用法一樣,只是沒有r這個命   
       令,運行程序用c命令。
        (gdb) l
       1       #include<stdio.h>
       2
       3       int main()
       4       {
       5               char *ptr = "csdn";
       6               printf("%c/n",*(ptr++));
       7               return 0;
       8       }
        (gdb) b 3
       Breakpoint 1 at 0x83d0: file test.c, line 3.

       另外由于程序是在目標板上運行,調試是在PC下,程序的結果還是會在目標板上顯示的, 
       例如:minicom,lcd等。
       btw,附近一篇介紹GDB使用的文章:http://blog.csdn.net/haoel/archive/2003/07.aspx,這下全了吧。哈

    RFID管理系統集成商 RFID中間件 條碼系統中間層 物聯網軟件集成
    最近免费观看高清韩国日本大全