From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16004 invoked by alias); 22 Apr 2010 13:03:52 -0000 Received: (qmail 15699 invoked by uid 22791); 22 Apr 2010 13:03:44 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Apr 2010 13:03:38 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3MD3DF1036968 ; Thu, 22 Apr 2010 15:03:13 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [IPv6:2001:660:2402:d::10]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o3MD3C0N042134 ; Thu, 22 Apr 2010 15:03:12 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o3MD3Beg024026 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Thu, 22 Apr 2010 15:03:12 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Joel Brobecker'" Cc: References: <000f01cad75b$b53278a0$1f9769e0$@muller@ics-cnrs.unistra.fr> <20100412155453.GW19194@adacore.com> <000001cada5c$49b8e1a0$dd2aa4e0$@muller@ics-cnrs.unistra.fr> <20100413152823.GG19194@adacore.com> <20100421151117.GA13675@adacore.com> <001501cae197$280ca8b0$7825fa10$@muller@ics-cnrs.unistra.fr> <20100422011119.GF19194@adacore.com> <001001cae205$59a6fbf0$0cf4f3d0$@muller@ics-cnrs.unistra.fr> <20100422122012.GI19194@adacore.com> In-Reply-To: <20100422122012.GI19194@adacore.com> Subject: RE: [RFA-v2] Fix bug report 11479 Date: Thu, 22 Apr 2010 13:03:00 -0000 Message-ID: <001901cae21c$2bc605c0$83521140$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00749.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Joel Brobecker > Envoy=E9=A0: Thursday, April 22, 2010 2:20 PM > =C0=A0: Pierre Muller > Cc=A0: gdb-patches@sourceware.org > Objet=A0: Re: [RFA-v2] Fix bug report 11479 >=20 > > 2010-04-22 Pierre Muller > > > > PR stabs/11479. > > * stabsread.c (set_length_in_type_chain): New function. > > (read_struct_type): Call set_length_in_type_chain function. > > (read_enum_type): Idem. >=20 > The code portion is pre-approved with the comments below. Just go ahead > and check it in. Thanks, I did commit this part with your detailed comment. =20 > > 2010-04-22 Pierre Muller > > > > PR stabs/11479. > > * gdb.stabs/gdb11479.exp: New file. > > * gdb.stabs/gdb11479.c: New file. >=20 > This portion can be checked in separately after we answer the few > questions > I have (see below). > > + Please email any bugs, comments, and/or additions to this file > to: > > + bug-gdb@gnu.org */ >=20 > Can you remove this bit? Done.=20 > > +# Please email any bugs, comments, and/or additions to this file to: > > +# bug-gdb@gnu.org >=20 > Same for this one... OK.=20 > > +set testfile "gdb11479" > > +set srcfile ${testfile}.c > > +set binfile ${objdir}/${subdir}/${testfile} > > +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" > executable > > {debug additional_flags=3D-gstabs}] !=3D "" } { > > + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" > > executable {debug}] !=3D "" } { > > + untested "couldn't compile ${srcdir}/${subdir}/${srcfile}" > > + return -1 > > + } > > +} > > + > > +# Start with a fresh gdb. > > +gdb_exit > > +gdb_start > > +gdb_reinitialize_dir $srcdir/$subdir > > +gdb_load ${binfile} >=20 > Can you actually use "prepare_for_testing" here? The only thing that > is a bit out of the ordinary is request the -gstabs debug flag. I am > actually wondering if we really want that, since this may not work on > certain platforms while we might still want to use the test with the > default debug format.=20=20 This is a stabs specific bug, when I first tried to test it on gcc16 from the compile farm, I got no difference in the output. This was due to the fact that gcc16 is a 64-bit linux machine and as such uses dwarf debug format by default. So I thought, why not try to force using stabs debugging, and fall back to normal compilation if this fails. >On the other hand, you probably want to make sure > that your test gets run with -gstabs on Windows, so we have two > incompatible objectives... >=20 > How's about we do 2 builds? One with standard debug, and another with > -gstabs? We can repeat the testing by putting the gdb_test calls inside > a proc and then call it twice? I think that prepare_for_testing should > be able to handle the case where you need to add additional_flags as > well. In fact: >=20 > gdb.base/commands.exp:if { [prepare_for_testing commands.exp > commands run.c {debug additional_flags=3D-DFAKEARGV}] } { >=20 > > +# Regression test for a cleanup bug in the charset code. >=20 > ? You probably guessed now which file I used to create those new ones... Removed.=20 > > +gdb_exit >=20 > Harmless, but unnecessary. Let's toss it. Removed at the end, but reintroduced below... I am not convinced that a second round using default compiler debug settings is really useful, unless the same bug reappears once in another debug format, which is pretty unlikely. But I still wrote a new version with two builds. Is this OK for you? Pierre Testsuite ChangeLog entry: 2010-04-22 Pierre Muller PR stabs/11479. * gdb.stabs/gdb11479.exp: New file. * gdb.stabs/gdb11479.c: New file. Index: testsuite/gdb.stabs/gdb11479.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: testsuite/gdb.stabs/gdb11479.c diff -N testsuite/gdb.stabs/gdb11479.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.stabs/gdb11479.c 22 Apr 2010 13:02:08 -0000 @@ -0,0 +1,66 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2010 Free Software Foundation, Inc. + + Contributed by Pierre Muller. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + Qualifiers of forward types are not resolved correctly with stabs. */ + +struct dummy; + +enum dummy_enum; + +const void * +test (const struct dummy *t) +{ + const struct dummy *tt; + enum dummy_enum *e; + tt =3D t; + return t; +} + +void * +test2 (struct dummy *t) +{ + struct dummy *tt; + const enum dummy_enum *e; + tt =3D t; + return t; +} + + +struct dummy { + int x; + int y; + double b; +} tag_dummy; + +enum dummy_enum { + enum1, + enum2 +}; + +int +main () +{ + struct dummy tt; + tt.x =3D 5; + tt.y =3D 25; + tt.b =3D 2.5; + test2 (&tt); + test (&tt); + return 0; +} Index: testsuite/gdb.stabs/gdb11479.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: testsuite/gdb.stabs/gdb11479.exp diff -N testsuite/gdb.stabs/gdb11479.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.stabs/gdb11479.exp 22 Apr 2010 13:02:08 -0000 @@ -0,0 +1,56 @@ +# This testcase is part of GDB, the GNU debugger. + +# Copyright 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test GDB stabs problem with qualified parameter of forward types. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "gdb11479" + +proc do_test {version} { + gdb_test "rb test" "" "Set breakpoints $version" + gdb_test "run" "Breakpoint .* test2 .*" "Stop at first breakpoint $version" + # Check that the struct is read in correctly + gdb_test "print *t" ".*\{x =3D 5, y =3D 25, b =3D 2.5\}.*" \ + "Inspect t in test2 $version" + # Check that the enum type length has been set to a non-zero value + gdb_test "print sizeof (*e)" "=3D \[1-9\]*" "sizeof (e) in test2 $version" + gdb_test "continue" "Breakpoint .* test .*" \ + "Stop at first breakpoint $version" + gdb_test "print *t" ".*\{x =3D 5, y =3D 25, b =3D 2.5\}.*" \ + "Inspect t in test $version" + # Check that the enum type length has been set to a non-zero value + gdb_test "print sizeof (*e)" "=3D \[1-9\]*" "sizeof (e) in test $versi= on" +} + +if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug additional_flags=3D-gstabs}] =3D=3D 0 } { + do_test forced_stabs +} + +# Without this gdb_exit the executable is still opened +# by GDB which can generate a compilation failure.=20 +gdb_exit + +if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug}] =3D= =3D 0 } { + do_test natural_debug_format +} +