分类:
2011-12-01 11:41:11
原文地址:mini2440 gdb远程调试 作者:sjj0412
-------------------------------------------------
本文系本站原创,欢迎转载!
然后下载到目标板即可,运行的时候会出问题,会说libthread_db.so.1找不到,这时可以在/usr/local/arm/3.4.1/arm-linux/lib将这个文件下载到
目标板上去即可,一般放到/lib目录,如果你放到其他目录,要将其加到LD_LIBRARY_PATH环境变量里。
5.调试
1.使用gdbserver
在目标板上运行gdbserver
在目标板上执行
#./gdbserver 192.168.1.230:7777 hello
其中192.168.1.230为目标板的IP。7777为gdbserver打开的端口,可以自己设置。
2. 运行gdb客户端
arm-linux-gdb hello
GNU gdb 6.6
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux"...
(gdb) target remote 192.168.1.230:7777
Remote debugging using 192.168.1.230:7777
0x40000dd0 in ?? () from /lib/ld-linux.so.2
(gdb) b main
Breakpoint 1 at 0x84a0: file hello.c, line 3.
(gdb) l
1 #include
2 int main(){
3 int i=0;
4 i++;
5 printf("%d\n",i);
6 }
(gdb) b main
Breakpoint 1 at 0x84a0: file hello.c, line 3.
(gdb) c
Continuing.
Breakpoint 1, main () at hello.c:3
3 int i=0;
(gdb) n
4 i++;
(gdb) n
5 printf("%d\n",i);
(gdb)