Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: [PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on
Date: Mon, 05 Dec 2011 14:18:00 -0000	[thread overview]
Message-ID: <20111205134803.29078.49880.stgit@localhost6.localdomain6> (raw)

Doing a testsuite run with both always inserted and displaced stepping
on, shows a regression in gdb.ada/watch_arg.exp (compared to pristine
gdb):

 (gdb) break watch.adb:21
 Breakpoint 1 at 0x401157: file /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb, line 21.
 (gdb) run
 Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.ada/watch_arg/watch

 Breakpoint 1, watch.foo (x=1) at /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb:21
 21	      X := 3;  -- BREAK1
 (gdb) watch x
 Hardware watchpoint 2: x
 (gdb) PASS: gdb.ada/watch_arg.exp: Set watchpoint on function argument X
 break watch.adb:28
 Breakpoint 3 at 0x40117f: file /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb, line 28.
 (gdb) PASS: gdb.ada/watch_arg.exp: insert second breakpoint in watch.adb
 cont
 Continuing.
 Hardware watchpoint 2: x

 Old value = 1
 New value = 3
 watch.foo (x=3) at /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb:22
 22	   end Foo;
 (gdb) FAIL: gdb.ada/watch_arg.exp: Continuing to second breakpoint

vs:

 (gdb) watch x
 Hardware watchpoint 2: x
 (gdb) PASS: gdb.ada/watch_arg.exp: Set watchpoint on function argument X
 break watch.adb:28
 Breakpoint 3 at 0x40117f: file /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb, line 28.
 (gdb) PASS: gdb.ada/watch_arg.exp: insert second breakpoint in watch.adb
 cont
 Continuing.

 Breakpoint 3, watch () at /home/pedro/gdb/mygit/gdb/gdb/testsuite/gdb.ada/watch_arg/watch.adb:28
 28         X := 2;  -- BREAK2
 (gdb) PASS: gdb.ada/watch_arg.exp: Continuing to second breakpoint


The "problem" is that setting both always inserted and displaced
stepping on, actually fixes PR7143.  That is, the test sets a
watchpoint on X, and assumes that it does not trigger.  But, it
actually should trigger.  The instruction under breakpoint 1 does
change X.  A pristine GDB doesn't trigger the watchpoint because we
blindly remove all breakpoints along with all watchpoints when
stepping over breakpoint 1, thus missing the watchpoint.

Looking at the original description of the problem:

 http://www.sourceware.org/ml/gdb-patches/2006-10/msg00044.html

I notice that what the Foo procedure does is not really important,
so an easy fix is to make Foo not touch X, thus we have the same
behavior even if PR7143 is fixed.

Okay?

2011-12-05  Pedro Alves  <pedro@codesourcery.com>

	testsuite/
	* gdb.ada/watch_arg/watch.adb (Watch.Foo): New Y parameter.
	(Watch): New Y local.  Pass it to Foo.
---
 gdb/testsuite/gdb.ada/watch_arg/watch.adb |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/watch_arg/watch.adb b/gdb/testsuite/gdb.ada/watch_arg/watch.adb
index d10e63d..deb54e3 100644
--- a/gdb/testsuite/gdb.ada/watch_arg/watch.adb
+++ b/gdb/testsuite/gdb.ada/watch_arg/watch.adb
@@ -16,15 +16,16 @@
 
 procedure Watch is
 
-   procedure Foo (X : in out Integer) is
+   procedure Foo (X, Y : in out Integer) is
    begin
-      X := 3;  -- BREAK1
+      Y := 3;  -- BREAK1
    end Foo;
 
    X : Integer := 1;
+   Y : Integer := 1;
 
 begin
-   Foo (X);
+   Foo (X, Y);
    X := 2;  -- BREAK2
 end Watch;
 


             reply	other threads:[~2011-12-05 13:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-05 14:18 Pedro Alves [this message]
2011-12-06 12:09 ` Joel Brobecker
2011-12-06 12:46   ` Pedro Alves
2011-12-06 14:32     ` Joel Brobecker

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=20111205134803.29078.49880.stgit@localhost6.localdomain6 \
    --to=pedro@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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