diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-01-01 07:25:45 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-01-01 07:25:45 +0000 |
commit | 319e46745fc2267f605f6c75c664ae54a9693edf (patch) | |
tree | cf4b553f7bef42702d96cbe607c2f6b5b7724756 /gdb/testsuite/gdb.ada | |
parent | 73fb9985686f8ed65ac02a63256918ce755a46b4 (diff) | |
download | gdb-319e46745fc2267f605f6c75c664ae54a9693edf.zip gdb-319e46745fc2267f605f6c75c664ae54a9693edf.tar.gz gdb-319e46745fc2267f605f6c75c664ae54a9693edf.tar.bz2 |
* gdb.ada/interface/types.ads, gdb.ada/interface/types.adb,
gdb.ada/interface/foo.adb: New files.
* gdb.ada/interface.exp: New testcase.
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r-- | gdb/testsuite/gdb.ada/interface.exp | 48 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/interface/foo.adb | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/interface/types.adb | 29 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/interface/types.ads | 42 |
4 files changed, 144 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/interface.exp b/gdb/testsuite/gdb.ada/interface.exp new file mode 100644 index 0000000..f9f7770 --- /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 <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 index 0000000..e2c94d3 --- /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 <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 index 0000000..7592160 --- /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 <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 index 0000000..a1b0ae2 --- /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 <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; + |