最近,在debug core的时候,发现p 变量的时候提示“No symbol "*" in current context”,我们的代码使用-g编译的,经查有可能是下列几个原因或解决方法:

  1. 使用add-symbol-file将foo.o文件的符号添加至二进制文件中,如下:
    (gdb) add-symbol-file XXXX.o     #提示The address where xxx has been loaded is missing,所以应该还有其他原因
  2. 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原因与解决方法的更多相关文章

  1. [Python Debug]Kernel Crash While Running Neural Network with Keras|Jupyter Notebook运行Keras服务器宕机原因及解决方法

    最近做Machine Learning作业,要在Jupyter Notebook上用Keras搭建Neural Network.结果连最简单的一层神经网络都运行不了,更奇怪的是我先用iris数据集跑了 ...

  2. Play! 1.x Eclipse Debug调试报错解决方法记录

    使用Play eclipsify xxxx[项目路径],可以把play new xxxx[项目路径]创建的工程生成为Eclipse的项目 但是在Debug AS 调试的时候,会报以下错误 Error ...

  3. Jenkins启动时报错:java.net.BindException: Address already in use: bind 解决方法

    下载jenkins.war包后,进入Jenkins.war包目录下,运行java -jar jenkins.war时报端口被占用的错误:java.net.BindException: Address ...

  4. Address already in use的解决方法

    当客户端保持着与服务器端的连接,这时服务器端断开,再开启服务器时会出现: Address already in usr. 可以用netstat -anp | more 可以看到客户端还保持着与服务器的 ...

  5. Myeclipse在启动Tomcat服务器的时候总是进入debug视图的解决方法

    最近调试程序,由于出现过一些错误,在调试的时候,更改过一些东西,但是后来在myeclipse下启动Tomcat服务器的时候,自动的跳入到debug视图了(以前是一启动Tomcat服务器后,直接就加载t ...

  6. log4j中Spring控制台输出Debug级信息过多解决方法

    log4j中Spring控制台输出Debug级信息过多解决方法 >>>>>>>>>>>>>>>>> ...

  7. 关于Ubuntu12.04下code::blocks不能使用debug解决方法

    问题描述:   系统:ubuntu 12.04   code::blocks版本:10.05   问题现象:debug->start        之后出现:warning: GDB: Fail ...

  8. Window8.1 64位无法使用Debug命令的解决方法[附牛人代码]

    偶然看到网上一篇文章,讲的是世界黑客编程大赛第一名的一个很酷的程序,大小仅有4KB,使用debug命令执行. 悲催的是win8.1的debug命令不能使用. 错误例如以下: 解决方法例如以下: 1. ...

  9. OpenCV程序在Debug时出现「PDB文件无法加载」的一个解决方法

    这几天毕设要用到OpenCV,按照网上的教程来搭建开发环境. 用的是OpenCV 3.0 beta + Visual Studio Community 2013.我的系统64位是Win 8.1,但在加 ...

随机推荐

  1. 天猫京东app中常见的上下滚动轮播效果如何实现?

    前段时间,公司安排我制作一个上下滚动轮播效果,类似于我们在天猫京东app中常见的这样: 哇kao!这个我完全不会呀??? 幸好,前几天一个朋友在朋友圈分享了一篇推文.瞬间引领我走出了迷茫,这个教程特别 ...

  2. js多个异步请求,按顺序执行next

    在js里面,偶尔会遇见需要多个异步按照顺序执行请求,又不想多层嵌套,,这里和promise.all的区别在于,promise或者Jquery里面的$.when 是同时发送多个请求,一起返回,发出去的顺 ...

  3. \r\n 回车换行浅析

    \r \ 10 x0a return \n \ x0d newline Unix系统里,每行结尾只有“<换行>”,即“\n”: Windows系统里面,每行结尾是“<回车>&l ...

  4. JS日期格式化扩展

    1.扩展 //扩展日期 Date.prototype.Format = function (fmt) { //author: meizz var o = { , //月份 "d+" ...

  5. 28.json数组,select选择,input输出对应数据

    效果:选择对应的车类,下面的input会实时出现车价. html: <form action="" class="priceModelform1"> ...

  6. 22.用demo通过点击切换图片路径

    用demo通过点击切换图片路径 html: <img src="images/driving.png" class="driving"/> js: ...

  7. 使用vscode编译sass

    如果你想通过命令行来编译的话 可以按照 https://www.sass.hk/ 前往这里按步骤安装,但是在安装淘宝镜像的时候会有问题,安装不成功,于是我就使用vscode来编译sass 第一步,再v ...

  8. Ubuntu系统添加搜狗输入法

    前端开发时有时候要接触到Ubuntu系统,但由于本身没有拼音输入,故需要自己安装搜狗,记录方法如下: 1.安装前先升级资源库并安装输入法依赖包: $sudo apt-get update $sudo ...

  9. es6proxy

    Proxy 支持的拦截操作一览. 对于可以设置.但没有设置拦截的操作,则直接落在目标对象上,按照原先的方式产生结果. (1)get(target, propKey, receiver) 拦截对象属性的 ...

  10. 第零章 HTML启蒙知识与网站开发流程

    Web前端启蒙知识:1.软件架构模式a)B/S架构:Browser-Server 浏览器服务器模型b)C/S架构:Client-Server 客户端服务器模型注1:浏览器是运行网页的应用程序注2:B/ ...