From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23217 invoked by alias); 5 Dec 2011 13:50:57 -0000 Received: (qmail 23209 invoked by uid 22791); 5 Dec 2011 13:50:56 -0000 X-SWARE-Spam-Status: Yes, hits=5.5 required=5.0 tests=BAYES_00,BOTNET,FROM_12LTRDOM,RCVD_IN_BRBL_LASTEXT,RDNS_DYNAMIC X-Spam-Check-By: sourceware.org Received: from bl21-173-103.dsl.telepac.pt (HELO localhost6.localdomain6) (2.82.173.103) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Dec 2011 13:50:43 +0000 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id pB5Dm3Qo029101; Mon, 5 Dec 2011 13:48:04 GMT Subject: [PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on To: Joel Brobecker From: Pedro Alves Cc: gdb-patches@sourceware.org Date: Mon, 05 Dec 2011 14:18:00 -0000 Message-ID: <20111205134803.29078.49880.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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: 2011-12/txt/msg00139.txt.bz2 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 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;