From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: "'Pedro Alves'" <pedro@codesourcery.com>, <gdb-patches@sourceware.org>
Cc: "'Joel Brobecker'" <brobecker@adacore.com>
Subject: [RFA- v2] Testcase for bug report 11531 and fix for Solaris
Date: Sat, 24 Apr 2010 15:13:00 -0000 [thread overview]
Message-ID: <002101cae3c0$a56276c0$f0276440$@muller@ics-cnrs.unistra.fr> (raw)
In-Reply-To: <201004231915.49375.pedro@codesourcery.com>
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, April 23, 2010 8:16 PM
> À : gdb-patches@sourceware.org
> Cc : Joel Brobecker; Pierre Muller
> Objet : Re: [RFA] Testcase for bug report 11531
>
> 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.
> >
>
> Or avoid those tricks, and simply put another statement before
> the one that triggers the watchpoint:
>
> int
> main ()
> {
> + myrec.y = 1; <<<<<< runto main stops here instead.
I found another way:
simply remove all breakpoints before
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
of nm-i386-sol2.h.
PS2: The code inside infrun.c ought to
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 <muller@ics.u-strasbg.fr>
* 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
===================================================================
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
===================================================================
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 <http://www.gnu.org/licenses/>.
+
+ Test for Solaris specific watchpoint problem. */
+
+struct rec
+{
+ int x;
+ double y;
+ int z;
+};
+
+static struct rec myrec;
+
+int
+main ()
+{
+ myrec.x = 5;
+ myrec.y = 3.4;
+ myrec.z = 56;
+ myrec.x = 78;
+ return myrec.x;
+}
+
Index: testsuite/gdb.base/gdb11531.exp
===================================================================
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 <http://www.gnu.org/licenses/>.
+
+# 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
+# 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 = 0.*New value = 5.*" \
+ "watchpoint variable triggers at next"
+
+gdb_test "continue" \
+ "Old value = .*New value = 78.*" \
+ "watchpoint variable triggers at continue"
+
+gdb_test "continue" ".*Program exited.*" "Continue to program exit"
+
+gdb_test "start" "" "restart"
+
+gdb_test "next" "Old value = 0.*New value = 5.*" "watchpoint triggers after
second start"
+
next prev parent reply other threads:[~2010-04-24 15:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-23 16:41 [RFA] Testcase for bug report 11531 Pierre Muller
2010-04-23 17:29 ` Joel Brobecker
2010-04-23 18:16 ` Pedro Alves
2010-04-23 18:25 ` Joel Brobecker
2010-04-24 15:13 ` Pierre Muller [this message]
2010-04-25 13:20 ` [RFA- v2] Testcase for bug report 11531 and fix for Solaris Joel Brobecker
2010-04-26 11:24 ` [RFA- v3] " Pierre Muller
2010-04-26 16:49 ` Joel Brobecker
2010-04-26 20:50 ` Pierre Muller
2010-04-25 20:10 ` [RFA- v2] " Pedro Alves
2010-04-26 10:55 ` [RFA- v2] Remove CANNOT_STEP_HW_WATCHPOINTS related code (was fix for bug 11531) Pierre Muller
2010-04-26 11:26 ` Pedro Alves
2010-04-26 11:50 ` Pierre Muller
2010-04-26 11:56 ` Pedro Alves
2010-04-26 12:03 ` Pierre Muller
2010-04-26 11:29 ` Mark Kettenis
2010-04-26 11:52 ` Pierre Muller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002101cae3c0$a56276c0$f0276440$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox