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