使用图形界面调试arm程序: insight + gdb

来源:互联网 发布:为什么卖家怕淘宝介入 编辑:程序博客网 时间:2024/05/15 05:41

【转帖请注明出处:blog.csdn.net/lanmanck】

1、首先下载insight,我这里是6.8版本,里面已经包含gdb和gdbserver了 :)

2、编译pc端得程序,类似visual studio,可以按照这篇文章来做:

http://linux.chinaunix.net/techdoc/develop/2008/12/28/1055528.shtml

但是有一点上述文章没有提到,那就是编译器链接库路径也要加进去的问题。

#cd insight

#./configure --target=arm-linux --prefix=/opt/work/insight --with-solib-absolute-prefix=/opt/armgcc/4.3.2/libc/lib

 

3、编译arm端得gdbserver:

cd insight/gdb/gdbserver

./configure --host=arm-linux --target=arm-linux

make

现在gdbserver已经生成,拷贝到arm文件系统的bin目录下即可。

 

============================调试方法===========================

1、打开arm-linux-insight,可以看到友好的界面,他会自动加载arm-linux-gdb

2、在界面打开一个arm可执行文件。这时会弹出对话框,让你选择gdb连接方式:有串口、tcp(网口)等。

3、在串口端运行gdbserver 192.168.1.2:1000 myarmexec,然后在insight选择好连接方式,点确定即可。

insight里的端口号1000好像改不了,咋回事?

 

注意:如果编译insight的时候,arm-linux-gcc的库路径没有加上去的话,会报一堆错误和警告,例如:

xxx is not at the expected address。

Error while mapping shared library sections。

 

解决方法如下2种之一:

1)、按照第一个步骤,把编译路径加上去:

--with-solib-absolute-prefix=/opt/armgcc/4.3.2/libc/lib

2)、在insight加载文件之前,设置好路径:

在insight的菜单打开gdb的console,用命令: set solib-absolute-path=/opt/armgcc/4.3.2/libc/lib

 或者:set solib-search-path

现在,我们也可以像visual studio 那样调试linux程序了,嘿嘿.