Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / vla-value-sub.exp
CommitLineData
88b9d363 1# Copyright 2015-2022 Free Software Foundation, Inc.
3f2f83dd
KB
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
16standard_testfile "vla-sub.f90"
86cd6bc8 17load_lib fortran.exp
3f2f83dd 18
a54a7f13
PA
19if {[skip_fortran_tests]} { return -1 }
20
5b362f04 21if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
3f2f83dd
KB
22 {debug f90 quiet}] } {
23 return -1
24}
25
86cd6bc8 26if ![fortran_runto_main] {
3f2f83dd
KB
27 untested "could not run to main"
28 return -1
29}
30
31# Check the values of VLA's in subroutine can be evaluated correctly
32
33# Try to access values from a fixed array handled as VLA in subroutine.
34gdb_breakpoint [gdb_get_line_number "not-filled"]
35gdb_continue_to_breakpoint "not-filled (1st)"
36gdb_test "print array1" " = \\(\[()1, .\]*\\)" \
37 "print passed array1 in foo (passed fixed array)"
38
39gdb_breakpoint [gdb_get_line_number "array1-filled"]
40gdb_continue_to_breakpoint "array1-filled (1st)"
41gdb_test "print array1(5, 7)" " = 5" \
42 "print array1(5, 7) after filled in foo (passed fixed array)"
43gdb_test "print array1(1, 1)" " = 30" \
44 "print array1(1, 1) after filled in foo (passed fixed array)"
45
46gdb_breakpoint [gdb_get_line_number "array2-almost-filled"]
47gdb_continue_to_breakpoint "array2-almost-filled (1st)"
e9fb005c
JK
48# array2 size is 296352 bytes.
49gdb_test_no_output "set max-value-size 1024*1024"
3f2f83dd
KB
50gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
51 "print array2 in foo after it was filled (passed fixed array)"
52gdb_test "print array2(2,1,1)=20" " = 20" \
53 "set array(2,2,2) to 20 in subroutine (passed fixed array)"
54gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
55 "print array2 in foo after it was mofified in debugger (passed fixed array)"
56
57
58# Try to access values from a fixed sub-array handled as VLA in subroutine.
59gdb_continue_to_breakpoint "not-filled (2nd)"
60gdb_test "print array1" " = \\(\[()5, .\]*\\)" \
61 "print passed array1 in foo (passed sub-array)"
62
63gdb_continue_to_breakpoint "array1-filled (2nd)"
64gdb_test "print array1(5, 5)" " = 5" \
65 "print array1(5, 5) after filled in foo (passed sub-array)"
66gdb_test "print array1(1, 1)" " = 30" \
67 "print array1(1, 1) after filled in foo (passed sub-array)"
68
69gdb_continue_to_breakpoint "array2-almost-filled (2nd)"
70gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
71 "print array2 in foo after it was filled (passed sub-array)"
72gdb_test "print array2(2,1,1)=20" " = 20" \
73 "set array(2,2,2) to 20 in subroutine (passed sub-array)"
74gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
75 "print array2 in foo after it was mofified in debugger (passed sub-array)"
76
77
78# Try to access values from a VLA passed to subroutine.
79gdb_continue_to_breakpoint "not-filled (3rd)"
80gdb_test "print array1" " = \\(\[()42, .\]*\\)" \
81 "print passed array1 in foo (passed vla)"
82
83gdb_continue_to_breakpoint "array1-filled (3rd)"
84gdb_test "print array1(5, 5)" " = 5" \
85 "print array1(5, 5) after filled in foo (passed vla)"
86gdb_test "print array1(1, 1)" " = 30" \
87 "print array1(1, 1) after filled in foo (passed vla)"
88
89gdb_continue_to_breakpoint "array2-almost-filled (3rd)"
90gdb_test "print array2" " = \\( *\\( *\\( *30, *3, *3,\[()3, .\]*\\)" \
91 "print array2 in foo after it was filled (passed vla)"
92gdb_test "print array2(2,1,1)=20" " = 20" \
93 "set array(2,2,2) to 20 in subroutine (passed vla)"
94gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \
95 "print array2 in foo after it was mofified in debugger (passed vla)"
This page took 0.806751 seconds and 4 git commands to generate.