This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on


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;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]