GDB 调试遇到??的问题
今天总算解决了一个大的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
而其中第二种方法在某些系统上也是不好用的,所以就用第一种即可。
GDB 调试遇到??的问题的更多相关文章
- GDB调试命令小结
1.启动调试 前置条件:编译生成执行码时带上 -g,如果使用Makefile,通过给CFLAGS指定-g选项,否则调试时没有符号信息.gdb program //最常用的用gdb启动程序,开始调试的方 ...
- GDB调试汇编堆栈过程分析
GDB调试汇编堆栈过程分析 分析过程 这是我的C源文件:click here 使用gcc - g example.c -o example -m32指令在64位的机器上产生32位汇编,然后使用gdb ...
- gdb调试器的使用
想要使用gdb调试程序的话,首先需要gcc -g main.c -o test 然后运行gdb test对程序进行调试 l (小写的l,是list的首字母),用以列出程序 回车 是运行上一个命令 ...
- 20145212——GDB调试汇编堆栈过程分析
GDB调试汇编堆栈过程分析 测试代码 #include <stdio.h> short val = 1; int vv = 2; int g(int xxx) { return xxx + ...
- gdb调试PHP扩展错误
有时候,使用PHP的第三方扩展之后,可能会发生一些错误,这个时候,可能就需要更底层的方式追踪调试程序发生错误的地方和原因,熟悉linux下C编程的肯定不陌生gdb 首先,使用ulimit -c命令,查 ...
- gdb调试汇编堆栈过程的学习
gdb调试汇编堆栈过程的学习 以下为C源文件 使用gcc - g code.c -o code -m32指令在64位的机器上产生32位汇编,然后使用gdb example指令进入gdb调试器: 进入之 ...
- gdb调试
·代码(实验楼中的代码,改了部分数值)命名为test.c int g(int x) { return x + 7; } int f(int x) { return g(x); } int main(v ...
- 20145223《信息安全系统设计基础》 GDB调试汇编堆栈过程分析
20145223<信息安全系统设计基础> GDB调试汇编堆栈过程分析 分析的c语言源码 生成汇编代码--命令:gcc -g example.c -o example -m32 进入gdb调 ...
- GDB调试汇编堆栈
GDB调试汇编堆栈 分析过程 C语言源代码 int g(int x) { return x+6; } int f(int x) { return g(x+1); } int main(void) { ...
- 赵文豪 GDB调试汇编堆栈过程分析
GDB调试汇编堆栈过程分析 使用gcc - g example.c -o example -m32指令在64位的机器上产生32位汇编,然后使用gdb example指令进入gdb调试器: 使用gdb调 ...
随机推荐
- centos安装与卸载postgresql
1.卸载旧版本postgresql $ yum remove postgresql* 2.更新yum $ yum update 3.下载pgdg-centos92-9.2-6.noarch.rpm,或 ...
- Oracle优化总结
本文主要从大型数据库ORACLE环境四个不同级别的调整分析入手,分析ORACLE的系统结构和工作机理,从九个不同方面较全面地总结了ORACLE数据库的优化调整方案.关键词 ORACLE数据库 环境调整 ...
- Mac安装windows虚拟机攻略
5月初从阿里滚粗,然后失去了公司发的Mac Air.说实话Mac机器确实比windows好用一些,于是怒而买了一个Mac Pro. 结果一个星期后我从学校带出来的联想笔记本又被老师通知要进行固定资产盘 ...
- linux下JDK1.7安装
http://mnt.conf.blog.163.com/blog/static/115668258201210793915876/ 一.软件下载1.下载JDK(下面分别是32位系统和64位系统下的版 ...
- 今天我看了一个H5游戏EUI的例子,我都快分不清我到底是在用什么语言编译了代码了,作为刚刚学习H5游戏开发的菜鸟只能默默的收集知识
今天看了一个EUI的demo,也是接触H5游戏开发的第五天了,我想看看我能不能做点什么出来,哎,自己写果然还是有问题的.在看EUI哪一个demo的时候就遇见了一些摇摆不定的问题,我觉得提出来 1.to ...
- git 版本控制
用gitbash进入类似命令行的窗口 用命令 cd e:/learngit 进入该目录,然后在此目录下初始化$ git init, 于是该文件夹就成为了一个工作区,里面的.git文件就是版本库(rep ...
- zend studio 的使用
1.将php项目导入到zend studio 中的方式为:http://my.oschina.net/maomi/blog/86077: 2.zend studio中将php项目导出的方式为:如果你会 ...
- Telnet弱口令猜解【Python脚本】
telnet 弱口令猜解脚本 测试环境:window2003.centos7 #! /usr/bin/env python # _*_ coding:utf-8 _*_ import telnetli ...
- String、StringBuffer和StringBuilder的深入解析
今天闲来无事,整理了下平时记录在印象笔记里的java开发知识点,整理到String,StringBuffer以及StringBuilder的区别时突然又产生了新的疑惑,这些区别是怎么产生的?温故为何能 ...
- [WARNING]考前必读?!
考试策略很重要. 1) 认真读懂每道题,把题意搞明白,把样例算出来,把题目要求的细节标出. 2) 推出每道题的模型,确定每道题的策略,是部分分还是要全部 ...