Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on
@ 2011-12-05 14:18 Pedro Alves
  2011-12-06 12:09 ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2011-12-05 14:18 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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;
 


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

end of thread, other threads:[~2011-12-06 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-05 14:18 [PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on Pedro Alves
2011-12-06 12:09 ` Joel Brobecker
2011-12-06 12:46   ` Pedro Alves
2011-12-06 14:32     ` Joel Brobecker

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