* gdb.ada/interface/types.ads, gdb.ada/interface/types.adb,
authorJoel Brobecker <brobecker@gnat.com>
Tue, 1 Jan 2008 07:25:45 +0000 (07:25 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Tue, 1 Jan 2008 07:25:45 +0000 (07:25 +0000)
        gdb.ada/interface/foo.adb: New files.
        * gdb.ada/interface.exp: New testcase.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/interface.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/interface/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/interface/types.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/interface/types.ads [new file with mode: 0644]

index 6e2f8db..f9b8b47 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+       * gdb.ada/interface/types.ads, gdb.ada/interface/types.adb,
+       gdb.ada/interface/foo.adb: New files.
+       * gdb.ada/interface.exp: New testcase.
+
 2007-12-31  Jim Blandy  <jimb@codesourcery.com>
 
        * gdb.base/multi-forks.exp: Consume all output from child
diff --git a/gdb/testsuite/gdb.ada/interface.exp b/gdb/testsuite/gdb.ada/interface.exp
new file mode 100644 (file)
index 0000000..f9f7770
--- /dev/null
@@ -0,0 +1,48 @@
+# Copyright 2008 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 "interface"
+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 additional_flags=-gnat05 ]] != "" } {
+  return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
+runto "foo.adb:$bp_location"
+
+gdb_test "print r" \
+         "\\(x => 1, y => 2, w => 3, h => 4\\)" \
+         "print r"
+
+gdb_test "print s" \
+         "\\(x => 1, y => 2, w => 3, h => 4\\)" \
+         "print s"
+
+
diff --git a/gdb/testsuite/gdb.ada/interface/foo.adb b/gdb/testsuite/gdb.ada/interface/foo.adb
new file mode 100644 (file)
index 0000000..e2c94d3
--- /dev/null
@@ -0,0 +1,25 @@
+--  Copyright 2008 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 Types; use Types;
+
+procedure Foo is
+   R : Rectangle := (1, 2, 3, 4);
+   S : Object'Class := Ident (R);
+begin
+   Do_Nothing (R);  -- STOP
+   Do_Nothing (S);
+end Foo;
+
diff --git a/gdb/testsuite/gdb.ada/interface/types.adb b/gdb/testsuite/gdb.ada/interface/types.adb
new file mode 100644 (file)
index 0000000..7592160
--- /dev/null
@@ -0,0 +1,29 @@
+--  Copyright 2008 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 Types is
+
+   function Ident (O : Object'Class) return Object'Class is
+   begin
+      return O;
+   end Ident;
+
+   procedure Do_Nothing (O : in out Object'Class) is
+   begin
+      null;
+   end Do_Nothing;
+
+end Types;
+
diff --git a/gdb/testsuite/gdb.ada/interface/types.ads b/gdb/testsuite/gdb.ada/interface/types.ads
new file mode 100644 (file)
index 0000000..a1b0ae2
--- /dev/null
@@ -0,0 +1,42 @@
+--  Copyright 2008 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 Types is
+
+   type Object_Int is interface;
+
+   type Another_Int is interface;
+
+   type Object_Root is abstract tagged record
+      X : Natural;
+      Y : Natural;
+   end record;
+
+   type Object is abstract new Object_Root and Object_Int and Another_Int
+     with null record;
+   function Ident (O : Object'Class) return Object'Class;
+   procedure Do_Nothing (O : in out Object'Class);
+
+   type Rectangle is new Object with record
+      W : Natural;
+      H : Natural;
+   end record;
+
+   type Circle is new Object with record
+      R : Natural;
+   end record;
+
+end Types;
+