blob: e6c515ff70fdff2b2bfe843cc00d3de35c2b5439 (
plain)
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
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# Copyright 2019-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/>.
# This file tests 'info modules', 'info module functions', and 'info
# module variables'.
load_lib "fortran.exp"
load_lib "sym-info-cmds.exp"
require allow_fortran_tests
standard_testfile info-types.f90 info-types-2.f90
if { [prepare_for_testing "failed to prepare" $testfile \
[list $srcfile2 $srcfile] {debug f90}] } {
return -1
}
# Avoid shared lib symbols.
gdb_test_no_output "set auto-solib-add off"
if { ![fortran_runto_main] } {
perror "Could not run to main."
return
}
# Avoid libc symbols.
gdb_test "nosharedlibrary"
set logical4 [fortran_logical4]
set integer4 [fortran_int4]
set real4 [fortran_real4]
# Test 'info modules' command.
GDBInfoSymbols::run_command "info modules"
GDBInfoSymbols::check_header "All defined modules:"
GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
GDBInfoSymbols::check_no_entry "${srcfile}"
GDBInfoSymbols::check_no_entry "${srcfile2}"
GDBInfoSymbols::run_command "info modules 1"
GDBInfoSymbols::check_header \
"All modules matching regular expression \"1\":"
GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
GDBInfoSymbols::check_no_entry "${srcfile}"
GDBInfoSymbols::check_no_entry "${srcfile2}"
GDBInfoSymbols::run_command "info modules 2"
GDBInfoSymbols::check_header \
"All modules matching regular expression \"2\":"
GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
GDBInfoSymbols::check_no_entry "${srcfile}"
GDBInfoSymbols::check_no_entry "${srcfile2}"
GDBInfoSymbols::run_command "info modules mod"
GDBInfoSymbols::check_header \
"All modules matching regular expression \"mod\":"
GDBInfoSymbols::check_entry "${srcfile2}" "18" "mod2"
GDBInfoSymbols::check_entry "${srcfile}" "16" "mod1"
GDBInfoSymbols::check_no_entry "${srcfile}"
GDBInfoSymbols::check_no_entry "${srcfile2}"
# Test 'info module functions'.
GDBInfoModuleSymbols::run_command "info module functions"
GDBInfoModuleSymbols::check_header "All functions in all modules:"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \
"void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "30" \
"${logical4} mod2::sub_m2_b\\(${real4}\\);"
GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \
"void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
"void mod1::sub_m1_a\\(${integer4}\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
"${integer4} mod1::sub_m1_b\\(void\\);"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module functions -m mod1"
GDBInfoModuleSymbols::check_header \
"All functions in all modules matching regular expression \"mod1\":"
GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "35" \
"void mod1::__copy_mod1_M1t1\\(Type m1t1, Type m1t1\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
"void mod1::sub_m1_a\\(${integer4}\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
"${integer4} mod1::sub_m1_b\\(void\\);"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module functions -t integer"
GDBInfoModuleSymbols::check_header \
"All functions with type matching regular expression \"integer\" in all modules:"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "22" \
"void mod2::sub_m2_a\\(${integer4}, ${logical4}\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "25" \
"void mod1::sub_m1_a\\(${integer4}\\);"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "31" \
"${integer4} mod1::sub_m1_b\\(void\\);"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
# Test 'info module variables'.
GDBInfoModuleSymbols::run_command "info module variables"
GDBInfoModuleSymbols::check_header "All variables in all modules:"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
"${integer4} mod2::mod2_var_1;"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
"${real4} mod2::mod2_var_2;"
GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \
"Type m1t1 mod1::__def_init_mod1_M1t1;"
GDBInfoModuleSymbols::check_optional_entry "${srcfile}" "mod1" "(35)?" \
"Type __vtype_mod1_M1t1 mod1::__vtab_mod1_M1t1;"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
"${real4} mod1::mod1_var_1;"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "22" \
"${integer4} mod1::mod1_var_2;"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module variables -t real"
GDBInfoModuleSymbols::check_header \
"All variables with type matching regular expression \"real\" in all modules:"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
"${real4} mod2::mod2_var_2;"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
"${real4} mod1::mod1_var_1;"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module variables -m mod2"
GDBInfoModuleSymbols::check_header \
"All variables in all modules matching regular expression \"mod2\":"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
"${integer4} mod2::mod2_var_1;"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
"${real4} mod2::mod2_var_2;"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module variables -m mod2 -t real"
GDBInfoModuleSymbols::check_header \
"All variables with type matching regular expression \"real\" in all modules matching regular expression \"mod2\":"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "20" \
"${real4} mod2::mod2_var_2;"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
GDBInfoModuleSymbols::run_command "info module variables _1"
GDBInfoModuleSymbols::check_header \
"All variables matching regular expression \"_1\" in all modules:"
GDBInfoModuleSymbols::check_entry "${srcfile2}" "mod2" "19" \
"${integer4} mod2::mod2_var_1;"
GDBInfoModuleSymbols::check_entry "${srcfile}" "mod1" "21" \
"${real4} mod1::mod1_var_1;"
GDBInfoModuleSymbols::check_no_entry "${srcfile}" ".*"
GDBInfoModuleSymbols::check_no_entry "${srcfile2}" ".*"
|