* gdb.ada/ptype_tagged_param: New testcase.

This commit is contained in:
Joel Brobecker 2010-02-09 13:16:33 +00:00
parent 31dbc1c539
commit dadf0e9c7a
5 changed files with 133 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2010-02-09 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/ptype_tagged_param: New testcase.
2010-02-08 Tom Tromey <tromey@redhat.com>
PR c++/8017:

View File

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

View File

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

View File

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

View File

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