]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2021-2023 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 | ||
15868bc8 NCK |
37 | set real4 [fortran_real4] |
38 | set int4 [fortran_int4] | |
39 | ||
40 | gdb_test "whatis var1" "type = ${real4} \\(3\\)" | |
41 | gdb_test "whatis var2" "type = ${real4}, allocatable \\(4\\)" | |
0a703a4c AB |
42 | gdb_test "whatis var3" "type = Type type1" |
43 | gdb_test "whatis var4" "type = Type type2" | |
44 | gdb_test "whatis var5" "type = Type type3" | |
45 | gdb_test "whatis var6" "type = Type type4" | |
46 | gdb_test "whatis var7" "type = Type type5" | |
15868bc8 NCK |
47 | gdb_test "ptype var1" "type = ${real4} \\(3\\)" |
48 | gdb_test "ptype var2" "type = ${real4}, allocatable \\(4\\)" | |
0a703a4c AB |
49 | gdb_test "ptype var3" \ |
50 | [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
51 | " ${int4} :: spacer" \ |
52 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
53 | "End Type type1" ] |
54 | gdb_test "ptype var4" \ | |
55 | [multi_line "type = Type type2" \ | |
15868bc8 | 56 | " ${int4} :: spacer" \ |
0a703a4c AB |
57 | " Type type1, allocatable :: t2_array\\(3\\)" \ |
58 | "End Type type2"] | |
59 | gdb_test "ptype var5" \ | |
60 | [ multi_line "type = Type type3" \ | |
15868bc8 | 61 | " ${int4} :: spacer" \ |
0a703a4c AB |
62 | " Type type1 :: t3_array\\(3\\)"\ |
63 | "End Type type3" ] | |
64 | gdb_test "ptype var6" \ | |
65 | [ multi_line "type = Type type4" \ | |
15868bc8 | 66 | " ${int4} :: spacer" \ |
0a703a4c AB |
67 | " Type type2, allocatable :: t4_array\\(3\\)" \ |
68 | "End Type type4" ] | |
69 | gdb_test "ptype var7" \ | |
70 | [ multi_line "type = Type type5" \ | |
15868bc8 | 71 | " ${int4} :: spacer" \ |
0a703a4c AB |
72 | " Type type2 :: t5_array\\(4\\)" \ |
73 | "End Type type5" ] | |
15868bc8 | 74 | gdb_test "whatis var3%t1_i" "type = ${int4}" |
0a703a4c AB |
75 | gdb_test "whatis var4%t2_array" "type = Type type1, allocatable \\(3\\)" |
76 | gdb_test "whatis var5%t3_array" "type = Type type1 \\(3\\)" | |
77 | gdb_test "whatis var6%t4_array" "type = Type type2, allocatable \\(3\\)" | |
78 | gdb_test "whatis var7%t5_array" "type = Type type2 \\(4\\)" | |
15868bc8 | 79 | gdb_test "ptype var3%t1_i" "type = ${int4}" |
0a703a4c | 80 | gdb_test "ptype var4%t2_array" [ multi_line "type = Type type1" \ |
15868bc8 NCK |
81 | " ${int4} :: spacer" \ |
82 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
83 | "End Type type1, allocatable \\(3\\)" ] |
84 | gdb_test "ptype var5%t3_array" [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
85 | " ${int4} :: spacer" \ |
86 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
87 | "End Type type1 \\(3\\)" ] |
88 | gdb_test "ptype var6%t4_array" \ | |
89 | [ multi_line "type = Type type2" \ | |
15868bc8 | 90 | " ${int4} :: spacer" \ |
0a703a4c AB |
91 | " Type type1, allocatable :: t2_array\\(:\\)" \ |
92 | "End Type type2, allocatable \\(3\\)" ] | |
93 | gdb_test "ptype var7%t5_array" \ | |
94 | [ multi_line "type = Type type2" \ | |
15868bc8 | 95 | " ${int4} :: spacer" \ |
0a703a4c AB |
96 | " Type type1, allocatable :: t2_array\\(:\\)" \ |
97 | "End Type type2 \\(4\\)" ] | |
98 | gdb_test "whatis var4%t2_array(1)" "type = Type type1" | |
99 | gdb_test "whatis var5%t3_array(1)" "type = Type type1" | |
100 | gdb_test "whatis var6%t4_array(1)" "type = Type type2" | |
101 | gdb_test "whatis var7%t5_array(1)" "type = Type type2" | |
102 | gdb_test "ptype var4%t2_array(1)" \ | |
103 | [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
104 | " ${int4} :: spacer" \ |
105 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
106 | "End Type type1" ] |
107 | gdb_test "ptype var5%t3_array(1)" \ | |
108 | [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
109 | " ${int4} :: spacer" \ |
110 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
111 | "End Type type1" ] |
112 | gdb_test "ptype var6%t4_array(1)" \ | |
113 | [ multi_line "type = Type type2" \ | |
15868bc8 | 114 | " ${int4} :: spacer" \ |
0a703a4c AB |
115 | " Type type1, allocatable :: t2_array\\(2\\)" \ |
116 | "End Type type2" ] | |
117 | gdb_test "ptype var7%t5_array(1)" \ | |
118 | [ multi_line "type = Type type2" \ | |
15868bc8 | 119 | " ${int4} :: spacer" \ |
0a703a4c AB |
120 | " Type type1, allocatable :: t2_array\\(2\\)" \ |
121 | "End Type type2" ] | |
15868bc8 NCK |
122 | gdb_test "whatis var4%t2_array(1)%t1_i" "type = ${int4}" |
123 | gdb_test "whatis var5%t3_array(1)%t1_i" "type = ${int4}" | |
0a703a4c AB |
124 | gdb_test "whatis var6%t4_array(1)%t2_array" \ |
125 | "type = Type type1, allocatable \\(2\\)" | |
126 | gdb_test "whatis var7%t5_array(1)%t2_array" \ | |
127 | "type = Type type1, allocatable \\(2\\)" | |
15868bc8 NCK |
128 | gdb_test "ptype var4%t2_array(1)%t1_i" "type = ${int4}" |
129 | gdb_test "ptype var5%t3_array(1)%t1_i" "type = ${int4}" | |
0a703a4c AB |
130 | gdb_test "ptype var6%t4_array(1)%t2_array" \ |
131 | [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
132 | " ${int4} :: spacer" \ |
133 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
134 | "End Type type1, allocatable \\(2\\)" ] |
135 | gdb_test "ptype var7%t5_array(1)%t2_array" \ | |
136 | [ multi_line "type = Type type1" \ | |
15868bc8 NCK |
137 | " ${int4} :: spacer" \ |
138 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
139 | "End Type type1, allocatable \\(2\\)" ] |
140 | gdb_test "whatis var6%t4_array(1)%t2_array(1)" \ | |
141 | "type = Type type1" | |
142 | gdb_test "whatis var7%t5_array(1)%t2_array(1)" \ | |
143 | "type = Type type1" | |
144 | gdb_test "ptype var6%t4_array(1)%t2_array(1)" \ | |
145 | [ multi_line \ | |
146 | "type = Type type1" \ | |
15868bc8 NCK |
147 | " ${int4} :: spacer" \ |
148 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
149 | "End Type type1" ] |
150 | gdb_test "ptype var7%t5_array(1)%t2_array(1)" \ | |
151 | [ multi_line \ | |
152 | "type = Type type1" \ | |
15868bc8 NCK |
153 | " ${int4} :: spacer" \ |
154 | " ${int4} :: t1_i" \ | |
0a703a4c AB |
155 | "End Type type1" ] |
156 | gdb_test "ptype var8%ptr_1%t2_array" \ | |
157 | [ multi_line \ | |
158 | "type = Type type1" \ | |
15868bc8 NCK |
159 | " ${int4} :: spacer" \ |
160 | " ${int4} :: t1_i" \ | |
0a703a4c | 161 | "End Type type1, allocatable \\(3\\)" ] |