我有这个C代码运行正常,直到将我的系统升级到Scientific Linux 6.它有一些OpenGL的东西,它用gcc编译这些选项
-lncurses -lX11 -lGL -lm -g
然后它会出现故障。关注this post我得到了这个
bash-4.1$ gdb test core.5593
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/kde8/test...(no debugging symbols found)...done.
[New Thread 5593]
Missing separate debuginfo for
Try: yum --disablerepo='*' --enablerepo='*-debug*' install /usr/lib/debug/.build-id/50/fc20fea18a6f375789f0f86e28f463d50714fd
Reading symbols from /usr/lib64/libX11.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libX11.so.6
Reading symbols from /usr/lib64/nvidia/libGL.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/nvidia/libGL.so.1
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libncurses.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib64/libncurses.so.5
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libtinfo.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib64/libtinfo.so.5
Reading symbols from /usr/lib64/libxcb.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libxcb.so.1
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /usr/lib64/nvidia/libGLcore.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/nvidia/libGLcore.so.1
Reading symbols from /usr/lib64/nvidia/tls/libnvidia-tls.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/nvidia/tls/libnvidia-tls.so.1
Reading symbols from /usr/lib64/libXext.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libXext.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/libXau.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libXau.so.6
Core was generated by `./test'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000408169 in InitConds ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64 libX11-1.5.0-4.el6.x86_64 libXau-1.0.6-4.el6.x86_64 libXext-1.3.1-2.el6.x86_64 libxcb-1.8.1-1.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64
我尝试了debuginfo安装,但收到了这条消息:
No debuginfo packages available to install
答案 0 :(得分:1)
尝试使用gdb
实际运行程序,而不仅仅是加载核心文件。它可能会更有帮助。您也可以尝试使用valgrind
来运行它:它是内存调试的绝佳工具。即使没有debuginfo,您也可以找到源文件中的哪一行触发崩溃。
确保在启用调试(gcc -ggdb
)的情况下编译程序。
答案 1 :(得分:1)
从命令行输入以下命令:
gdb [program name]
这将打开gdb调试器。
run [command line arguments]
现在该程序将出现故障。
backtrace
这将显示程序崩溃的位置。