]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/arrayidx.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / arrayidx.exp
CommitLineData
42a4f53d 1# Copyright 2005-2019 Free Software Foundation, Inc.
705335ea
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
705335ea
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/>.
705335ea
JB
15
16# This file is part of the gdb testsuite. It is intended to test that
17# gdb can correctly print arrays with indexes for each element of the
18# array.
19
a64d2530
TT
20standard_testfile .c
21
705335ea 22if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
84c93cd5 23 untested "failed to compile"
705335ea
JB
24 return -1
25}
26
a64d2530 27clean_restart ${binfile}
705335ea
JB
28
29if ![runto_main] then {
30 perror "couldn't run to breakpoint"
31 continue
32}
33
34# First, print the array without the indexes
35
27d3a1a2 36gdb_test_no_output "set print array-indexes off" \
cd2ddb6c 37 "set print array-indexes to off"
705335ea
JB
38
39gdb_test "print array" \
40 "\\{1, 2, 3, 4\\}" \
bb95117e 41 "print array with array-indexes off"
705335ea
JB
42
43# Second, print the same array with the indexes
44
27d3a1a2 45gdb_test_no_output "set print array-indexes on" \
cd2ddb6c 46 "set print array-indexes to on"
705335ea
JB
47
48gdb_test "print array" \
49 "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
bb95117e 50 "print array with array-indexes on"
705335ea
JB
51
52