Segfault weirdness



This is a strange segfault.  Is it a bug in GTK+, or something weird with
my xlib, or what??

Code snippet:

int main(int argc, char *argv[])
{
     fprintf(stderr,"Initializing GTK+...\n");
     fflush(stderr);

     /* Init GTK+ for toolbox options and such */
     gtk_init(&argc, &argv);

(snip)

compiles flawlessly with the command
gcc -Wall -g `gtk-config --cflags --libs` test.c -o test

$ ./test
Initializing GTK+...
Segmentation fault (core dumped)

$ gdb test core
<snip license stuff>
Core was generated by `./test'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libgtk-1.2.so.0...done.
Reading symbols from /usr/lib/libgdk-1.2.so.0...done.
Reading symbols from /usr/lib/libgmodule-1.2.so.0...done.
Reading symbols from /usr/lib/libglib-1.2.so.0...done.
Reading symbols from /lib/libdl.so.2...done.
Reading symbols from /usr/X11R6/lib/libXext.so.6...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0  0x805f1dc in socket ()
(gdb) backtrace
#0  0x805f1dc in socket ()
#1  0x401eda3d in _X11TransSocketOpen () from /usr/X11R6/lib/libX11.so.6
#2  0x401edb77 in _X11TransSocketOpenCOTSClient ()
   from /usr/X11R6/lib/libX11.so.6
#3  0x401eee24 in _X11TransOpen () from /usr/X11R6/lib/libX11.so.6
#4  0x401eef7b in _X11TransOpenCOTSClient () from
/usr/X11R6/lib/libX11.so.6
#5  0x401b90a1 in _X11TransConnectDisplay () from
/usr/X11R6/lib/libX11.so.6
#6  0x401c6d84 in XOpenDisplay () from /usr/X11R6/lib/libX11.so.6
#7  0x40145255 in gdk_init_check () from /usr/lib/libgdk-1.2.so.0
#8  0x400a5326 in gtk_init_check () from /usr/lib/libgtk-1.2.so.0
#9  0x400a572d in gtk_init () from /usr/lib/libgtk-1.2.so.0
#10 0x8048f81 in main (argc=1, argv=0xbffffb94) at test.c:48
(gdb) frame
#0  0x805f1dc in socket ()
(gdb) quit

[x@localhost test]$ rpm -q gtk+ glib XFree86-libs XFree86 gdb egcs glibc ;
uname -a
gtk+-1.2.6-1
glib-1.2.6-1
XFree86-libs-3.3.5-3
XFree86-3.3.5-3
gdb-4.18-4
egcs-1.1.2-24
glibc-2.1.2-11
Linux localhost.localdomain 2.3.15 #1 Fri Aug 27 20:29:24 EDT 1999 i686
unknown

Anybody have a clue what's up with that?  The socket() call?  I wasn't
aware that the socket() call ever could cause a segfault.

David

http://opop.nols.com/index.shtml - Linux software development
There are three kinds of people:  Those who can count, and those who can't.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]