Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / intvar-array.exp
CommitLineData
88b9d363 1# Copyright 2021-2022 Free Software Foundation, Inc.
e3436813
AB
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# Place a non-dynamic array into an internal variable, then show that
17# modifications to either the internal variable, or to the original
18# array are independent.
19
20standard_testfile ".f90"
21load_lib "fortran.exp"
22
23if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
24 {debug f90 quiet}] } {
25 return -1
26}
27
28if ![fortran_runto_main] {
29 untested "could not run to main"
30 return -1
31}
32
33gdb_breakpoint [gdb_get_line_number "Break here"]
34gdb_continue_to_breakpoint "Break here"
35
36# Take a copy of the array into an internal variable.
37gdb_test_no_output "set \$a=arr" "set \$a internal variable"
38
39# Validate the original contents.
40gdb_test "print arr" \
41 " = \\(1, 1, 1, 1, 1, 1, 1, 1, 1, 1\\)" \
42 "print arr contents"
43gdb_test "print \$a" \
44 " = \\(1, 1, 1, 1, 1, 1, 1, 1, 1, 1\\)" \
45 "print \$a contents"
46
47# Modify the original array in memory.
48gdb_test_no_output "set arr(5) = 5"
49
50# Modify the internal variable copy.
51gdb_test_no_output "set \$a(3) = 3"
52
53# Now check that the two values have been updated independently.
54gdb_test "print arr" \
55 " = \\(1, 1, 1, 1, 5, 1, 1, 1, 1, 1\\)" \
56 "print arr contents after change"
57gdb_test "print \$a" \
58 " = \\(1, 1, 3, 1, 1, 1, 1, 1, 1, 1\\)" \
59 "print \$a contents after change"
This page took 0.102502 seconds and 4 git commands to generate.