Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: Strange segfaults of gdb
@ 2002-12-12 16:36 Terje Eggestad
  2002-12-13  9:59 ` Michal Ludvig
  0 siblings, 1 reply; 10+ messages in thread
From: Terje Eggestad @ 2002-12-12 16:36 UTC (permalink / raw)
  To: Michal Ludvig, Eli Zaretskii, Michael Snyder; +Cc: gdb

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            
_________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Strange segfaults of gdb
@ 2002-04-11  9:12 Michal Ludvig
  2002-04-11 14:43 ` Michael Snyder
  2002-04-12  2:13 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Michal Ludvig @ 2002-04-11  9:12 UTC (permalink / raw)
  To: gdb

Hi all,
I've spent several days with chasing gdb segfaults on x86-64 but had no 
luck. So I'm finally asking here for any suggestions, opinions, hints, 
just anything that could move me forward.
The problem is, that when I print anything using a 'print' command, or 
info or maybe some others, and then want to run or step the debugged 
program, the gdb segfaults:

# ./gdb ~/mludvig/tst/xmmtest
GNU gdb 2002-04-04-cvs
[...]
This GDB was configured as "x86_64-unknown-linux-gnu"...
Setting up the environment for debugging gdb.
.gdbinit:3: Error in sourced command file:
Function "internal_error" not defined.
(gdb) br 10
Breakpoint 1 at 0x4004d8: file xmmtest.c, line 10.
(gdb) r
Starting program: /root/mludvig/tst/xmmtest

Breakpoint 1, main () at xmmtest.c:10
10              printf("v1=%f, v2=%f, v3=%e\n", v1, v2, v3);
(gdb) p 1
$1 = 1
(gdb) c
Continuing.
Segmentation fault (core dumped)

It doesn't matter which program I run, what I want to print and if I 
then want invoke 'run', 'continue' or even 'si'. It segfaults. Core file 
doesn't give any reasonable informations.
This segfault also happens when I leave 'set complaints 1' in .gdbinit 
in sourcedir, run gdb from there and then try to run a debugged program. 
  Unfortunately it is perfectly reproductable :-(

Does anybody have an idea how print, set and step can be related?
I really don't know...

Thanks for any ideas

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* +420 2 9654 5373   * http://www.suse.cz


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-12-14 14:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-12 16:36 Strange segfaults of gdb Terje Eggestad
2002-12-13  9:59 ` Michal Ludvig
     [not found]   ` <1039817373.10496.19.camel@eggis1>
2002-12-14  6:09     ` Michal Ludvig
  -- strict thread matches above, loose matches on Subject: below --
2002-04-11  9:12 Michal Ludvig
2002-04-11 14:43 ` Michael Snyder
2002-04-12  2:13 ` Eli Zaretskii
2002-04-12  4:27   ` Michal Ludvig
2002-04-12  5:05     ` Eli Zaretskii
2002-04-16 11:16     ` Michael Snyder
2002-04-17  3:12       ` Michal Ludvig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox