aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.ada
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@adacore.com>2014-04-19 22:19:02 -0700
committerJoel Brobecker <brobecker@adacore.com>2014-04-28 15:48:11 -0400
commitcac0dc8f4b0688771a4ab8a4012fceb1323167f1 (patch)
treed50af0520d14246c628050efdd30320fb579e227 /gdb/testsuite/gdb.ada
parent11c1ba785203f7f121324fa9727c2adbbc2119c2 (diff)
downloadfsf-binutils-gdb-cac0dc8f4b0688771a4ab8a4012fceb1323167f1.zip
fsf-binutils-gdb-cac0dc8f4b0688771a4ab8a4012fceb1323167f1.tar.gz
fsf-binutils-gdb-cac0dc8f4b0688771a4ab8a4012fceb1323167f1.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite/gdb.ada')
-rw-r--r--gdb/testsuite/gdb.ada/dyn_arrayidx.exp36
-rw-r--r--gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb32
2 files changed, 68 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx.exp b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp
new file mode 100644
index 0000000..04c39b0
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dyn_arrayidx.exp
@@ -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" \
diff --git a/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb
new file mode 100644
index 0000000..4deb04d
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/dyn_arrayidx/foo.adb
@@ -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;