Re: Strange segfaults of gdb

Terje Eggestad
2002-12-13T00:36:29Z

Hi

Back in April you guys had a short discussion on strange segfaults in
gdb:
http://sources.redhat.com/ml/gdb/2002-04/msg00168.html

It seems that I can reliably reproduce it when you link with pthread.
See below.

It seem that it segfaults on the first or second instruction *byte*, NOT
the next instruction... (according to info registers, just before and
after attempted single step.)

Anyone know whom to report this to?

Running SuSE 8.0.99 beta with the latest gcc,gdb,glibc updates.

Terje

te mjollnir testdl 134> cat main.c
main()
{
int i;

i = 2;
i += 4;
i *= 3;
exit(i);
};

te mjollnir testdl 135> gcc -v
Reading specs from /usr/lib64/gcc-lib/x86_64-suse-linux/3.2.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64
--enable-languages=c,c++,f77,objc,java,ada --enable-libgcj
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit
x86_64-suse-linux
Thread model: posix
gcc version 3.2.1 20021002 (prerelease) (SuSE Linux)
te mjollnir testdl 136> gcc -g -o main main.c
te mjollnir testdl 137> gdb main
GNU gdb 5.2.1
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "x86_64-suse-linux"...
(gdb) break main
Breakpoint 1 at 0x400460: file main.c, line 5.
(gdb) run
Starting program: /home/te/test/testdl/main

Breakpoint 1, main () at main.c:5
5 i = 2;
(gdb) n
6 i += 4;
(gdb)
7 i *= 3;
(gdb)
8 exit(i);
(gdb)

Program exited with code 022.
(gdb) q
te mjollnir testdl 138> gcc -g -o main main.c -lpthread
te mjollnir testdl 139> gdb -q main
(gdb) break main
Breakpoint 1 at 0x4004a0: file main.c, line 5.
(gdb) run
Starting program: /home/te/test/testdl/main
[New Thread 1024 (LWP 6458)]
[Switching to Thread 1024 (LWP 6458)]

Breakpoint 1, 0x004004a1 in main () at main.c:5
5 i = 2;
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x004004a3 in main () at main.c:5
5 i = 2;
(gdb) q
The program is running. Exit anyway? (y or n) y
te mjollnir testdl 140>

--
_________________________________________________________________________

Terje Eggestad mailto:terje.eggestad@scali.no
Scali Scalable Linux Systems http://www.scali.com

Olaf Helsets Vei 6 tel: +47 22 62 89 61 (OFFICE)
P.O.Box 150, Oppsal +47 975 31 574 (MOBILE)
N-0619 Oslo fax: +47 22 62 89 51
NORWAY
_________________________________________________________________________