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