From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21937 invoked by alias); 24 Apr 2010 15:13:56 -0000 Received: (qmail 21925 invoked by uid 22791); 24 Apr 2010 15:13:54 -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.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 24 Apr 2010 15:13:48 +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 o3OFD48B055062 ; Sat, 24 Apr 2010 17:13:04 +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 o3OFD4V9095194 ; Sat, 24 Apr 2010 17:13:04 +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 o3OFD2CD084843 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) ; Sat, 24 Apr 2010 17:13:03 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Pedro Alves'" , Cc: "'Joel Brobecker'" References: <000301cae303$d6d068b0$84713a10$@muller@ics-cnrs.unistra.fr> <20100423172933.GO19194@adacore.com> <201004231915.49375.pedro@codesourcery.com> In-Reply-To: <201004231915.49375.pedro@codesourcery.com> Subject: [RFA- v2] Testcase for bug report 11531 and fix for Solaris Date: Sat, 24 Apr 2010 15:13:00 -0000 Message-ID: <002101cae3c0$a56276c0$f0276440$@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/msg00835.txt.bz2 > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pedro Alves > Envoy=E9=A0: Friday, April 23, 2010 8:16 PM > =C0=A0: gdb-patches@sourceware.org > Cc=A0: Joel Brobecker; Pierre Muller > Objet=A0: Re: [RFA] Testcase for bug report 11531 >=20 > On Friday 23 April 2010 18:29:33, Joel Brobecker wrote: > > > +gdb_test "start" ".*Temporary breakpoint.*" > > > > Unfortunately, this does not work when testing with the remote > protocol. > > Do use "runto", but use "*main" instead of "main", or something like > > that. That way, you should always stop before the instruction that > > causes the watchpoint to trigger. > > >=20 > Or avoid those tricks, and simply put another statement before > the one that triggers the watchpoint: >=20 > int > main () > { > + myrec.y =3D 1; <<<<<< runto main stops here instead. I found another way:=20 simply remove all breakpoints before=20 setting the watchpoint. Tested with cygwin GDB and GDBserver, both give 6 PASS. On a i386 solaris 32-bit GDB executable, I get two failures that disappear once I remove the macro from nm-i386-sol2.h. Pierre Muller PS1: Once this macro is removed, I will submit a RFA for the complete removal=20 of nm-i386-sol2.h. PS2: The code inside infrun.c ought to=20 be changed as well. If it is now non-functional I propose to generate a compilation error if the macro is still defined, this way third party users will not be surprised that it does not work... ChangeLog entry: 2010-04-24 Pierre Muller * config/i386/nm-i386-sol2.h (CANNOT_STEP_HW_WATCHPOINTS): Remove macro. testsuite/ChangeLog entry: PR breakpoints/11531. * testsuite/gdb.base/gdb11531.c: New file. * testsuite/gdb.base/gdb11531.exp: New file. Index: config/i386/nm-i386sol2.h =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: /cvs/src/src/gdb/config/i386/nm-i386sol2.h,v retrieving revision 1.19 diff -u -p -r1.19 nm-i386sol2.h --- config/i386/nm-i386sol2.h 1 Jan 2010 07:31:48 -0000 1.19 +++ config/i386/nm-i386sol2.h 24 Apr 2010 15:07:54 -0000 @@ -27,6 +27,8 @@ Work around the problem by removing hardware watchpoints if a step is requested, GDB will check for a hardware watchpoint trigger after the step anyway. */ -#define CANNOT_STEP_HW_WATCHPOINTS +/* The code related to this macro does not work + anymore. Thus we remove this macro definition. */ +/* #define CANNOT_STEP_HW_WATCHPOINTS */ #endif /* NEW_PROC_API */ Index: testsuite/gdb.base/gdb11531.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.base/gdb11531.c diff -N testsuite/gdb.base/gdb11531.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/gdb11531.c 24 Apr 2010 13:20:02 -0000 @@ -0,0 +1,40 @@ +/* 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 . + + Test for Solaris specific watchpoint problem. */ + +struct rec +{ + int x; + double y; + int z; +}; + +static struct rec myrec; + +int +main () +{ + myrec.x =3D 5; + myrec.y =3D 3.4; + myrec.z =3D 56; + myrec.x =3D 78; + return myrec.x; +} + Index: testsuite/gdb.base/gdb11531.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.base/gdb11531.exp diff -N testsuite/gdb.base/gdb11531.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.base/gdb11531.exp 24 Apr 2010 13:20:02 -0000 @@ -0,0 +1,63 @@ +# 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 "gdb11531" + +if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug}] } { + return -1; +} + + +if { ![runto main] } then { + fail "run to main" + return +} + +# If the breakpoint is at the same instruction as the=20 +# watchpoint value assignment +# you can fall into the problem of the stepping over the breakpoint +# location that can also trigger a watchpoint miss +# This is not the problem reported here. +# Thus we remove all breakpoints first. + +delete_breakpoints + +gdb_test "watch myrec.x" ".*atchpoint \[0-9\]+: myrec\.x" "Set watchpoint " + +gdb_test "stepi" \ + "Old value =3D 0.*New value =3D 5.*" \ + "watchpoint variable triggers at next" + +gdb_test "continue" \ + "Old value =3D .*New value =3D 78.*" \ + "watchpoint variable triggers at continue" + +gdb_test "continue" ".*Program exited.*" "Continue to program exit"=20=20 + +gdb_test "start" "" "restart" + +gdb_test "next" "Old value =3D 0.*New value =3D 5.*" "watchpoint triggers = after second start" +