From 319e46745fc2267f605f6c75c664ae54a9693edf Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 1 Jan 2008 07:25:45 +0000 Subject: [PATCH] * gdb.ada/interface/types.ads, gdb.ada/interface/types.adb, gdb.ada/interface/foo.adb: New files. * gdb.ada/interface.exp: New testcase. --- gdb/testsuite/ChangeLog | 6 +++ gdb/testsuite/gdb.ada/interface.exp | 48 +++++++++++++++++++++++ gdb/testsuite/gdb.ada/interface/foo.adb | 25 ++++++++++++ gdb/testsuite/gdb.ada/interface/types.adb | 29 ++++++++++++++ gdb/testsuite/gdb.ada/interface/types.ads | 42 ++++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 gdb/testsuite/gdb.ada/interface.exp create mode 100644 gdb/testsuite/gdb.ada/interface/foo.adb create mode 100644 gdb/testsuite/gdb.ada/interface/types.adb create mode 100644 gdb/testsuite/gdb.ada/interface/types.ads diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6e2f8dbfde1..f9b8b47bf32 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-01-01 Joel Brobecker + + * 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 * 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 index 00000000000..f9f77703e6a --- /dev/null +++ b/gdb/testsuite/gdb.ada/interface.exp @@ -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 . + +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 index 00000000000..e2c94d32452 --- /dev/null +++ b/gdb/testsuite/gdb.ada/interface/foo.adb @@ -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 . + +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 index 00000000000..75921609a18 --- /dev/null +++ b/gdb/testsuite/gdb.ada/interface/types.adb @@ -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 . + +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 index 00000000000..a1b0ae28dd9 --- /dev/null +++ b/gdb/testsuite/gdb.ada/interface/types.ads @@ -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 . + +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; + -- 2.30.2