建立嵌入式gdb调试环境

本文详细介绍了如何建立嵌入式系统的GDB远程调试环境,包括下载GDB源代码,配置并编译GDB客户端和服务器,以及如何在目标板上运行调试。通过GDBserver,可以在开发工作站上远程调试目标平台上的应用程序,实现跨平台调试。教程中展示了从编译GDB到使用GDBserver进行远程调试的完整步骤。
摘要由CSDN通过智能技术生成

建立嵌入式gdb调试环境

 

.下载gdb-7.1.tar.gz源代码

phil@ubuntu-embedded:~/gdb-7.1$ wget http://ftp.gnu.org/gnu/gdb/gdb-7.1.tar.gz

 

二.编译 GDB

#tar zxvf gdb-7.1.tar.gz

 

2.1 编译GDB Client

phil@ubuntu-embedded:~/gdb-7.1$ cd gdb-7.1/

phil@ubuntu-embedded:~/gdb-7.1$ ./configure --target=arm-linux --prerix=`pwd`/rls

phil@ubuntu-embedded:~/gdb-7.1$ make

phil@ubuntu-embedded:~/gdb-7.1$ make install

phil@ubuntu-embedded:~/gdb-7.1$ ls rls/bin/

arm-linux-gdb  arm-linux-gdbtui  arm-linux-run

phil@ubuntu-embedded:~/gdb-7.1$ file rls/bin/arm-linux-gdb

rls/bin/arm-linux-gdb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped 

 

2.2 编译GDB Server

#cd ./gdb/gdbserver

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

 

三.实战调试

1.编辑文件

# vi gdbtest.c

#include <stdio.h>

 

int

func(int n){

     int   sum=0, i;

     for (i=0; i<n; i++){

         sum += i;

     }

     return sum;

 }

 

 int

 main(void)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值