2013-01-08 120 views
1

我无法前进去查看核心转储。如何查看细分故障(核心转储)

我有这个当我输入

gdb normal_estimation core 


Reading symbols from /home/sai/Documents/pcl_learning/normal_estimation/build/normal_estimation...(no debugging symbols found)...done. 

warning: core file may not match specified executable file. 
[New LWP 11816] 

warning: Can't read pathname for load map: Input/output error. 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". 
Core was generated by `./normal_estimation'. 
Program terminated with signal 11, Segmentation fault. 
#0 0xb53101d6 in free() from /lib/i386-linux-gnu/libc.so.6 
(gdb) 

请让我知道我应该怎么办?

+0

'没有找到调试符号':这是一个提示。在编译代码时启用调试(禁用优化对调试也有很大帮助)。 – vanza

+0

我已经编译使用make的文件。我如何给调试符号 – Sai

+0

不,你已经使用编译器(最可能gcc)编译你的代码。阅读其文档以了解如何使用它。 – vanza

回答

3

程序以信号11终止,分段故障。
#0 0xb53101d6 in free() from /lib/i386-linux-gnu/libc.so.6

你需要学习的第一个命令是backtrace(或它的同义词:where)。

这会告诉你哪个代码调用了free,哪个崩溃了。

但是,该代码可能与实际问题无关:free中的任何崩溃总是由某种类型的堆损坏引起的(释放未分配的内存,释放相同的内存两次,写入内存已被释放,或溢出分配的缓冲区)。

诊断Linux上堆损坏最有用的工具是ValgrindAddressSanitizer。很有可能这些工具会告诉你究竟是你做错了什么。

+0

这是GDB报告。 [使用libthread_db启用线程调试] 使用主机libthread_db库“/lib/i386-linux-gnu/libthread_db.so.1”。核心是由'./normal_estimation'生成的。 程序以信号11结束,分段故障。在obstack.c中的_obstack_allocated_p(h = 0xb5498d18,obj = 0xbfe6ca90)中的 #0 0xb53101d6:341 obstack.c:没有这样的文件或目录。(gdb)bt #0 0xb53101d6在_obstack_allocated_p(h = 0xb5498d18,obj = 0xbfe6ca90)在obstack.c:341 #1 0xbfe6cab0在? () #2 0x08087c5c main() (gdb) – Sai

+0

我试过valgrind,它给出了这个总结。错误摘要:从0的上下文中0错误(压制:0从0) 非法指令(核心倾销) – Sai

+0

还有一件事...当我在网上看到,所有程序都使用g ++或gcc编译,但在这里我有一个CMakeLists。 TXT,因此我做cmake然后制作。所以我无法正确使用网络资源 – Sai