aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2010-02-09 13:16:33 +0000
committerJoel Brobecker <brobecker@gnat.com>2010-02-09 13:16:33 +0000
commitdadf0e9c7a2409d46fc5ff8e1b1a1c7b086dedbf (patch)
tree0cdb3d55cdd02822f6efa4a1cd08e0cdf5c710a5 /gdb/testsuite/gdb.ada
parent31dbc1c5396158c36dc3619c0711f179a9458239 (diff)
downloadgdb-dadf0e9c7a2409d46fc5ff8e1b1a1c7b086dedbf.zip
gdb-dadf0e9c7a2409d46fc5ff8e1b1a1c7b086dedbf.tar.gz
gdb-dadf0e9c7a2409d46fc5ff8e1b1a1c7b086dedbf.tar.bz2
* gdb.ada/ptype_tagged_param: New testcase.
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param.exp47
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb23
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb30
-rw-r--r--gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads29
4 files changed, 129 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/ptype_tagged_param.exp b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
new file mode 100644
index 0000000..39b64d5
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param.exp
@@ -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
index 0000000..3a12453
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/foo.adb
@@ -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
index 0000000..e54bcb1
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.adb
@@ -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
index 0000000..8d8f1d0
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/ptype_tagged_param/pck.ads
@@ -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;
+