arm-linux-gdb+gdbserver环境搭建以及远程调试

简介: 0) gdb源码下载:http://ftp.gnu.org/gnu/gdb/ 1) 编译arm-linux-gdb     指定交叉编译工具链的位置     export PATH=$PATH:/usr/local/arm/3.

0) gdb源码下载:http://ftp.gnu.org/gnu/gdb/

1) 编译arm-linux-gdb

    指定交叉编译工具链的位置

    export PATH=$PATH:/usr/local/arm/3.4.1/bin
    开始配置和编译

    $cd gdb-6.6
    $./configure --target=arm-linux --prefix=/usr/local/arm/gdb -v
   $make
   

中间会出现一些地方编译过去,如

gdb declared with attribute warn_unused_result

 检查了下,发现是由于检查太严格了,把 Makefile 里面 -Wall 类似的强制警告检查都去掉就可以过了

 

2) 编译gdbserver
    $cd gdb/gdbserver
    $./configure --target=arm-linux --host=arm-linux
      target含义同前,host指明编译生成的gdbserver运行在arm-linux上,前者没有设定host的原因是
      arm-linux-gdb是在pc linux上运行的,就像arm-linux-gcc (很好理解的:))
    $
make CC=/usr/local/arm/3.4.1/bin/arm-linux-gcc

 

   #gdbserver 192.168.1.200:7777 test
     Process test created; pid                                                                                   
     Listening on port 7777

   主机shell下
   $cd ~/tftpboot
   $arm-linux-gdb test
    GNU gdb 6.6 
    Copyright (C) 2006 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)
    注意一下显示信息的最后--host=i686-pc-linux-gnu --target=arm-linux,明白了吧。。。
    target remote 192.168.1.168:7777   --连接gdbserver
    Remote debugging using 192.168.1.168:7777
    0x40000dd0 in _start () from /lib/ld-linux.so.2
    表示连接上了服务器,:),接下来就可以调试了。arm-linux-gdb和GDB的用法一样,只是没有r这个命   
   令,运行程序用c命令。
    (gdb) l
   1       #include<stdio.h>
   2
   3       int main()
   4       {
   5               char *ptr = "csdn";
   6               printf("%c/n",*(ptr++));
   7               return 0;
   8       }
    (gdb) b 3
   Breakpoint 1 at 0x83d0: file test.c, line 3.

   另外由于程序是在目标板上运行,调试是在PC下,程序的结果还是会在目标板上显示的, 
   例如:minicom,lcd等。
   btw,附近一篇介绍GDB使用的文章:http://blog.csdn.net/haoel/archive/2003/07.aspx,这下全了吧。哈

相关实践学习
阿里云图数据库GDB入门与应用
图数据库(Graph Database,简称GDB)是一种支持Property Graph图模型、用于处理高度连接数据查询与存储的实时、可靠的在线数据库服务。它支持Apache TinkerPop Gremlin查询语言,可以帮您快速构建基于高度连接的数据集的应用程序。GDB非常适合社交网络、欺诈检测、推荐引擎、实时图谱、网络/IT运营这类高度互连数据集的场景。 GDB由阿里云自主研发,具备如下优势: 标准图查询语言:支持属性图,高度兼容Gremlin图查询语言。 高度优化的自研引擎:高度优化的自研图计算层和存储层,云盘多副本保障数据超高可靠,支持ACID事务。 服务高可用:支持高可用实例,节点故障迅速转移,保障业务连续性。 易运维:提供备份恢复、自动升级、监控告警、故障切换等丰富的运维功能,大幅降低运维成本。 产品主页:https://www.aliyun.com/product/gdb
目录
相关文章
|
2月前
|
Ubuntu Linux 开发工具
Linux下的IMX6ULL——环境搭建与软件安装(一)
Linux下的IMX6ULL——环境搭建与软件安装(一)
64 0
Linux下的IMX6ULL——环境搭建与软件安装(一)
|
5月前
|
关系型数据库 MySQL Linux
linux环境搭建mysql5.7总结
linux环境搭建mysql5.7总结
61 0
|
4月前
|
SQL 数据可视化 Linux
ClickHouse【环境搭建 03】Linux环境离线安装 clickhouse-22.3.3.44 配置参数说明+可视化界面使用(离线安装文件分享百度云盘)
ClickHouse【环境搭建 03】Linux环境离线安装 clickhouse-22.3.3.44 配置参数说明+可视化界面使用(离线安装文件分享百度云盘)
103 0
|
1月前
|
Java Linux
Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
【2月更文挑战第16天】Flume【环境搭建 01】CentOS Linux release 7.5 安装配置 apache-flume-1.9.0 并验证
29 0
|
1月前
|
网络协议 Ubuntu Linux
如何在Linux环境搭建本地SVN服务器并结合cpolar实现公网访问
如何在Linux环境搭建本地SVN服务器并结合cpolar实现公网访问
|
5月前
|
Ubuntu Linux 网络安全
1. Linux环境搭建及创建共享文件的方法
1. Linux环境搭建及创建共享文件的方法
151 1
|
2月前
|
Java Linux 网络安全
【极数系列】Flink环境搭建&Linux版本 (03)
【极数系列】Flink环境搭建&Linux版本 (03)
|
4月前
|
Unix Linux 程序员
ClickHouse【环境搭建 01】Linux环境单机版在线安装 Code:210.DB::NetException + Init script is already running 问题处理
ClickHouse【环境搭建 01】Linux环境单机版在线安装 Code:210.DB::NetException + Init script is already running 问题处理
59 0
|
4月前
|
Java Linux Go
Golang环境搭建指南(Windows和linux)
Golang环境搭建指南(Windows和linux)
39 0
|
4月前
|
Linux 数据安全/隐私保护 虚拟化
Linux 环境搭建以及xshell远程连接
Linux 环境搭建以及xshell远程连接