Commit | Line | Data |
---|---|---|
5bbd8269 AB |
1 | # Copyright 2019 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 | # Print a 2 dimensional assumed shape array. We pass different slices | |
17 | # of the array to a subroutine and print the array as recieved within | |
18 | # the subroutine. This should exercise GDB's ability to handle | |
19 | # different strides for the different dimensions. | |
20 | ||
21 | if {[skip_fortran_tests]} { return -1 } | |
22 | ||
23 | standard_testfile ".f90" | |
24 | ||
25 | if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ | |
26 | {debug f90}]} { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | if ![runto_main] { | |
31 | untested "could not run to main" | |
32 | return -1 | |
33 | } | |
34 | ||
35 | gdb_breakpoint "show" | |
36 | gdb_breakpoint [gdb_get_line_number "Final Breakpoint"] | |
37 | ||
38 | set array_contents \ | |
39 | [list \ | |
40 | " = \\(\\( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\) \\( 11, 12, 13, 14, 15, 16, 17, 18, 19, 20\\) \\( 21, 22, 23, 24, 25, 26, 27, 28, 29, 30\\) \\( 31, 32, 33, 34, 35, 36, 37, 38, 39, 40\\) \\( 41, 42, 43, 44, 45, 46, 47, 48, 49, 50\\) \\( 51, 52, 53, 54, 55, 56, 57, 58, 59, 60\\) \\( 61, 62, 63, 64, 65, 66, 67, 68, 69, 70\\) \\( 71, 72, 73, 74, 75, 76, 77, 78, 79, 80\\) \\( 81, 82, 83, 84, 85, 86, 87, 88, 89, 90\\) \\( 91, 92, 93, 94, 95, 96, 97, 98, 99, 100\\) \\)" \ | |
41 | " = \\(\\( 1, 2, 3, 4, 5\\) \\( 11, 12, 13, 14, 15\\) \\( 21, 22, 23, 24, 25\\) \\( 31, 32, 33, 34, 35\\) \\( 41, 42, 43, 44, 45\\) \\)" \ | |
42 | " = \\(\\( 1, 3, 5, 7, 9\\) \\( 21, 23, 25, 27, 29\\) \\( 41, 43, 45, 47, 49\\) \\( 61, 63, 65, 67, 69\\) \\( 81, 83, 85, 87, 89\\) \\)" \ | |
43 | " = \\(\\( 1, 4, 7, 10\\) \\( 21, 24, 27, 30\\) \\( 41, 44, 47, 50\\) \\( 61, 64, 67, 70\\) \\( 81, 84, 87, 90\\) \\)" \ | |
44 | " = \\(\\( 1, 5, 9\\) \\( 31, 35, 39\\) \\( 61, 65, 69\\) \\( 91, 95, 99\\) \\)" \ | |
45 | " = \\(\\( -26, -25, -24, -23, -22, -21, -20, -19, -18, -17\\) \\( -19, -18, -17, -16, -15, -14, -13, -12, -11, -10\\) \\( -12, -11, -10, -9, -8, -7, -6, -5, -4, -3\\) \\( -5, -4, -3, -2, -1, 0, 1, 2, 3, 4\\) \\( 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\\) \\( 9, 10, 11, 12, 13, 14, 15, 16, 17, 18\\) \\( 16, 17, 18, 19, 20, 21, 22, 23, 24, 25\\) \\( 23, 24, 25, 26, 27, 28, 29, 30, 31, 32\\) \\( 30, 31, 32, 33, 34, 35, 36, 37, 38, 39\\) \\( 37, 38, 39, 40, 41, 42, 43, 44, 45, 46\\) \\)" \ | |
46 | " = \\(\\( -26, -25, -24, -23, -22, -21\\) \\( -19, -18, -17, -16, -15, -14\\) \\( -12, -11, -10, -9, -8, -7\\) \\)" \ | |
47 | " = \\(\\( -26, -24, -22, -20, -18\\) \\( -5, -3, -1, 1, 3\\) \\( 16, 18, 20, 22, 24\\) \\( 37, 39, 41, 43, 45\\) \\)" ] | |
48 | ||
216a7e6b AB |
49 | set message_strings \ |
50 | [list \ | |
51 | " = 'array'" \ | |
52 | " = 'array \\(1:5,1:5\\)'" \ | |
53 | " = 'array \\(1:10:2,1:10:2\\)'" \ | |
54 | " = 'array \\(1:10:3,1:10:2\\)'" \ | |
55 | " = 'array \\(1:10:5,1:10:3\\)'" ] | |
56 | ||
5bbd8269 | 57 | set i 0 |
216a7e6b | 58 | foreach result $array_contents msg $message_strings { |
5bbd8269 AB |
59 | incr i |
60 | with_test_prefix "test $i" { | |
61 | gdb_continue_to_breakpoint "show" | |
62 | gdb_test "p array" $result | |
216a7e6b | 63 | gdb_test "p message" "$msg" |
5bbd8269 AB |
64 | } |
65 | } | |
66 | ||
67 | gdb_continue_to_breakpoint "continue to Final Breakpoint" |