Ubuntu16.04 安装更新gdb9.2调试工具

参考博文:

https://blog.csdn.net/qq_36490086/article/details/85246107

https://e2e.ti.com/support/legacy_forums/embedded/linux/f/354/t/327776?gdb-gdbserver-error-shared-library-arch-not-compatible-with-target-arch-i386

本文主要是参考上述博主的文章的安装方法安装最新的的gdb9.2的步骤:

wget http://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.xz
tar -xf gdb-9.2.tar.xz     
cd gdb-9.2/     

此时我们位于解压出的源码的目录,需要在当前目录下创建一个build目录以执行configure脚本,但是需要注意,configure的时候需要写上编译代码时用到的工具链  --target=arm-xxxx,如我当前使用的平台是RK3xxx,编译链是arm-rockchip-linux-gnueabihf ,步骤如下:

mkdir build
cd ./build
../configure  --target=arm-rockchip-linux-gnueabihf   

如果执行该配置脚本时没有指定编译工具链,则在gdb debug Core文件的时候出现如下问题:

warning: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/libnetutils.so': Shared library architecture unknown is not compatible with target architecture i386.
warning: `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/libnetutils.so': Shared library architecture unknown is not compatible with target architecture i386.
Reading symbols from /xxxxxxxxxxxxxxx/libnetutils.so...
(gdb) 
(gdb) 
(gdb) break
No default breakpoint address now.
(gdb) backtrace 
#0  <unavailable> in ?? ()
Backtrace stopped: not enough registers or memory available to unwind further
(gdb) q

然后脚本就会开始配置,终端开始打印一些log,这个脚本执行完毕后会在build目录下生成makefile:

该脚本执行完毕后,仍旧在build目录下执行make,以生成gdb执行文件

make

make完毕后在build文件夹下生成Makefile,执行sudo make install 编译出gdb 

sudo make install

编译完毕后会生成gdb的二进制文件,拷贝到用户bin目录

sudo cp ./gdb/gdb /usr/local/bin/gdb

执行该句完毕后执行gdb -v查看是否安装成功,如安装成功,则有如下打印

GNU gdb (GDB) 9.2
Copyright (C) 2020 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.

 

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值