Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2021-2022 Free Software Foundation, Inc. |
0a703a4c 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 | # Test using whatis and ptype on different configurations of dynamic | |
17 | # types. | |
18 | ||
19 | if {[skip_fortran_tests]} { return -1 } | |
20 | ||
21 | standard_testfile ".f90" | |
22 | load_lib fortran.exp | |
23 | ||
24 | if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ | |
25 | {debug f90}]} { | |
26 | return -1 | |
27 | } | |
28 | ||
29 | if {![fortran_runto_main]} { | |
30 | perror "Could not run to main." | |
31 | continue | |
32 | } | |
33 | ||
34 | gdb_breakpoint [gdb_get_line_number "Break Here"] | |
35 | gdb_continue_to_breakpoint "Break Here" | |
36 | ||
37 | gdb_test "whatis var1" "type = real\\(kind=4\\) \\(3\\)" | |
38 | gdb_test "whatis var2" "type = real\\(kind=4\\), allocatable \\(4\\)" | |
39 | gdb_test "whatis var3" "type = Type type1" | |
40 | gdb_test "whatis var4" "type = Type type2" | |
41 | gdb_test "whatis var5" "type = Type type3" | |
42 | gdb_test "whatis var6" "type = Type type4" | |
43 | gdb_test "whatis var7" "type = Type type5" | |
44 | gdb_test "ptype var1" "type = real\\(kind=4\\) \\(3\\)" | |
45 | gdb_test "ptype var2" "type = real\\(kind=4\\), allocatable \\(4\\)" | |
46 | gdb_test "ptype var3" \ | |
47 | [ multi_line "type = Type type1" \ | |
48 | " integer\\(kind=4\\) :: spacer" \ | |
49 | " integer\\(kind=4\\) :: t1_i" \ | |
50 | "End Type type1" ] | |
51 | gdb_test "ptype var4" \ | |
52 | [multi_line "type = Type type2" \ | |
53 | " integer\\(kind=4\\) :: spacer" \ | |
54 | " Type type1, allocatable :: t2_array\\(3\\)" \ | |
55 | "End Type type2"] | |
56 | gdb_test "ptype var5" \ | |
57 | [ multi_line "type = Type type3" \ | |
58 | " integer\\(kind=4\\) :: spacer" \ | |
59 | " Type type1 :: t3_array\\(3\\)"\ | |
60 | "End Type type3" ] | |
61 | gdb_test "ptype var6" \ | |
62 | [ multi_line "type = Type type4" \ | |
63 | " integer\\(kind=4\\) :: spacer" \ | |
64 | " Type type2, allocatable :: t4_array\\(3\\)" \ | |
65 | "End Type type4" ] | |
66 | gdb_test "ptype var7" \ | |
67 | [ multi_line "type = Type type5" \ | |
68 | " integer\\(kind=4\\) :: spacer" \ | |
69 | " Type type2 :: t5_array\\(4\\)" \ | |
70 | "End Type type5" ] | |
71 | gdb_test "whatis var3%t1_i" "type = integer\\(kind=4\\)" | |
72 | gdb_test "whatis var4%t2_array" "type = Type type1, allocatable \\(3\\)" | |
73 | gdb_test "whatis var5%t3_array" "type = Type type1 \\(3\\)" | |
74 | gdb_test "whatis var6%t4_array" "type = Type type2, allocatable \\(3\\)" | |
75 | gdb_test "whatis var7%t5_array" "type = Type type2 \\(4\\)" | |
fdae5c22 | 76 | gdb_test "ptype var3%t1_i" "type = integer\\(kind=4\\)" |
0a703a4c AB |
77 | gdb_test "ptype var4%t2_array" [ multi_line "type = Type type1" \ |
78 | " integer\\(kind=4\\) :: spacer" \ | |
79 | " integer\\(kind=4\\) :: t1_i" \ | |
80 | "End Type type1, allocatable \\(3\\)" ] | |
81 | gdb_test "ptype var5%t3_array" [ multi_line "type = Type type1" \ | |
82 | " integer\\(kind=4\\) :: spacer" \ | |
83 | " integer\\(kind=4\\) :: t1_i" \ | |
84 | "End Type type1 \\(3\\)" ] | |
85 | gdb_test "ptype var6%t4_array" \ | |
86 | [ multi_line "type = Type type2" \ | |
87 | " integer\\(kind=4\\) :: spacer" \ | |
88 | " Type type1, allocatable :: t2_array\\(:\\)" \ | |
89 | "End Type type2, allocatable \\(3\\)" ] | |
90 | gdb_test "ptype var7%t5_array" \ | |
91 | [ multi_line "type = Type type2" \ | |
92 | " integer\\(kind=4\\) :: spacer" \ | |
93 | " Type type1, allocatable :: t2_array\\(:\\)" \ | |
94 | "End Type type2 \\(4\\)" ] | |
95 | gdb_test "whatis var4%t2_array(1)" "type = Type type1" | |
96 | gdb_test "whatis var5%t3_array(1)" "type = Type type1" | |
97 | gdb_test "whatis var6%t4_array(1)" "type = Type type2" | |
98 | gdb_test "whatis var7%t5_array(1)" "type = Type type2" | |
99 | gdb_test "ptype var4%t2_array(1)" \ | |
100 | [ multi_line "type = Type type1" \ | |
101 | " integer\\(kind=4\\) :: spacer" \ | |
102 | " integer\\(kind=4\\) :: t1_i" \ | |
103 | "End Type type1" ] | |
104 | gdb_test "ptype var5%t3_array(1)" \ | |
105 | [ multi_line "type = Type type1" \ | |
106 | " integer\\(kind=4\\) :: spacer" \ | |
107 | " integer\\(kind=4\\) :: t1_i" \ | |
108 | "End Type type1" ] | |
109 | gdb_test "ptype var6%t4_array(1)" \ | |
110 | [ multi_line "type = Type type2" \ | |
111 | " integer\\(kind=4\\) :: spacer" \ | |
112 | " Type type1, allocatable :: t2_array\\(2\\)" \ | |
113 | "End Type type2" ] | |
114 | gdb_test "ptype var7%t5_array(1)" \ | |
115 | [ multi_line "type = Type type2" \ | |
116 | " integer\\(kind=4\\) :: spacer" \ | |
117 | " Type type1, allocatable :: t2_array\\(2\\)" \ | |
118 | "End Type type2" ] | |
119 | gdb_test "whatis var4%t2_array(1)%t1_i" "type = integer\\(kind=4\\)" | |
120 | gdb_test "whatis var5%t3_array(1)%t1_i" "type = integer\\(kind=4\\)" | |
121 | gdb_test "whatis var6%t4_array(1)%t2_array" \ | |
122 | "type = Type type1, allocatable \\(2\\)" | |
123 | gdb_test "whatis var7%t5_array(1)%t2_array" \ | |
124 | "type = Type type1, allocatable \\(2\\)" | |
125 | gdb_test "ptype var4%t2_array(1)%t1_i" "type = integer\\(kind=4\\)" | |
126 | gdb_test "ptype var5%t3_array(1)%t1_i" "type = integer\\(kind=4\\)" | |
127 | gdb_test "ptype var6%t4_array(1)%t2_array" \ | |
128 | [ multi_line "type = Type type1" \ | |
129 | " integer\\(kind=4\\) :: spacer" \ | |
130 | " integer\\(kind=4\\) :: t1_i" \ | |
131 | "End Type type1, allocatable \\(2\\)" ] | |
132 | gdb_test "ptype var7%t5_array(1)%t2_array" \ | |
133 | [ multi_line "type = Type type1" \ | |
134 | " integer\\(kind=4\\) :: spacer" \ | |
135 | " integer\\(kind=4\\) :: t1_i" \ | |
136 | "End Type type1, allocatable \\(2\\)" ] | |
137 | gdb_test "whatis var6%t4_array(1)%t2_array(1)" \ | |
138 | "type = Type type1" | |
139 | gdb_test "whatis var7%t5_array(1)%t2_array(1)" \ | |
140 | "type = Type type1" | |
141 | gdb_test "ptype var6%t4_array(1)%t2_array(1)" \ | |
142 | [ multi_line \ | |
143 | "type = Type type1" \ | |
144 | " integer\\(kind=4\\) :: spacer" \ | |
145 | " integer\\(kind=4\\) :: t1_i" \ | |
146 | "End Type type1" ] | |
147 | gdb_test "ptype var7%t5_array(1)%t2_array(1)" \ | |
148 | [ multi_line \ | |
149 | "type = Type type1" \ | |
150 | " integer\\(kind=4\\) :: spacer" \ | |
151 | " integer\\(kind=4\\) :: t1_i" \ | |
152 | "End Type type1" ] | |
153 | gdb_test "ptype var8%ptr_1%t2_array" \ | |
154 | [ multi_line \ | |
155 | "type = Type type1" \ | |
156 | " integer\\(kind=4\\) :: spacer" \ | |
157 | " integer\\(kind=4\\) :: t1_i" \ | |
158 | "End Type type1, allocatable \\(3\\)" ] |