Add gdb.ada/dyn_arrayidx testcase.

This add a testcases that verifies correct handling of dynamicity
for lower bounds of arrays.

gdb/testsuite/ChangeLog:

        * gdb.ada/dyn_arrayidx: New testcase.
This commit is contained in:
Joel Brobecker 2014-04-19 22:19:02 -07:00
parent 11c1ba7852
commit cac0dc8f4b
3 changed files with 72 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2014-04-28 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/dyn_arrayidx: New testcase.
2014-04-26 Yao Qi <yao@codesourcery.com>
* gdb.dwarf2/dwz.exp: Compile main.c to object. Restart GDB

View File

@ -0,0 +1,36 @@
# Copyright 2014 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/>.
load_lib "ada.exp"
if { [skip_ada_tests] } { return -1 }
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
return -1
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
runto "foo.adb:$bp_location"
# Make sure we do not use any of the descriptive types, even if
# the compiler generated them.
gdb_test_no_output "maintenance set ada ignore-descriptive-types"
gdb_test "ptype array_type" \
" = array \\(5 \\.\\. 10\\) of natural" \

View File

@ -0,0 +1,32 @@
-- Copyright 2014 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/>.
procedure Foo is
function Range_Count (L, U : Integer) return Natural
is
type Array_Type is array (L .. U) of Natural;
A : Array_Type := (others => 1);
Result : Natural := 0;
begin
for I of A loop -- START
Result := Result + I;
end loop;
return Result;
end Range_Count;
R2 : constant Natural := Range_Count (5, 10);
begin
null;
end Foo;