1. 编译Gdb6.6 (gdbserver6.6 包含在gdb根目录/gdb/gdbserver 的目录下面)
条件: 主机192.168.90.8 nfs目录/home/stan/nfsroot 开发扳:192.168.90.223
下载地址http://www.armodm.com
假设下载到/home/stan/目录下面
#tar jxvf gdb-6.6-tar-bz2#cd gdb-6.6#./configure --target=arm-linux –
prefix=/usr/local/arm-gdb-6.6 -v
#make
#make install
#export PATH=$PATH:/usr/local/arm-gdb-6.6
2.编译gdbserver
#cd /home/stan/gdb-6.6/gdb/gdbserver
#./configure --target=arm-linux –host=arm-linux
#make CC=/usr/local/arm/2.95.3/bin/arm-linux-gcc
(这一步要指定arm-linux-gcc的位置, 另外注意 --target=之间一定没有空格!)
编译出错
注释掉 这一行 #include <sys/reg.h>
3.假定Nfs目录在 /home/stan/nfsroot
4.在开发扳上(minicom) mount -t nfs 192.168.90.8:/home/stan/nfsroot /tmp/
nfs
5.拷贝gdbserver到开发扳子,或者考到/homestan/nfsroot目录下面可以在扳子上允许。
6.在目标板上运行 gdbserver,其实就是在宿主机的minicom下,在gdbserver所在目录下输入命令:
(minicom下)#cd /tmp#./gdbserver 192.168.90.8:2345 hello
192.168.90.223为宿主机IP,在目标系统的2345端口开启了一个调试进程,hello为要调试的程序。
7. 在主机另一个终端下
#cd /home/stan/nfsroot
#export PATH=$PATH:/usr/local/arm-gdb-6.6/bin
#arm-linux-gdb hello
(gdb) target remote 192.168.90.223:2345
(192.168.90.223为开发板IP)
8. 提示
Remote debugging using 192.168.2.223:2345
[New thread 80]
[Switching to thread 80]
0x40002a90 in ??()
同时在minicom下提示:
Remote debugging from host 192.168.2.100
(gdb)
连接成功,这时候就可以输入各种GDB命令如list、run、next、step、break等进行程序调试了。
技术支持:联系电话:13148818895 0755-83690800/075583662100 余焕丽
*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。