]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2005-2024 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 |
20 | standard_testfile .c |
21 | ||
705335ea | 22 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
84c93cd5 | 23 | untested "failed to compile" |
705335ea JB |
24 | return -1 |
25 | } | |
26 | ||
a64d2530 | 27 | clean_restart ${binfile} |
705335ea | 28 | |
65a33d75 | 29 | if {![runto_main]} { |
cdd42066 | 30 | return |
705335ea JB |
31 | } |
32 | ||
33 | # First, print the array without the indexes | |
34 | ||
27d3a1a2 | 35 | gdb_test_no_output "set print array-indexes off" \ |
cd2ddb6c | 36 | "set print array-indexes to off" |
705335ea | 37 | |
bc2e7c7d TY |
38 | gdb_test "show print array-indexes" \ |
39 | "Printing of array indexes is off\\." \ | |
40 | "show print array-indexes is off" | |
41 | ||
705335ea JB |
42 | gdb_test "print array" \ |
43 | "\\{1, 2, 3, 4\\}" \ | |
bb95117e | 44 | "print array with array-indexes off" |
705335ea JB |
45 | |
46 | # Second, print the same array with the indexes | |
47 | ||
27d3a1a2 | 48 | gdb_test_no_output "set print array-indexes on" \ |
cd2ddb6c | 49 | "set print array-indexes to on" |
705335ea | 50 | |
bc2e7c7d TY |
51 | gdb_test "show print array-indexes" \ |
52 | "Printing of array indexes is on\\." \ | |
53 | "show print array-indexes is on" | |
54 | ||
705335ea JB |
55 | gdb_test "print array" \ |
56 | "\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \ | |
bb95117e | 57 | "print array with array-indexes on" |
705335ea JB |
58 | |
59 |