-# Copyright 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2005-2021 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
# gdb can correctly print arrays with indexes for each element of the
# array.
-if $tracelevel {
- strace $tracelevel
-}
+standard_testfile .c
-set testfile "arrayidx"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile ${srcfile}"
+ untested "failed to compile"
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
# First, print the array without the indexes
gdb_test_no_output "set print array-indexes off" \
- "Set print array-indexes to off"
+ "set print array-indexes to off"
gdb_test "print array" \
"\\{1, 2, 3, 4\\}" \
- "Print array with array-indexes off"
+ "print array with array-indexes off"
# Second, print the same array with the indexes
gdb_test_no_output "set print array-indexes on" \
- "Set print array-indexes to on"
+ "set print array-indexes to on"
gdb_test "print array" \
"\\{\\\[0\\\] = 1, \\\[1\\\] = 2, \\\[2\\\] = 3, \\\[3\\\] = 4\\}" \
- "Print array with array-indexes on"
+ "print array with array-indexes on"