]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.ada/arrayidx.exp
Update Copyright year range in all files maintained by GDB.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / arrayidx.exp
1 # Copyright 2005-2014 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
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
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 load_lib "ada.exp"
17
18 if { [skip_ada_tests] } { return -1 }
19
20 standard_ada_testfile p
21
22 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
23 return -1
24 }
25
26 if [get_compiler_info] {
27 return -1
28 }
29 set old_gcc [expr [test_compiler_info {gcc-[0-3]-*}] \
30 || [test_compiler_info {gcc-4-[0-6]-*}]]
31
32 clean_restart ${testfile}
33
34 set bp_location [gdb_get_line_number "START" ${testdir}/p.adb]
35 runto "p.adb:$bp_location"
36
37 # First, print all the arrays without indexes
38
39 gdb_test_no_output "set print array-indexes off"
40
41 if $old_gcc {
42 setup_xfail "*-*-*"
43 }
44 gdb_test "print one_two_three" \
45 "= \\(1, 2, 3\\)" \
46 "print one_two_three, indexes off"
47
48 gdb_test "print e_one_two_three" \
49 "= \\(1, 2, 3\\)" \
50 "print e_one_two_three, indexes off"
51
52 gdb_test "print r_two_three" \
53 "= \\(two => 2, 3\\)" \
54 "print r_two_three, indexes off"
55
56 gdb_test "print u_one_two_three" \
57 "= \\(1, 2, 3\\)" \
58 "print u_one_two_three, indexes off"
59
60 gdb_test "print p_one_two_three" \
61 "= \\(false, true, true\\)" \
62 "print p_one_two_three, indexes off"
63
64 if $old_gcc {
65 setup_xfail "*-*-*"
66 }
67 gdb_test "print few_reps" \
68 "= \\(1, 2, 3, 3, 3, 3, 3, 4, 5\\)" \
69 "print few_reps, indexes off"
70
71 if $old_gcc {
72 setup_xfail "*-*-*"
73 }
74 gdb_test "print many_reps" \
75 "= \\(1, 2, 3 <repeats 12 times>, 4, 5\\)" \
76 "print many_reps, indexes off"
77
78 if $old_gcc {
79 setup_xfail "*-*-*"
80 }
81 gdb_test "print empty" \
82 "= \\(\\)" \
83 "print empty, indexes off"
84
85 # Next, print all the arrays with the indexes
86
87 gdb_test_no_output "set print array-indexes on"
88
89 if $old_gcc {
90 setup_xfail "*-*-*"
91 }
92 gdb_test "print one_two_three" \
93 "= \\(1 => 1, 2 => 2, 3 => 3\\)" \
94 "print one_two_three"
95
96 gdb_test "print e_one_two_three" \
97 "= \\(one => 1, two => 2, three => 3\\)" \
98 "print e_one_two_three"
99
100 gdb_test "print r_two_three" \
101 "= \\(two => 2, three => 3\\)" \
102 "print r_two_three"
103
104 gdb_test "print u_one_two_three" \
105 "= \\(1 => 1, 2 => 2, 3 => 3\\)" \
106 "print u_one_two_three"
107
108 gdb_test "print p_one_two_three" \
109 "= \\(one => false, two => true, three => true\\)" \
110 "print p_one_two_three"
111
112 if $old_gcc {
113 setup_xfail "*-*-*"
114 }
115 gdb_test "print few_reps" \
116 "= \\(1 => 1, 2 => 2, 3 => 3, 4 => 3, 5 => 3, 6 => 3, 7 => 3, 8 => 4, 9 => 5\\)" \
117 "print few_reps"
118
119 if $old_gcc {
120 setup_xfail "*-*-*"
121 }
122 gdb_test "print many_reps" \
123 "= \\(1 => 1, 2 => 2, 3 => 3 <repeats 12 times>, 15 => 4, 16 => 5\\)" \
124 "print many_reps"
125
126 if $old_gcc {
127 setup_xfail "*-*-*"
128 }
129 gdb_test "print empty" \
130 "= \\(\\)" \
131 "print empty"
132
133