Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / dynamic-ptype-whatis.exp
CommitLineData
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
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
37gdb_test "whatis var1" "type = real\\(kind=4\\) \\(3\\)"
38gdb_test "whatis var2" "type = real\\(kind=4\\), allocatable \\(4\\)"
39gdb_test "whatis var3" "type = Type type1"
40gdb_test "whatis var4" "type = Type type2"
41gdb_test "whatis var5" "type = Type type3"
42gdb_test "whatis var6" "type = Type type4"
43gdb_test "whatis var7" "type = Type type5"
44gdb_test "ptype var1" "type = real\\(kind=4\\) \\(3\\)"
45gdb_test "ptype var2" "type = real\\(kind=4\\), allocatable \\(4\\)"
46gdb_test "ptype var3" \
47 [ multi_line "type = Type type1" \
48 " integer\\(kind=4\\) :: spacer" \
49 " integer\\(kind=4\\) :: t1_i" \
50 "End Type type1" ]
51gdb_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"]
56gdb_test "ptype var5" \
57 [ multi_line "type = Type type3" \
58 " integer\\(kind=4\\) :: spacer" \
59 " Type type1 :: t3_array\\(3\\)"\
60 "End Type type3" ]
61gdb_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" ]
66gdb_test "ptype var7" \
67 [ multi_line "type = Type type5" \
68 " integer\\(kind=4\\) :: spacer" \
69 " Type type2 :: t5_array\\(4\\)" \
70 "End Type type5" ]
71gdb_test "whatis var3%t1_i" "type = integer\\(kind=4\\)"
72gdb_test "whatis var4%t2_array" "type = Type type1, allocatable \\(3\\)"
73gdb_test "whatis var5%t3_array" "type = Type type1 \\(3\\)"
74gdb_test "whatis var6%t4_array" "type = Type type2, allocatable \\(3\\)"
75gdb_test "whatis var7%t5_array" "type = Type type2 \\(4\\)"
fdae5c22 76gdb_test "ptype var3%t1_i" "type = integer\\(kind=4\\)"
0a703a4c
AB
77gdb_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\\)" ]
81gdb_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\\)" ]
85gdb_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\\)" ]
90gdb_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\\)" ]
95gdb_test "whatis var4%t2_array(1)" "type = Type type1"
96gdb_test "whatis var5%t3_array(1)" "type = Type type1"
97gdb_test "whatis var6%t4_array(1)" "type = Type type2"
98gdb_test "whatis var7%t5_array(1)" "type = Type type2"
99gdb_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" ]
104gdb_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" ]
109gdb_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" ]
114gdb_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" ]
119gdb_test "whatis var4%t2_array(1)%t1_i" "type = integer\\(kind=4\\)"
120gdb_test "whatis var5%t3_array(1)%t1_i" "type = integer\\(kind=4\\)"
121gdb_test "whatis var6%t4_array(1)%t2_array" \
122 "type = Type type1, allocatable \\(2\\)"
123gdb_test "whatis var7%t5_array(1)%t2_array" \
124 "type = Type type1, allocatable \\(2\\)"
125gdb_test "ptype var4%t2_array(1)%t1_i" "type = integer\\(kind=4\\)"
126gdb_test "ptype var5%t3_array(1)%t1_i" "type = integer\\(kind=4\\)"
127gdb_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\\)" ]
132gdb_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\\)" ]
137gdb_test "whatis var6%t4_array(1)%t2_array(1)" \
138 "type = Type type1"
139gdb_test "whatis var7%t5_array(1)%t2_array(1)" \
140 "type = Type type1"
141gdb_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" ]
147gdb_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" ]
153gdb_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\\)" ]
This page took 0.094792 seconds and 4 git commands to generate.