]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb.ada/ptype_tagged_param: New testcase.
authorJoel Brobecker <brobecker@gnat.com>
Tue, 9 Feb 2010 13:16:33 +0000 (13:16 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 9 Feb 2010 13:16:33 +0000 (13:16 +0000)
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/ptype_tagged_param.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads [new file with mode: 0644]

index 4bbbd9377e35f102e4a755d16be79f6132b62f34..ae7df70a6fe955feb4d11956868baf58a281a762 100644 (file)
@@ -1,3 +1,7 @@
+2010-02-09  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.ada/ptype_tagged_param: New testcase.
+
 2010-02-08  Tom Tromey  <tromey@redhat.com>
 
        PR c++/8017:
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
new file mode 100644 (file)
index 0000000..39b64d5
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright 2010 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/>.
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+load_lib "ada.exp"
+
+set testdir "ptype_tagged_param"
+set testfile "${testdir}/foo"
+set srcfile ${srcdir}/${subdir}/${testfile}.adb
+set binfile ${objdir}/${subdir}/${testfile}
+
+file mkdir ${objdir}/${subdir}/${testdir}
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
+  return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto "position_x" ] then {
+  return -1
+}
+
+set eol "\[\r\n\]+"
+set sp "\[ \t\]*"
+
+gdb_test "ptype s" \
+         "type = new pck.shape with record${eol}${sp}r: integer;${eol}end record" \
+         "ptype s"
+
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb b/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb
new file mode 100644 (file)
index 0000000..3a12453
--- /dev/null
@@ -0,0 +1,23 @@
+--  Copyright 2010 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 Pck; use Pck;
+
+procedure Foo is
+   My_Shape : Circle := (X => 1, Y => 2, R => 3);
+   X : Integer;
+begin
+   X := Position_X (My_Shape);
+end Foo;
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb
new file mode 100644 (file)
index 0000000..e54bcb1
--- /dev/null
@@ -0,0 +1,30 @@
+--  Copyright 2010 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
+
+   function Position_X (S : in Shape) return Integer is
+   begin
+      return S.X;
+   end Position_X;
+
+   function Area (C : in Circle) return Integer is
+   begin
+      --  Very crude calculation...
+      return 6 * C.R * C.R;
+   end Area;
+
+end Pck;
+
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads
new file mode 100644 (file)
index 0000000..8d8f1d0
--- /dev/null
@@ -0,0 +1,29 @@
+--  Copyright 2010 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 Pck is
+
+   type Shape is abstract tagged record
+     X, Y: Integer;
+   end record;
+   function Position_X (S : in Shape) return Integer;
+
+   type Circle is new Shape with record
+     R : Integer;
+   end record;
+   function Area (C : in Circle) return Integer;
+
+end Pck;
+