今天总算解决了一个大的bug,爽!

我的程序crash,有了coredump文件,在Linux PC上用arm-linux-gdb debug it. The result is:

#0  0x4022b178 in ?? ()
(gdb) bt
#0  0x4022b178 in ?? ()
#1  0x4022b134 in ?? ()
#2  0x4022b134 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
why? I can't locate the correct location, find the really reason.

看看加载的内容

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"...

warning: core file may not match specified executable file.

warning: .dynamic section for "/lib/libdl.so.2" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/lib/libpthread.so.0" is not at the expected address (wrong library or version mismatch?)
Error while mapping shared library sections:
/lib/libstdc++.so.6: No such file or directory.

warning: .dynamic section for "/lib/libm.so.6" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/lib/libgcc_s.so.1" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/lib/libc.so.6" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/lib/ld-linux.so.2" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/lib/libnss_files.so.2" is not at the expected address (wrong library or version mismatch?)
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Symbol file not found for /lib/libstdc++.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Core was generated by `./6800plusEth.bin'.
Program terminated with signal 11, Segmentation fault.

一些库找不到(/lib/libstdc++.so.6),或者版本不匹配。我不应该加载/lib/libdl..so.... 这些文件,这是针对X86的。

所以两个命令至关重要:

set solib-absolute-prefix -- Set prefix for loading absolute shared library symbol files
set solib-search-path -- Set the search path for loading non-absolute shared library symbol files

比如:set solib-... /usr/local/arm-linux/arm-linux/lib/, 两个参数的值一样就可以了。

先启动arm-linux-gdb,设置变量以后,via core-file load core dump file to analyze it.

#gdb

#set solib-absolute-prefix "library path"

#set solib-search-path "library path"

#file file.debug

#core-file core.1234

但是还是不能准确定位,查询embedded linux版本:

uname -a

ls -l /usr/arm-linux/gcc-3.4.1-glibc-2.3.3/arm-linux/lib/libc-2.3.3.so

Linux PC上的呢:

ll /usr/local/arm/3.4.1/arm-linux/lib/libc-2.3.2.so

原来库文件不对,一个是2.3.3,另一个是2.3.2,此时发现版本匹配是至关的重要啊!!

换了一个Linux PC,它的交叉编译环境是2.3.3

哈哈!立即定位到了错误的原因!!

///

一.关于gdb调试core文件总是一堆问号的问题
问题描述:已经在编译选项中加入了-g,但是查看core文件时,还是一堆问号,使用的命令为:gdb -c core
解决方案:由于gdb -c core这样的使用在有些系统下支持不是很好,所以推荐用如下两种方法:

1)gdb exe
(gdb) core-file core

2)gdb -c core
(gdb) file exe

而其中第二种方法在某些系统上也是不好用的,所以就用第一种即可。

转载于:https://www.cnblogs.com/jlmgary/p/6198307.html

GDB 调试遇到??的问题相关推荐

  1. 使用 GDB 调试多进程程序

    使用 GDB 调试多进程程序 来源 https://www.ibm.com/developerworks/cn/linux/l-cn-gdbmp/index.html GDB 是 linux 系统上常 ...

  2. GDB调试--以汇编语言为例

    #rpm -qa |grep  gdb 下载: 安装 #tar -zxvf #./configure #make 使用GDB 以汇编语言调试为例 汇编语言实现CPUID指令 CPUID cpuid是I ...

  3. GDB 调试 Mysql 实战(二)GDB 调试打印

    背景 在 https://mengkang.net/1328.html 实验中,我们通过optimizer_trace发现group by会使用intermediate_tmp_table,而且里面的 ...

  4. 用gdb调试mpi程序的一些心得

    Linux下MPI (Message Passage Interface) 的程序不太好调试,在windows下vs2005以上的IDE有集成的简便MPI调试工具,没有用过,有兴趣的可以试验一下.下面 ...

  5. gdb php-fpm,使用 gdb 调试 php-fpm 异常错误

    相关资源下载GDB简介 GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具.如果你是在 UNIX平台下做软件,你会发现GDB这个调试工具有比VC.BCB的图形化调试器更强大的功能. 问题 ...

  6. Linux基础 30分钟GDB调试快速突破

    引言 Linus心灵鸡汤 在*nix开发中有道卡叫gdb调试,不管你怎么搞. 它依然在那丝毫不会松动.今天致敬一个 活着的传奇 Linus Torvalds Unix 始于上个世纪60年代,在70年代 ...

  7. SLAM工具|GDB调试从入门到精通

    前言 对于windows平台下,VS下调试简单又方便,那么在linux系统下,该如何进行代码的调试呢? gdb是linux下非常好用的一个调试工具,虽然它是命令行模式的调试工具,但是它的功能非常强大, ...

  8. gdb调试 print打印不出变量值或者不准确

    编译选项加了 -O,即便是-O0,也不能正常显示,需要加上-gstabs+这个编译选项, -gdwarf-2这个编译选项会与-gstabs+冲突,去掉-gstabs+,只保留-gdwarf-2选项可以 ...

  9. 比较全面的gdb调试命令

    用GDB调试程序  GDB是一个强大的命令行调试工具.大家知道命令行的强大就是在于,其可以形成执行序 列,形成脚本.UNIX下的软件全是命令行的,这给程序开发提代供了极大的便利,命令行 软件的优势在于 ...

  10. 20145223《信息安全系统设计基础》 GDB调试汇编堆栈过程分析

    20145223<信息安全系统设计基础> GDB调试汇编堆栈过程分析 分析的c语言源码 生成汇编代码--命令:gcc -g example.c -o example -m32 进入gdb调 ...

最新文章

  1. 这三所985,博士生毕业,不再要求发表论文!
  2. NOIp #2010
  3. 用c语言编写5颗骰子任意投掷总数为15 的概率,概率统计习题1period;2答案
  4. 【转】不用软件,解压Win8/Win8.1的install.wim文件
  5. 协议crc计算_从零了解modbus协议 第三篇
  6. Unity3D学习(五):实现一个简单的视觉感知
  7. ora-01092: oracle 实例终止.强制断开连接,undo表空间故障特殊恢复(二)------ORA-01092: ORACLE 实例终止。强制断开连接...
  8. sql exists和not exists用法
  9. perl 访问类方法的几种方式
  10. qt扫雷鼠标c语言中文网,基于C语言实现的扫雷游戏代码
  11. 算法:还有比二分查找更快的算法,判断是否是子字符串Is Subsequence
  12. html控制树莓派小车,用树莓派来制作简单的遥控小车
  13. 用计算机发射wifi经常很卡,电脑WiFi上网速度慢原因解决办法
  14. 如何去掉广告实现百度精准搜索
  15. bugku bingo题解
  16. python创建子窗口_PyQt5实现从主窗口打开子窗口的方法
  17. 1-2 实验2 点对点通信
  18. win10时间不准_安卓机时间突然变慢10分钟?移动发布回应
  19. 腾讯2019秋招--小q爬塔(dp)
  20. 和chatGPT聊了聊通信,答复如下:

热门文章

  1. OpenCasCade数学库 - 方向(gp_Dir)
  2. 几何画板-如何让某个图像变速运动
  3. 植物2 IOS 怎么实名认证_【植物大战僵尸2国际版最新iOS版】植物大战僵尸2国际版iOS版下载...
  4. 一步步教你从Mysql中读取图片并在网页显示
  5. Vue3留言墙项目——头部和底部静态页面搭建
  6. c9是什么网络语言,RNG惨败C9官博炸了!Gala自闭粉丝想起Uzi语录 阿P感叹C9发文诛心...
  7. ON1 Portrait AI 2022 for Mac – 强大的照片AI智能处理软件
  8. 计算机房要保持清洁 卫生,机房保持卫生整洁标语
  9. Android ExpandableListView (二级列表)
  10. vue中动态配置网站ico和标题