Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / arrayidx.exp
CommitLineData
88b9d363 1# Copyright 2005-2022 Free Software Foundation, Inc.
2336bb58
JB
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
2336bb58
JB
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
2336bb58 15
2336bb58
JB
16load_lib "ada.exp"
17
ec3c07fc
NS
18if { [skip_ada_tests] } { return -1 }
19
8223e12c 20standard_ada_testfile p
2336bb58 21
ec3c07fc
NS
22if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
23 return -1
2336bb58
JB
24}
25
4c93b1db 26if [get_compiler_info] {
ae59b1da 27 return -1
3f20c47f
JK
28}
29set old_gcc [expr [test_compiler_info {gcc-[0-3]-*}] \
30 || [test_compiler_info {gcc-4-[0-6]-*}]]
31
09050809 32clean_restart ${testfile}
2336bb58
JB
33
34set bp_location [gdb_get_line_number "START" ${testdir}/p.adb]
35runto "p.adb:$bp_location"
36
37# First, print all the arrays without indexes
38
a7b75dfd 39gdb_test_no_output "set print array-indexes off"
2336bb58 40
3f20c47f
JK
41if $old_gcc {
42 setup_xfail "*-*-*"
43}
2336bb58 44gdb_test "print one_two_three" \
b6db24e5 45 "= \\(1, 2, 3\\)" \
2336bb58
JB
46 "print one_two_three, indexes off"
47
2336bb58 48gdb_test "print e_one_two_three" \
b6db24e5 49 "= \\(1, 2, 3\\)" \
2336bb58
JB
50 "print e_one_two_three, indexes off"
51
2336bb58 52gdb_test "print r_two_three" \
b6db24e5 53 "= \\(two => 2, 3\\)" \
2336bb58
JB
54 "print r_two_three, indexes off"
55
56gdb_test "print u_one_two_three" \
b6db24e5 57 "= \\(1, 2, 3\\)" \
2336bb58
JB
58 "print u_one_two_three, indexes off"
59
60gdb_test "print p_one_two_three" \
99b1c762 61 "= \\(false, true, true\\)" \
2336bb58
JB
62 "print p_one_two_three, indexes off"
63
3f20c47f
JK
64if $old_gcc {
65 setup_xfail "*-*-*"
66}
2336bb58 67gdb_test "print few_reps" \
b6db24e5 68 "= \\(1, 2, 3, 3, 3, 3, 3, 4, 5\\)" \
2336bb58
JB
69 "print few_reps, indexes off"
70
3f20c47f
JK
71if $old_gcc {
72 setup_xfail "*-*-*"
73}
2336bb58 74gdb_test "print many_reps" \
b6db24e5 75 "= \\(1, 2, 3 <repeats 12 times>, 4, 5\\)" \
2336bb58
JB
76 "print many_reps, indexes off"
77
3f20c47f
JK
78if $old_gcc {
79 setup_xfail "*-*-*"
80}
2336bb58 81gdb_test "print empty" \
b6db24e5 82 "= \\(\\)" \
2336bb58
JB
83 "print empty, indexes off"
84
85# Next, print all the arrays with the indexes
86
a7b75dfd 87gdb_test_no_output "set print array-indexes on"
2336bb58 88
3f20c47f
JK
89if $old_gcc {
90 setup_xfail "*-*-*"
91}
2336bb58 92gdb_test "print one_two_three" \
3d11e68e 93 "= \\(1 => 1, 2 => 2, 3 => 3\\)"
2336bb58 94
2336bb58 95gdb_test "print e_one_two_three" \
3d11e68e 96 "= \\(one => 1, two => 2, three => 3\\)"
2336bb58 97
2336bb58 98gdb_test "print r_two_three" \
3d11e68e 99 "= \\(two => 2, three => 3\\)"
2336bb58
JB
100
101gdb_test "print u_one_two_three" \
3d11e68e 102 "= \\(1 => 1, 2 => 2, 3 => 3\\)"
2336bb58
JB
103
104gdb_test "print p_one_two_three" \
3d11e68e 105 "= \\(one => false, two => true, three => true\\)"
2336bb58 106
3f20c47f
JK
107if $old_gcc {
108 setup_xfail "*-*-*"
109}
2336bb58 110gdb_test "print few_reps" \
3d11e68e 111 "= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)"
2336bb58 112
3f20c47f
JK
113if $old_gcc {
114 setup_xfail "*-*-*"
115}
2336bb58 116gdb_test "print many_reps" \
3d11e68e 117 "= \\(1 => 1, 2 => 2, 3 => 3 <repeats 12 times>, 15 => 4, 16 => 5\\)"
2336bb58 118
3f20c47f
JK
119if $old_gcc {
120 setup_xfail "*-*-*"
121}
2336bb58 122gdb_test "print empty" \
3d11e68e 123 "= \\(\\)"
This page took 1.874398 seconds and 4 git commands to generate.