gdb是UNIX及UNIX-like下的调试工具。在linux下开发的人一定不会陌生,在arm-linux下也有对应的调试版本。下面记录一下在工作中用到的一些在arm-linux下用gdb调试多线程的一些知识。
一、下载调试工具
工程中使用了arm-none-linux-gnueabi-gcc编译器,提供一个下载网站arm-none-linux-gnueabi-gcc。
安转以后执行 arm-arago-linux-gnueabi-gdb -v即可查看版本信息和安转成功与否。
xxx@xxx-desktop:~/workdir/$ arm-arago-linux-gnueabi-gdb -v
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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-linux --target=arm-arago-linux-gnueabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
二、调试环境的建立
1、在下位机中输入:gdbserver 10.11.13.19:215 test.app
/mnt/test/ # gdbserver 10.11.13.19:215 test.app
Process test.app created; pid = 817
Listening on port 215
其中10.11.13.19为主机的ip地址,215为连接的端口号,test.app为要调试的应用程序。成功以后下位机将会监听215端口。
2、在主机输入:arm-arago-linux-gnueabi-gdb test.app
xxx@xxx-desktop:~/workdir/$arm-arago-linux-gnueabi-gdb test.app
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you