From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23362 invoked by alias); 6 Dec 2011 10:34:41 -0000 Received: (qmail 22940 invoked by uid 22791); 6 Dec 2011 10:34:40 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Dec 2011 10:34:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D51DB2BB401; Tue, 6 Dec 2011 05:34:24 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oDDNO99yWH+K; Tue, 6 Dec 2011 05:34:24 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E3AF72BB3FA; Tue, 6 Dec 2011 05:34:23 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 18A7D145615; Tue, 6 Dec 2011 02:34:17 -0800 (PST) Date: Tue, 06 Dec 2011 12:09:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix gdb.ada/watch_arg.exp test with always inserted and displaced stepping on Message-ID: <20111206103417.GP2777@adacore.com> References: <20111205134803.29078.49880.stgit@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <20111205134803.29078.49880.stgit@localhost6.localdomain6> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00163.txt.bz2 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 646 > 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. Sometimes, I'm not sure what, if anything, goes through my brain... You're right, of course. > 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. I would rather make sure that X still gets referenced, to make sure a smart tool/compiler/linker does not play games. Can you try the attached? -- Joel --huq684BweRXVnRxX Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="watch.diff" Content-length: 3446 commit 8a01a822c37a69ace62b15d733d61500eb4752fe Author: Joel Brobecker Date: Tue Dec 6 11:29:39 2011 +0100 fix incorrect assumption in gdb.ada/watch_arg The testcase is assuming that the parameter being watched isn't being modified. But the way the test program is written, this is not true at all. So this changes fixes the code to still reference the variable, but in a way that does not modify its value. gdb/testsuite: * gdb.ada/watch_arg/pck.ads, gdb.ada/watch_arg/pck.adb: New files. * gdb.ada/watch_arg/watch.adb: Adjust code to avoid modification of parameter X in procedure Foo. diff --git a/gdb/testsuite/gdb.ada/watch_arg/pck.adb b/gdb/testsuite/gdb.ada/watch_arg/pck.adb new file mode 100644 index 0000000..a9c836b --- /dev/null +++ b/gdb/testsuite/gdb.ada/watch_arg/pck.adb @@ -0,0 +1,23 @@ +-- Copyright 2011 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 . + +package body Pck is + + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; + +end Pck; diff --git a/gdb/testsuite/gdb.ada/watch_arg/pck.ads b/gdb/testsuite/gdb.ada/watch_arg/pck.ads new file mode 100644 index 0000000..f8a4ed5 --- /dev/null +++ b/gdb/testsuite/gdb.ada/watch_arg/pck.ads @@ -0,0 +1,19 @@ +-- Copyright 2011 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 . + +with System; +package Pck is + procedure Do_Nothing (A : System.Address); +end Pck; diff --git a/gdb/testsuite/gdb.ada/watch_arg/watch.adb b/gdb/testsuite/gdb.ada/watch_arg/watch.adb index d10e63d..d5e2c33 100644 --- a/gdb/testsuite/gdb.ada/watch_arg/watch.adb +++ b/gdb/testsuite/gdb.ada/watch_arg/watch.adb @@ -14,11 +14,14 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . +with Pck; use Pck; + procedure Watch is procedure Foo (X : in out Integer) is begin - X := 3; -- BREAK1 + -- Reference X in a way that does not change its value. + Do_Nothing (X'Address); -- BREAK1 end Foo; X : Integer := 1; --huq684BweRXVnRxX--