fix incorrect assumption in gdb.ada/watch_arg
authorJoel Brobecker <brobecker@gnat.com>
Tue, 6 Dec 2011 14:00:37 +0000 (14:00 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 6 Dec 2011 14:00:37 +0000 (14:00 +0000)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/watch_arg/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/watch_arg/pck.ads [new file with mode: 0644]
gdb/testsuite/gdb.ada/watch_arg/watch.adb

index d9f1f83f679cd82f8f0225e3ff22f64df4ba2e1e..1191b95009a1c2680aafd4bad5ad00b5a5b1e18e 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-06  Joel Brobecker  <brobecker@adacore.com>
+
+       * 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.
+
 2011-12-05  Stan Shebs  <stan@codesourcery.com>
 
        * gdb.trace/tfind.exp: Update help string matches.
diff --git a/gdb/testsuite/gdb.ada/watch_arg/pck.adb b/gdb/testsuite/gdb.ada/watch_arg/pck.adb
new file mode 100644 (file)
index 0000000..a9c836b
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+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 (file)
index 0000000..f8a4ed5
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+
+with System;
+package Pck is
+   procedure Do_Nothing (A : System.Address);
+end Pck;
index d10e63d48438a2310d3376719bfd6d02f2026e3a..d5e2c333ea61ee8489489a7268af00b3de821c09 100644 (file)
 --  You should have received a copy of the GNU General Public License
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+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;
This page took 0.077574 seconds and 4 git commands to generate.