* gdb.ada/interface/types.ads, gdb.ada/interface/types.adb,

gdb.ada/interface/foo.adb: New files.
        * gdb.ada/interface.exp: New testcase.
This commit is contained in:
Joel Brobecker 2008-01-01 07:25:45 +00:00
parent 73fb998568
commit 319e46745f
5 changed files with 150 additions and 0 deletions

View 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> 2007-12-31 Jim Blandy <jimb@codesourcery.com>
* gdb.base/multi-forks.exp: Consume all output from child * gdb.base/multi-forks.exp: Consume all output from child

View File

@ -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"

View File

@ -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;

View File

@ -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;

View File

@ -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;