]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/dynamic-ptype-whatis.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / dynamic-ptype-whatis.exp
CommitLineData
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
19if {[skip_fortran_tests]} { return -1 }
20
21standard_testfile ".f90"
22load_lib fortran.exp
23
24if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
25 {debug f90}]} {
26 return -1
27}
28
29if {![fortran_runto_main]} {
30 perror "Could not run to main."
31 continue
32}
33
34gdb_breakpoint [gdb_get_line_number "Break Here"]
35gdb_continue_to_breakpoint "Break Here"
36
15868bc8
NCK
37set real4 [fortran_real4]
38set int4 [fortran_int4]
39
40gdb_test "whatis var1" "type = ${real4} \\(3\\)"
41gdb_test "whatis var2" "type = ${real4}, allocatable \\(4\\)"
0a703a4c
AB
42gdb_test "whatis var3" "type = Type type1"
43gdb_test "whatis var4" "type = Type type2"
44gdb_test "whatis var5" "type = Type type3"
45gdb_test "whatis var6" "type = Type type4"
46gdb_test "whatis var7" "type = Type type5"
15868bc8
NCK
47gdb_test "ptype var1" "type = ${real4} \\(3\\)"
48gdb_test "ptype var2" "type = ${real4}, allocatable \\(4\\)"
0a703a4c
AB
49gdb_test "ptype var3" \
50 [ multi_line "type = Type type1" \
15868bc8
NCK
51 " ${int4} :: spacer" \
52 " ${int4} :: t1_i" \
0a703a4c
AB
53 "End Type type1" ]
54gdb_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"]
59gdb_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" ]
64gdb_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" ]
69gdb_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 74gdb_test "whatis var3%t1_i" "type = ${int4}"
0a703a4c
AB
75gdb_test "whatis var4%t2_array" "type = Type type1, allocatable \\(3\\)"
76gdb_test "whatis var5%t3_array" "type = Type type1 \\(3\\)"
77gdb_test "whatis var6%t4_array" "type = Type type2, allocatable \\(3\\)"
78gdb_test "whatis var7%t5_array" "type = Type type2 \\(4\\)"
15868bc8 79gdb_test "ptype var3%t1_i" "type = ${int4}"
0a703a4c 80gdb_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\\)" ]
84gdb_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\\)" ]
88gdb_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\\)" ]
93gdb_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\\)" ]
98gdb_test "whatis var4%t2_array(1)" "type = Type type1"
99gdb_test "whatis var5%t3_array(1)" "type = Type type1"
100gdb_test "whatis var6%t4_array(1)" "type = Type type2"
101gdb_test "whatis var7%t5_array(1)" "type = Type type2"
102gdb_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" ]
107gdb_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" ]
112gdb_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" ]
117gdb_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
122gdb_test "whatis var4%t2_array(1)%t1_i" "type = ${int4}"
123gdb_test "whatis var5%t3_array(1)%t1_i" "type = ${int4}"
0a703a4c
AB
124gdb_test "whatis var6%t4_array(1)%t2_array" \
125 "type = Type type1, allocatable \\(2\\)"
126gdb_test "whatis var7%t5_array(1)%t2_array" \
127 "type = Type type1, allocatable \\(2\\)"
15868bc8
NCK
128gdb_test "ptype var4%t2_array(1)%t1_i" "type = ${int4}"
129gdb_test "ptype var5%t3_array(1)%t1_i" "type = ${int4}"
0a703a4c
AB
130gdb_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\\)" ]
135gdb_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\\)" ]
140gdb_test "whatis var6%t4_array(1)%t2_array(1)" \
141 "type = Type type1"
142gdb_test "whatis var7%t5_array(1)%t2_array(1)" \
143 "type = Type type1"
144gdb_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" ]
150gdb_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" ]
156gdb_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\\)" ]