Commit | Line | Data |
---|---|---|
59c35742 AB |
1 | # Copyright 2019 Free Software Foundation, Inc. |
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" | |
20 | ||
21 | if { [skip_fortran_tests] } { continue } | |
22 | ||
23 | standard_testfile info-types.f90 info-types-2.f90 | |
24 | ||
25 | if { [prepare_for_testing "failed to prepare" $testfile \ | |
26 | [list $srcfile $srcfile2] {debug f90}] } { | |
27 | return -1 | |
28 | } | |
29 | ||
30 | if { ![runto MAIN__] } { | |
31 | perror "Could not run to breakpoint `MAIN__'." | |
32 | continue | |
33 | } | |
34 | ||
165f8965 AB |
35 | set logical4 [fortran_logical4] |
36 | set integer4 [fortran_int4] | |
37 | set real4 [fortran_real4] | |
38 | ||
39 | # Test 'info modules' command. | |
40 | ||
59c35742 AB |
41 | gdb_test "info modules" \ |
42 | [multi_line \ | |
43 | "All defined modules:" \ | |
44 | "" \ | |
45 | "File .*${srcfile2}:" \ | |
46 | "18:\[\t \]+mod2" \ | |
47 | "" \ | |
48 | "File .*${srcfile}:" \ | |
49 | "16:\[\t \]+mod1" ] | |
50 | ||
51 | gdb_test "info modules 1" \ | |
52 | [multi_line \ | |
53 | "All modules matching regular expression \"1\":" \ | |
54 | "" \ | |
55 | "File .*${srcfile}:" \ | |
56 | "16:\[\t \]+mod1" ] | |
57 | ||
58 | gdb_test "info modules 2" \ | |
59 | [multi_line \ | |
60 | "All modules matching regular expression \"2\":" \ | |
61 | "" \ | |
62 | "File .*${srcfile2}:" \ | |
63 | "18:\[\t \]+mod2" ] | |
64 | ||
65 | gdb_test "info modules mod" \ | |
66 | [multi_line \ | |
67 | "All modules matching regular expression \"mod\":" \ | |
68 | "" \ | |
69 | "File .*${srcfile2}:" \ | |
70 | "18:\[\t \]+mod2" \ | |
71 | "" \ | |
72 | "File .*${srcfile}:" \ | |
73 | "16:\[\t \]+mod1" ] | |
165f8965 AB |
74 | |
75 | # Test 'info module functions'. | |
76 | ||
77 | gdb_test "info module functions" \ | |
78 | [multi_line \ | |
79 | "All functions in all modules:" \ | |
80 | "" \ | |
81 | "Module \"mod2\":" \ | |
82 | "" \ | |
83 | "File .*${srcfile2}:" \ | |
84 | "22:\[\t \]+void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" \ | |
85 | "30:\[\t \]+${logical4} mod2::sub_m2_b\\(${real4}\\);" \ | |
86 | "" \ | |
87 | "Module \"mod1\":" \ | |
88 | "" \ | |
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\\);" ] | |
93 | ||
94 | gdb_test "info module functions -m mod1" \ | |
95 | [multi_line \ | |
96 | "All functions in all modules matching regular expression \"mod1\":" \ | |
97 | "" \ | |
98 | "Module \"mod1\":" \ | |
99 | "" \ | |
100 | "File .*:" \ | |
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\\);" ] | |
104 | ||
105 | gdb_test "info module functions -t integer" \ | |
106 | [multi_line \ | |
107 | "All functions with type matching regular expression \"integer\" in all modules:" \ | |
108 | "" \ | |
109 | "Module \"mod2\":" \ | |
110 | "" \ | |
111 | "File .*${srcfile2}:" \ | |
112 | "22:\[\t \]+void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);" \ | |
113 | "" \ | |
114 | "Module \"mod1\":" \ | |
115 | "" \ | |
116 | "File .*${srcfile}:" \ | |
117 | "25:\[\t \]+void mod1::sub_m1_a\\(${integer4}\\);" \ | |
118 | "31:\[\t \]+${integer4} mod1::sub_m1_b\\(void\\);" ] | |
119 | ||
120 | # Test 'info module variables'. | |
121 | ||
122 | gdb_test "info module variables" \ | |
123 | [multi_line \ | |
124 | "All variables in all modules:" \ | |
125 | "" \ | |
126 | "Module \"mod2\":" \ | |
127 | "" \ | |
128 | "File .*${srcfile2}:" \ | |
129 | "19:\[\t \]+${integer4} mod2::mod2_var_1;" \ | |
130 | "20:\[\t \]+${real4} mod2::mod2_var_2;" \ | |
131 | "" \ | |
132 | "Module \"mod1\":" \ | |
133 | "" \ | |
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;" ] | |
139 | ||
140 | gdb_test "info module variables -t real" \ | |
141 | [multi_line \ | |
142 | "All variables with type matching regular expression \"real\" in all modules:" \ | |
143 | "" \ | |
144 | "Module \"mod2\":" \ | |
145 | "" \ | |
146 | "File .*:" \ | |
147 | "20:\[\t \]+${real4} mod2::mod2_var_2;" \ | |
148 | "" \ | |
149 | "Module \"mod1\":" \ | |
150 | "" \ | |
151 | "File .*:" \ | |
152 | "21:\[\t \]+${real4} mod1::mod1_var_1;" ] | |
153 | ||
154 | gdb_test "info module variables -m mod2" \ | |
155 | [multi_line \ | |
156 | "All variables in all modules matching regular expression \"mod2\":" \ | |
157 | "" \ | |
158 | "Module \"mod2\":" \ | |
159 | "" \ | |
160 | "File .*${srcfile2}:" \ | |
161 | "19:\[\t \]+${integer4} mod2::mod2_var_1;" \ | |
162 | "20:\[\t \]+${real4} mod2::mod2_var_2;" ] | |
163 | ||
164 | gdb_test "info module variables -m mod2 -t real" \ | |
165 | [multi_line \ | |
166 | "All variables with type matching regular expression \"real\"" \ | |
167 | " in all modules matching regular expression \"mod2\":" \ | |
168 | "" \ | |
169 | "Module \"mod2\":" \ | |
170 | "" \ | |
171 | "File .*${srcfile2}:" \ | |
172 | "20:\[\t \]+${real4} mod2::mod2_var_2;" ] | |
173 | ||
174 | gdb_test "info module variables _1" \ | |
175 | [multi_line \ | |
176 | "All variables matching regular expression \"_1\" in all modules:" \ | |
177 | "" \ | |
178 | "Module \"mod2\":" \ | |
179 | "" \ | |
180 | "File .*:" \ | |
181 | "19:\[\t \]+${integer4} mod2::mod2_var_1;" \ | |
182 | "" \ | |
183 | "Module \"mod1\":" \ | |
184 | "" \ | |
185 | "File .*:" \ | |
186 | "21:\[\t \]+${real4} mod1::mod1_var_1;" ] | |
187 |