gdb: Allow GDB to _not_ load a previous command history
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / info-modules.exp
CommitLineData
b811d2c2 1# Copyright 2019-2020 Free Software Foundation, Inc.
59c35742
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
165f8965
AB
16# This file tests 'info modules', 'info module functions', and 'info
17# module variables'.
59c35742
AB
18
19load_lib "fortran.exp"
d57cbee9 20load_lib "sym-info-cmds.exp"
59c35742
AB
21
22if { [skip_fortran_tests] } { continue }
23
24standard_testfile info-types.f90 info-types-2.f90
25
26if { [prepare_for_testing "failed to prepare" $testfile \
640ab947 27 [list $srcfile2 $srcfile] {debug f90}] } {
59c35742
AB
28 return -1
29}
30
31if { ![runto MAIN__] } {
32 perror "Could not run to breakpoint `MAIN__'."
33 continue
34}
35
165f8965
AB
36set logical4 [fortran_logical4]
37set integer4 [fortran_int4]
38set real4 [fortran_real4]
39
40# Test 'info modules' command.
41
d57cbee9
AB
42GDBInfoSymbols::run_command "info modules"
43GDBInfoSymbols::check_header "All defined modules:"
44GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
45GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
46GDBInfoSymbols::check_no_entry "${srcfile}"
47GDBInfoSymbols::check_no_entry "${srcfile2}"
48
49GDBInfoSymbols::run_command "info modules 1"
50GDBInfoSymbols::check_header \
51 "All modules matching regular expression \"1\":"
52GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
53GDBInfoSymbols::check_no_entry "${srcfile}"
54GDBInfoSymbols::check_no_entry "${srcfile2}"
55
56GDBInfoSymbols::run_command "info modules 2"
57GDBInfoSymbols::check_header \
58 "All modules matching regular expression \"2\":"
59GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
60GDBInfoSymbols::check_no_entry "${srcfile}"
61GDBInfoSymbols::check_no_entry "${srcfile2}"
62
63GDBInfoSymbols::run_command "info modules mod"
64GDBInfoSymbols::check_header \
65 "All modules matching regular expression \"mod\":"
66GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
67GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
68GDBInfoSymbols::check_no_entry "${srcfile}"
69GDBInfoSymbols::check_no_entry "${srcfile2}"
165f8965
AB
70
71# Test 'info module functions'.
72
d57cbee9
AB
73GDBInfoModuleSymbols::run_command "info module functions"
74GDBInfoModuleSymbols::check_header "All functions in all modules:"
75GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \
76 "void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);"
77GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "30" \
78 "${logical4} mod2::sub_m2_b\\(${real4}\\);"
79GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \
80 "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);"
81GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
82 "void mod1::sub_m1_a\\(${integer4}\\);"
83GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
84 "${integer4} mod1::sub_m1_b\\(void\\);"
85GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
86GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
87
88GDBInfoModuleSymbols::run_command "info module functions -m mod1"
89GDBInfoModuleSymbols::check_header \
90 "All functions in all modules matching regular expression \"mod1\":"
91GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \
92 "void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);"
93GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
94 "void mod1::sub_m1_a\\(${integer4}\\);"
95GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
96 "${integer4} mod1::sub_m1_b\\(void\\);"
97GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
98GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
99
100GDBInfoModuleSymbols::run_command "info module functions -t integer"
101GDBInfoModuleSymbols::check_header \
102 "All functions with type matching regular expression \"integer\" in all modules:"
103GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \
104 "void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);"
105GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
106 "void mod1::sub_m1_a\\(${integer4}\\);"
107GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
108 "${integer4} mod1::sub_m1_b\\(void\\);"
109GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
110GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
165f8965
AB
111
112# Test 'info module variables'.
113
d57cbee9
AB
114GDBInfoModuleSymbols::run_command "info module variables"
115GDBInfoModuleSymbols::check_header "All variables in all modules:"
116GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
117 "${integer4} mod2::mod2_var_1;"
118GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
119 "${real4} mod2::mod2_var_2;"
120GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \
121 "Type m1t1 mod1::__def_init_mod1_M1t1;"
122GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "35" \
123 "Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;"
124GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
125 "${real4} mod1::mod1_var_1;"
126GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "22" \
127 "${integer4} mod1::mod1_var_2;"
128GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
129GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
130
131GDBInfoModuleSymbols::run_command "info module variables -t real"
132GDBInfoModuleSymbols::check_header \
133 "All variables with type matching regular expression \"real\" in all modules:"
134GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
135 "${real4} mod2::mod2_var_2;"
136GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
137 "${real4} mod1::mod1_var_1;"
138GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
139GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
140
141GDBInfoModuleSymbols::run_command "info module variables -m mod2"
142GDBInfoModuleSymbols::check_header \
143 "All variables in all modules matching regular expression \"mod2\":"
144GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
145 "${integer4} mod2::mod2_var_1;"
146GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
147 "${real4} mod2::mod2_var_2;"
148GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
149GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
150
151GDBInfoModuleSymbols::run_command "info module variables -m mod2 -t real"
152GDBInfoModuleSymbols::check_header \
153 "All variables with type matching regular expression \"real\" in all modules matching regular expression \"mod2\":"
154GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
155 "${real4} mod2::mod2_var_2;"
156GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
157GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
158
159GDBInfoModuleSymbols::run_command "info module variables _1"
160GDBInfoModuleSymbols::check_header \
161 "All variables matching regular expression \"_1\" in all modules:"
162GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
163 "${integer4} mod2::mod2_var_1;"
164GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
165 "${real4} mod1::mod1_var_1;"
166GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
167GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
165f8965 168
This page took 0.083584 seconds and 4 git commands to generate.