使用Sourcery CodeBech Lite debug Arm/Linux应用程序
来源:互联网 发布:it consultis 编辑:程序博客网 时间:2024/05/21 08:47
简介
本文将使用GDB Server debug 在TQ2440开发板上运行的应用程序。GDB Server以及 Arm/Linux应用程序运行在开发板上,Sourcery Codeench(gdb)运行在host上。这种debug方式的体验与直接使用gdb在本机上debug非常相似。
一. 运行GDB Server
1.前提
a. 把需要debug的应用程序copy到开发板。
b. 安装开发板对应的sysroot,详见:http://blog.csdn.net/lithocntlor/article/details/7688264。安装的位置不同,调用gdbserver的方式也不同。这里主要描述sysroot安装在开发板root之外的其他地方的情形,我安装在/bin/mylib下面。为节省开发板的存储,这里只把需要用到的bin以及lib copy到开发板。
使用tftp把Install path to Sourcery CodeBech/arm-none-linux-gnueabi/libc/armv4t/usr/bin(TQ2440对应的sysroot)下的gdbserver copy到开发板的/bin/mylib目录。然后修改gdbserver的属性:
$ chmod 777 gdbserver
2.在开发板上运行gdbserver
a. sysroot安装在root下
命令:
$ gdbserver :10000 program arg1 arg2 ...
其中10000是gdbserver监听的端口号,可以修改为其他值。program 是被debug的应用程序。arg1 arg2 ...是传给应用程序的command arguemnt。
b. sysroot安装在root之外的其他地方(/bin/mylib)
命令:
$ /bin/mylib/gdbserver :10000 program arg1 arg2 ...
其中各个参数的意义同上。以http://blog.csdn.net/lithocntlor/article/details/7688264中的HelloARM为例:
$ /bin/mylib/gdbserver :10000 /bin/myapp/HelloArm
> Process /bin/myapp/HelloArm created; pid = 801
Listening on port 10000
二. Host上运行gdb连接开发板上的gdbserver
三. debug在Host上运行arm-none-linux-gnueabi-gdb, 命令:
$ arm-none-linux-gnueabi-gdb HelloArm
> GNU gdb (Sourcery CodeBench Lite 2012.03-57) 7.2.50.20100908-cvs
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-pc-linux-gnu --target=arm-none-linux-gnueabi".
For bug reporting instructions, please see:
<https://support.codesourcery.com/GNUToolchain/>...
Reading symbols from /home/leiwu/Projects/arm/HelloArm...done.使用如下命令,连接到开发板上的gdbserver:
(gdb) target remote 192.168.1.6:10000
其中192.168.1.6是开发板的IP,10000是gdbserver的监听端口。
> Remote debugging using 192.168.1.6:10000
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x40000ee0 in ?? ()
(gdb)同时开发板上输出:
>Remote debugging from host 192.168.1.100
表示连接成功,可以开始debug。
与通常使用gdb一样,可以设置断点等等。
(gdb) b main
(gdb) c
另外,编译debug版本的时候需要在gcc命令中加入-g, 例如:
$arm-none-linux-gnueabi-g++ -g -o HelloArm -march=armv4t -Wl,-rpath=/bin/mylib -Wl,--dynamic-linker=/bin/mylib/ld-linux.so.3 main.cpp
- 使用Sourcery CodeBech Lite debug Arm/Linux应用程序
- Sourcery CodeBech Lite安装及使用
- Sourcery CodeBech Lite安装及使用
- Sourcery CodeBech Lite下载
- Sourcery CodeBech Lite安装及使用
- Sourcery CodeBech Lite安装及使用
- Sourcery G++ Lite 一个arm开发工具
- 利用Eclipse和Sourcery G++ Lite通过GDBserver在Windows下单步调试嵌入式Linux应用程序
- Sourcery CodeBench Lite for IA32 GNU/Linux
- Sourcery CodeBench Lite 2011.03-93 for MIPS GNU/Linux
- 使用sourcery g++ lite建立交叉编译环境
- Eclipse+ GNU ARM Eclipse Plug-in+ Sourcery G++ Lite Edition for ARM+OPENCD+Jlink
- 怀疑sourcery G++ Lite版arm-none-eabi-gcc编译错误指令
- Eclipse+ GNU ARM Eclipse Plug-in+ Sourcery G++ Lite Edition for ARM+OPENCD+Jlink的开源开发环境。
- Eclipse+ GNU ARM Eclipse Plug-in+ Sourcery G++ Lite Edition for ARM+OPENCD+Jlink的开源开发环境
- 使用gdbserver+arm-linux-gdb 调试应用程序
- 【转】sourcery g++ lite 建立交叉编译环境
- 使用DS-5编译运行arm-Linux应用程序
- 【学习Android遇到的错误】VBox安装android x86的时候无法连接
- WebSphere
- 8086段地址为什么是16的倍数?
- java常见面试题
- trap linux
- 使用Sourcery CodeBech Lite debug Arm/Linux应用程序
- Android通过http协议POST传输方式
- jquery easyui+ashx+三层框架实现增删改查
- java design pattern - singleton
- iphone开发书籍
- window消息机制
- oracle共享模式与专用模式
- Apache的rewrite规则详细介绍
- token 防止页面重复提交