kde8
kde8

Reputation: 331

segmentation fault in C, core dumped, gdb output

I have this C code that ran fine until upgrading my system to Scientific Linux 6. It has some OpenGL stuff, and it's compiling in gcc with these options

-lncurses -lX11 -lGL -lm -g 

but then it seg faults. Following this post I get this

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

I tried the debuginfo install but got this message:

No debuginfo packages available to install

Upvotes: 0

Views: 1619

Answers (2)

Luke Walsh
Luke Walsh

Reputation: 281

From your command line enter the following commands: gdb [program name] This will open the gdb debugger. run [command line arguments] Now the program will seg fault. backtrace This will show you where your program crashed.

Upvotes: 1

Colin D Bennett
Colin D Bennett

Reputation: 12084

Try actually running the program with gdb, not just loading the core file up. It might be more helpful. Also you can try using valgrind to run it: it's a fabulous tool for memory debugging. Even without the debuginfo you can hopefully find out what line in your source file is triggering the crash.

Make sure you compile your program with debugging enabled (gcc -ggdb).

Upvotes: 1

Related Questions