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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
# Copyright 2021-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/> .
# Test using whatis and ptype on different configurations of dynamic
# types.
require allow_fortran_tests
standard_testfile ".f90"
load_lib fortran.exp
if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
{debug f90}]} {
return -1
}
if {![fortran_runto_main]} {
perror "Could not run to main."
continue
}
gdb_breakpoint [gdb_get_line_number "Break Here"]
gdb_continue_to_breakpoint "Break Here"
set real4 [fortran_real4]
set int4 [fortran_int4]
gdb_test "whatis var1" "type = ${real4} \\(3\\)"
gdb_test "whatis var2" "type = ${real4}, allocatable \\(4\\)"
gdb_test "whatis var3" "type = Type type1"
gdb_test "whatis var4" "type = Type type2"
gdb_test "whatis var5" "type = Type type3"
gdb_test "whatis var6" "type = Type type4"
gdb_test "whatis var7" "type = Type type5"
gdb_test "ptype var1" "type = ${real4} \\(3\\)"
gdb_test "ptype var2" "type = ${real4}, allocatable \\(4\\)"
gdb_test "ptype var3" \
[ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1" ]
gdb_test "ptype var4" \
[multi_line "type = Type type2" \
" ${int4} :: spacer" \
" Type type1, allocatable :: t2_array\\(3\\)" \
"End Type type2"]
gdb_test "ptype var5" \
[ multi_line "type = Type type3" \
" ${int4} :: spacer" \
" Type type1 :: t3_array\\(3\\)"\
"End Type type3" ]
gdb_test "ptype var6" \
[ multi_line "type = Type type4" \
" ${int4} :: spacer" \
" Type type2, allocatable :: t4_array\\(3\\)" \
"End Type type4" ]
gdb_test "ptype var7" \
[ multi_line "type = Type type5" \
" ${int4} :: spacer" \
" Type type2 :: t5_array\\(4\\)" \
"End Type type5" ]
gdb_test "whatis var3%t1_i" "type = ${int4}"
gdb_test "whatis var4%t2_array" "type = Type type1, allocatable \\(3\\)"
gdb_test "whatis var5%t3_array" "type = Type type1 \\(3\\)"
gdb_test "whatis var6%t4_array" "type = Type type2, allocatable \\(3\\)"
gdb_test "whatis var7%t5_array" "type = Type type2 \\(4\\)"
gdb_test "ptype var3%t1_i" "type = ${int4}"
gdb_test "ptype var4%t2_array" [ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1, allocatable \\(3\\)" ]
gdb_test "ptype var5%t3_array" [ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1 \\(3\\)" ]
gdb_test "ptype var6%t4_array" \
[ multi_line "type = Type type2" \
" ${int4} :: spacer" \
" Type type1, allocatable :: t2_array\\(:\\)" \
"End Type type2, allocatable \\(3\\)" ]
gdb_test "ptype var7%t5_array" \
[ multi_line "type = Type type2" \
" ${int4} :: spacer" \
" Type type1, allocatable :: t2_array\\(:\\)" \
"End Type type2 \\(4\\)" ]
gdb_test "whatis var4%t2_array(1)" "type = Type type1"
gdb_test "whatis var5%t3_array(1)" "type = Type type1"
gdb_test "whatis var6%t4_array(1)" "type = Type type2"
gdb_test "whatis var7%t5_array(1)" "type = Type type2"
gdb_test "ptype var4%t2_array(1)" \
[ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1" ]
gdb_test "ptype var5%t3_array(1)" \
[ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1" ]
gdb_test "ptype var6%t4_array(1)" \
[ multi_line "type = Type type2" \
" ${int4} :: spacer" \
" Type type1, allocatable :: t2_array\\(2\\)" \
"End Type type2" ]
gdb_test "ptype var7%t5_array(1)" \
[ multi_line "type = Type type2" \
" ${int4} :: spacer" \
" Type type1, allocatable :: t2_array\\(2\\)" \
"End Type type2" ]
gdb_test "whatis var4%t2_array(1)%t1_i" "type = ${int4}"
gdb_test "whatis var5%t3_array(1)%t1_i" "type = ${int4}"
gdb_test "whatis var6%t4_array(1)%t2_array" \
"type = Type type1, allocatable \\(2\\)"
gdb_test "whatis var7%t5_array(1)%t2_array" \
"type = Type type1, allocatable \\(2\\)"
gdb_test "ptype var4%t2_array(1)%t1_i" "type = ${int4}"
gdb_test "ptype var5%t3_array(1)%t1_i" "type = ${int4}"
gdb_test "ptype var6%t4_array(1)%t2_array" \
[ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1, allocatable \\(2\\)" ]
gdb_test "ptype var7%t5_array(1)%t2_array" \
[ multi_line "type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1, allocatable \\(2\\)" ]
gdb_test "whatis var6%t4_array(1)%t2_array(1)" \
"type = Type type1"
gdb_test "whatis var7%t5_array(1)%t2_array(1)" \
"type = Type type1"
gdb_test "ptype var6%t4_array(1)%t2_array(1)" \
[ multi_line \
"type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1" ]
gdb_test "ptype var7%t5_array(1)%t2_array(1)" \
[ multi_line \
"type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1" ]
gdb_test "ptype var8%ptr_1%t2_array" \
[ multi_line \
"type = Type type1" \
" ${int4} :: spacer" \
" ${int4} :: t1_i" \
"End Type type1, allocatable \\(3\\)" ]
|