1 # Copyright 2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # This file tests 'info modules', 'info module functions', and 'info
19 load_lib "fortran.exp"
21 if { [skip_fortran_tests] } { continue }
23 standard_testfile info-types.f90 info-types-2.f90
25 if { [prepare_for_testing "failed to prepare" $testfile \
26 [list $srcfile2 $srcfile] {debug f90}] } {
30 if { ![runto MAIN__] } {
31 perror "Could not run to breakpoint `MAIN__'."
35 set logical4 [fortran_logical4]
36 set integer4 [fortran_int4]
37 set real4 [fortran_real4]
39 # Test 'info modules' command.
41 gdb_test "info modules" \
43 "All defined modules:" \
45 "File .*${srcfile2}:" \
48 "File .*${srcfile}:" \
51 gdb_test "info modules 1" \
53 "All modules matching regular expression \"1\":" \
55 "File .*${srcfile}:" \
58 gdb_test "info modules 2" \
60 "All modules matching regular expression \"2\":" \
62 "File .*${srcfile2}:" \
65 gdb_test "info modules mod" \
67 "All modules matching regular expression \"mod\":" \
69 "File .*${srcfile2}:" \
72 "File .*${srcfile}:" \
75 # Test 'info module functions'.
77 gdb_test "info module functions" \
79 "All functions in all modules:" \
83 "File .*${srcfile2}:" \
84 "22:\[\t \]+void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" \
85 "30:\[\t \]+${logical4} mod2::sub_m2_b\\(${real4}\\);" \
89 "File .*${srcfile}:" \
90 "35:\[\t \]+void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" \
91 "25:\[\t \]+void mod1::sub_m1_a\\(${integer4}\\);" \
92 "31:\[\t \]+${integer4} mod1::sub_m1_b\\(void\\);" ]
94 gdb_test "info module functions -m mod1" \
96 "All functions in all modules matching regular expression \"mod1\":" \
101 "35:\[\t \]+void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);" \
102 "25:\[\t \]+void mod1::sub_m1_a\\(${integer4}\\);" \
103 "31:\[\t \]+${integer4} mod1::sub_m1_b\\(void\\);" ]
105 gdb_test "info module functions -t integer" \
107 "All functions with type matching regular expression \"integer\" in all modules:" \
111 "File .*${srcfile2}:" \
112 "22:\[\t \]+void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" \
116 "File .*${srcfile}:" \
117 "25:\[\t \]+void mod1::sub_m1_a\\(${integer4}\\);" \
118 "31:\[\t \]+${integer4} mod1::sub_m1_b\\(void\\);" ]
120 # Test 'info module variables'.
122 gdb_test "info module variables" \
124 "All variables in all modules:" \
128 "File .*${srcfile2}:" \
129 "19:\[\t \]+${integer4} mod2::mod2_var_1;" \
130 "20:\[\t \]+${real4} mod2::mod2_var_2;" \
134 "File .*${srcfile}:" \
135 "35:\[\t \]+Type m1t1 mod1::__def_init_mod1_M1t1;" \
136 "35:\[\t \]+Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;" \
137 "21:\[\t \]+${real4} mod1::mod1_var_1;" \
138 "22:\[\t \]+${integer4} mod1::mod1_var_2;" ]
140 gdb_test "info module variables -t real" \
142 "All variables with type matching regular expression \"real\" in all modules:" \
147 "20:\[\t \]+${real4} mod2::mod2_var_2;" \
152 "21:\[\t \]+${real4} mod1::mod1_var_1;" ]
154 gdb_test "info module variables -m mod2" \
156 "All variables in all modules matching regular expression \"mod2\":" \
160 "File .*${srcfile2}:" \
161 "19:\[\t \]+${integer4} mod2::mod2_var_1;" \
162 "20:\[\t \]+${real4} mod2::mod2_var_2;" ]
164 gdb_test "info module variables -m mod2 -t real" \
166 "All variables with type matching regular expression \"real\"" \
167 " in all modules matching regular expression \"mod2\":" \
171 "File .*${srcfile2}:" \
172 "20:\[\t \]+${real4} mod2::mod2_var_2;" ]
174 gdb_test "info module variables _1" \
176 "All variables matching regular expression \"_1\" in all modules:" \
181 "19:\[\t \]+${integer4} mod2::mod2_var_1;" \
186 "21:\[\t \]+${real4} mod1::mod1_var_1;" ]