#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.