The address where a.out.debug has been loaded is missing以及No symbol "*" in current context原因与解决方法
最近,在debug core的时候,发现p 变量的时候提示“No symbol "*" in current context”,我们的代码使用-g编译的,经查有可能是下列几个原因或解决方法:
- 使用add-symbol-file将foo.o文件的符号添加至二进制文件中,如下:
(gdb) add-symbol-file XXXX.o #提示The address where xxx has been loaded is missing,所以应该还有其他原因 - gdb的版本低于gcc的版本,环境中使用的gcc是4.8.5,gdb是7.6.2,gdb发布之间早于gcc,所以升级gdb到7.10,兼容性可参考https://www.cnblogs.com/zhjh256/p/9367852.html
注:make gdb的时候可能会出现/gdb-7.10/missing: line 81: makeinfo: command not found,makeinfo在textinfo中
yum install texinfo
可能会提示zlib 1.2.3.3缺少,baidu搜下应该就可以解决。
编译7.10过程中,出现异常如下:
ser-unix.c:119:43: warning: 'struct hardwire_ttystate' declared inside parameter list [enabled by default]
get_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c:119:1: error: conflicting types for 'get_tty_state'
get_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c:88:12: note: previous declaration of 'get_tty_state' was here
static int get_tty_state (struct serial *scb,
^
ser-unix.c: In function 'get_tty_state':
ser-unix.c:146:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
ser-unix.c: At top level:
ser-unix.c:149:43: warning: 'struct hardwire_ttystate' declared inside parameter list [enabled by default]
set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c:149:1: error: conflicting types for 'set_tty_state'
set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c:90:12: note: previous declaration of 'set_tty_state' was here
static int set_tty_state (struct serial *scb,
^
ser-unix.c: In function 'set_tty_state':
ser-unix.c:176:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
ser-unix.c: In function 'hardwire_get_tty_state':
ser-unix.c:183:56: error: dereferencing pointer to incomplete type
state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
^
ser-unix.c:185:3: warning: passing argument 2 of 'get_tty_state' from incompatible pointer type [enabled by default]
if (get_tty_state (scb, state))
^
ser-unix.c:119:1: note: expected 'struct hardwire_ttystate *' but argument is of type 'struct hardwire_ttystate *'
get_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c: In function 'hardwire_copy_tty_state':
ser-unix.c:199:56: error: dereferencing pointer to incomplete type
state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
^
ser-unix.c:200:3: error: dereferencing pointer to incomplete type
*state = *(struct hardwire_ttystate *) ttystate;
^
ser-unix.c:200:12: error: dereferencing pointer to incomplete type
*state = *(struct hardwire_ttystate *) ttystate;
^
ser-unix.c: In function 'hardwire_set_tty_state':
ser-unix.c:212:3: warning: passing argument 2 of 'set_tty_state' from incompatible pointer type [enabled by default]
return set_tty_state (scb, state);
^
ser-unix.c:149:1: note: expected 'struct hardwire_ttystate *' but argument is of type 'struct hardwire_ttystate *'
set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
^
ser-unix.c: In function 'hardwire_noflush_set_tty_state':
ser-unix.c:220:28: error: storage size of 'new_state' isn't known
struct hardwire_ttystate new_state;
^
ser-unix.c:225:15: error: dereferencing pointer to incomplete type
new_state = *(struct hardwire_ttystate *) new_ttystate;
^
ser-unix.c: In function 'hardwire_drain_output':
ser-unix.c:335:1: warning: no return statement in function returning non-void [-Wreturn-type]
有个帖子说“编译过程中遇到莫名奇妙的报错,例如:ser-unix.c:118:1: error: conflicting types for ‘get_tty_state’,清理干净configure目录,使用root用户安装就好”,试了下不行。
换了一台测试服务器,直接编译,没有报错。
注:上下文中没有符号这个问题除了可能和gdb版本有关系外,还有可能我们要查看的变量的上下文不在给定的栈帧中,也就是不在相关的函数上下文,此时要通过frame N进入指定的帧,如下:

参考:
https://blog.csdn.net/hanchengxi/article/details/50380819
https://blog.csdn.net/sinat_24820331/article/details/54579913
The address where a.out.debug has been loaded is missing以及No symbol "*" in current context原因与解决方法的更多相关文章
- [Python Debug]Kernel Crash While Running Neural Network with Keras|Jupyter Notebook运行Keras服务器宕机原因及解决方法
最近做Machine Learning作业,要在Jupyter Notebook上用Keras搭建Neural Network.结果连最简单的一层神经网络都运行不了,更奇怪的是我先用iris数据集跑了 ...
- Play! 1.x Eclipse Debug调试报错解决方法记录
使用Play eclipsify xxxx[项目路径],可以把play new xxxx[项目路径]创建的工程生成为Eclipse的项目 但是在Debug AS 调试的时候,会报以下错误 Error ...
- Jenkins启动时报错:java.net.BindException: Address already in use: bind 解决方法
下载jenkins.war包后,进入Jenkins.war包目录下,运行java -jar jenkins.war时报端口被占用的错误:java.net.BindException: Address ...
- Address already in use的解决方法
当客户端保持着与服务器端的连接,这时服务器端断开,再开启服务器时会出现: Address already in usr. 可以用netstat -anp | more 可以看到客户端还保持着与服务器的 ...
- Myeclipse在启动Tomcat服务器的时候总是进入debug视图的解决方法
最近调试程序,由于出现过一些错误,在调试的时候,更改过一些东西,但是后来在myeclipse下启动Tomcat服务器的时候,自动的跳入到debug视图了(以前是一启动Tomcat服务器后,直接就加载t ...
- log4j中Spring控制台输出Debug级信息过多解决方法
log4j中Spring控制台输出Debug级信息过多解决方法 >>>>>>>>>>>>>>>>> ...
- 关于Ubuntu12.04下code::blocks不能使用debug解决方法
问题描述: 系统:ubuntu 12.04 code::blocks版本:10.05 问题现象:debug->start 之后出现:warning: GDB: Fail ...
- Window8.1 64位无法使用Debug命令的解决方法[附牛人代码]
偶然看到网上一篇文章,讲的是世界黑客编程大赛第一名的一个很酷的程序,大小仅有4KB,使用debug命令执行. 悲催的是win8.1的debug命令不能使用. 错误例如以下: 解决方法例如以下: 1. ...
- OpenCV程序在Debug时出现「PDB文件无法加载」的一个解决方法
这几天毕设要用到OpenCV,按照网上的教程来搭建开发环境. 用的是OpenCV 3.0 beta + Visual Studio Community 2013.我的系统64位是Win 8.1,但在加 ...
随机推荐
- Dotfuscator代码混淆工具的使用
关于Dotfuscator,VS自带了一个社区版的源代码保护工具,不过它只有基本的混淆命名的功能.专业版功能很多,可以混淆流程,密字符串,加入水印,程序签名等. 工具/原料 Dotfuscator ...
- curl不能支持https问题
前面说了 update nss 并没有解决问题. 想办法重新安装一下:CURL 1.下载安装包 [root@mycentos ~]# wget https://curl.haxx.se/downloa ...
- servlet 的servletconfig
- 如何使用github来查找自己需要的(关心的)项目
1.登录github官网 输入用户名密码后会显示下面的界面 2.点击explore git hub 然后你会看到下面的页面 3.下面的或许有你想要的项目 点击Treding 可以查看最近火的项目仓库 ...
- phpcs
phpcs(代码规范) https://juejin.im/post/5b18fdeb6fb9a01e573c3cb3 https://laravel-china.org/docs/psr/psr-2 ...
- uvm设计分析——field automation
uvm中的field_automation主要实现了class中的基础元素的copy,compare等函数, 实现方式分为两种:1)用户注册,field系列宏:uvm内部调用static status ...
- STL算法中函数对象和谓词
函数对象和谓词定义 函数对象: 重载函数调用操作符的类,其对象常称为函数对象(function object),即它们是行为类似函数的对象.一个类对象,表现出一个函数的特征,就是通过“对象名+(参数列 ...
- Yii2 nginx配置伪静态
Yii2 配置 Nginx 伪静态 主要检查以下代码: location / { # Redirect everything that isn't a real file to index.php t ...
- html5-样式表的使用-初步
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- D Tree Requests dfs+二分 D Pig and Palindromes -dp
D time limit per test 2 seconds memory limit per test 256 megabytes input standard input output stan ...