赛迪网 > IT技术 Linux > 嵌入式应用
  IT资讯搜索
 
IT产品搜索
[程序开发][网管世界][网络安全][数据库技术]
[操作系统][嘉宾聊天·在线访谈][活动集锦]
[精彩专题][Symantec专区][订阅IT技术周刊]
[开发论坛][网管论坛][安全论坛][数据库论坛]
[操作系统论坛][Sybase专区][IBM dW技术专区]
[病毒求助][病毒与漏洞播报][文档·源码下载]

如何运用Gdb对ARM板上的程序进行远程调试

发布时间:2007.09.04 06:31     来源:赛迪网    作者:kit

在arm板上运行 gdbserver

[root@51Board usb]# ./gdbserver 192.168.0.29:1234 arm0702_8.out

Process arm0702_8.out created; pid = 228

从服务器中等待一个请求

这个是对qte程序的调试,先运行程序再调试进程号。在PC机上程序名称一样的。

// ./gdbserver 192.168.0.29:1234 --attach 545

说明:

这里的192.168.0.29是上位PC机的IP(这个应该于ARM板上的IP在一个网段内)

1234这里规定的端口号,等下要用到的,当然这个也可以用其他的端口号

Arm0702_8.out

上位PC机运行 arm-linux-gdb 调试程序

[root@zieckey collieryMainSrc02]# arm-linux-gdb arm0702_8.out

GNU gdb 5.3

Copyright 2002 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)

上位PC机连接到ARM板

[root@zieckey collieryMainSrc02]# arm-linux-gdb arm0702_8.out

GNU gdb 5.3

Copyright 2002 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) target remote 192.168.0.50:1234

Remote debugging using 192.168.0.50:1234

0x40001550 in ?? ()

这时ARM板上的信息应该是这样的:

[root@51Board usb]# ./gdbserver 192.168.0.29:1234 arm0702_8.out

Process arm0702_8.out created; pid = 228

Remote debugging from host 192.168.0.29

现在就已经建立其了PC机通ARM板山的连接了。

那么我们就可以像调试本地程序一样调试ARM板上程序。

例如:

(gdb) list

19 //#include "cmaininterfacewidget.h"

20 //#include "headers.h"

21

22 #include "cwidgetmanager.h"

23 #define _DEBUG_

24 #define _DEBUGCDatabase_

25

26 int main( int argc, char ** argv )

27 {

28 QApplication app( argc, argv );

(gdb) break 28

Breakpoint 1 at 0xf25c: file main.cpp, line 28.

(gdb) target remote 192.168.0.50:1234

Remote debugging using 192.168.0.50:1234

0x4011dc30 in ?? ()

Error while mapping shared library sections:

/usr/qpe/lib/libts-0.0.so.0: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/libqwt.so.4: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/libsqlite3.so.0: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/libsqlitedataset.so.0: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/libqte.so.2: 没有那个文件或目录.

Error while mapping shared library sections:

/lib/libstdc++.so.5: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/variance.so: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/dejitter.so: 没有那个文件或目录.

Error while mapping shared library sections:

/usr/qpe/lib/linear.so: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/libts-0.0.so.0: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/libqwt.so.4: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/libsqlite3.so.0: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/libsqlitedataset.so.0: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/libqte.so.2: 没有那个文件或目录.

Error while reading shared library symbols:

/lib/libstdc++.so.5: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/variance.so: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/dejitter.so: 没有那个文件或目录.

Error while reading shared library symbols:

/usr/qpe/lib/linear.so: 没有那个文件或目录.

(gdb) quit

上面的那些错误是因为在ARM上指定路径有的库文件在PC上没有而引起的。

(责任编辑:云子)


[ 发表评论 ] 字体[  ] [ 打印 ] [ 进入博客 ] [ 进入论坛 ]  [ 推荐给朋友 ]
  相关文章
· linux安装过程中需考虑的硬件问题 (09-03) · Redhat Linux系统下安装IE浏览器的方法 (09-03)
· 新手学堂:Fcitx输入法在LumaQQ中的设置 (09-03) · VMware在Linux上安装时内核头文件的问题 (09-03)
· 删除Ubuntu Linux操作系统旧内核的方法 (08-31) · 高手进阶:Linux操作系统的硬盘分区建议 (08-31)
· Ubuntu Linux操作系统安装后的自定义设置 (08-31) · Linux操作系统程序启动引导过程详细剖析 (08-31)
· Linux操作系统下VI编辑器常用命令详细介绍 (08-31) · 新手学堂:嵌入式Linux系统的设计与应用 (08-31)
  客户需求反馈表
* 姓  名:
更多资料  了解方案  认识厂商
* 单位名称:
* 联系电话:
* 电子邮件:
  赛迪推荐  
  手机·资费 ·新品·导购·评测·手机资费·宽带
手机搜索  诺基亚 N73 MOTO Z6
  IT产品 ·笔记本·台式机·服务器·打印·投影
IT产品搜索 
  IT技术 ·开发·网管·安全·数据库·操作系统
  信息化 ·热点·专题·访谈·周刊·方案案例
[政务][电信][金融][农业][制造业][中小企业]
[CIO][ERP][协同][IT管理][中间件][电子商务]
[政策][地方][专家][评估][辞典][博客][社区]
· 专题:一路畅通构想曲——让出行不再遭遇堵车
· CIO工作亲历:企业ERP选型不能忽视"选人关"
· 综述:信息化建设给中国监狱带来的各种变化
· 金融业风险管理和法规遵从有五点需考虑的因素
· 保险业CIO关注:该如何建立统一高效的CRM体系
· 调查显示:多数CIO对IT规划仍存在困惑和误解
  博客·论坛 ·曾剑秋·项立刚·Java学习·网管