1 # This testcase is part of GDB
, the GNU debugger.
3 # Copyright
2018-2019 Free Software Foundation
, Inc.
5 # This
program is free software
; you can redistribute it and
/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation
; either version
3 of the License
, or
8 #
(at your option
) any later version.
10 # This
program is distributed in the hope that it will be useful
,
11 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License
for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
19 # This test verifies the TYPEREGEXP and NAMEREGEXP matching logic
21 #
info [args|functions|locals|variables
] [-q
] [-t TYPEREGEXP
] [NAMEREGEXP
].
26 if { [prepare_for_testing
"failed to prepare" ${testfile}] } {
30 clean_restart $
{binfile
}
32 if ![runto setup_done
] then {
33 fail
"can't run to setup_done"
42 ############# Test
'info functions'.
44 with_test_prefix
"info functions nameregexp" {
46 "info functions info_fun"
47 "info functions -- info_fun"
48 "info functions ^info_fun" } {
51 "All functions matching regular expression \".*info_fun.*\":" \
54 "${number}: void info_fun1\\\(void\\\);" \
55 "${number}: int info_fun2\\\(char\\\);" \
56 "${number}: int info_fun2bis\\\(char\\\);" \
57 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
58 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
63 with_test_prefix
"info functions nameregexp quiet" {
65 "info functions -q info_fun"
66 "info functions -q -- info_fun" } {
71 "${number}: void info_fun1\\\(void\\\);" \
72 "${number}: int info_fun2\\\(char\\\);" \
73 "${number}: int info_fun2bis\\\(char\\\);" \
74 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
75 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
80 with_test_prefix
"info functions nameregexp quiet no match" {
82 "info functions -q nowaythiscanmatch"
83 "info functions -q -- -q" } {
84 gdb_test_no_output $cmd
88 with_test_prefix
"info functions typeregexp nameregexp" {
90 "info functions -t entier -q info_fun"
91 "info functions -q -t 'entier (' -- info_fun"
92 "info functions -q -t '(char, int, int)' -- info_fun"
93 "info functions -q -t 'entier (char, int, int)' -- info_fun" } {
98 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
99 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
104 with_test_prefix
"info functions typeregexp nameregexp no match" {
105 gdb_test_no_output
"info functions -t ganze_Zahl -q info_fun" \
106 "quiet output info functions no matching type"
109 ############# Test
'info variables'.
111 with_test_prefix
"info variables nameregexp" {
113 "info variables info_qt"
114 "info variables -- info_qt"
115 "info variables ^info_qt" } {
118 "All variables matching regular expression \".*info_qt.*\":" \
120 "File .*info_qt.c:" \
121 "${number}: entier info_qt_ent;" \
122 "${number}: int info_qt_inc;" \
127 with_test_prefix
"info variables nameregexp quiet no match" {
129 "info variables -q nowaythiscanmatch"
130 "info variables -q -- -q" } {
131 gdb_test_no_output $cmd
135 with_test_prefix
"info variables typeregexp nameregexp quiet" {
137 "info variables -t entier -q info_qt"
138 "info variables -q -t entier -- info_qt" } {
142 "File .*info_qt.c:" \
143 "${number}: entier info_qt_ent;" \
148 with_test_prefix
"info variables typeregexp nameregexp quiet no match" {
149 gdb_test_no_output
"info variables -t ganze_Zahl -q info_at" \
150 "quiet output info variables no matching type"
155 ############# Test
'info args' in function setup.
157 gdb_test
"frame 1" ".* in setup .*" "set frame 1 for info args"
159 with_test_prefix
"info args matching all args" {
164 "info args -- .*" } {
174 with_test_prefix
"info args matching some args" {
177 "info args arg_[ij]"} {
186 with_test_prefix
"info args no match" {
187 gdb_test
"info args nowaythiscanmatch" "No matching arguments." "no matching args"
188 gdb_test_no_output
"info args -q nowaythiscanmatch" "quiet no matching args"
189 gdb_test_no_output
"info args -q -t entier" "quiet no matching args with type"
192 ############# Test
'info locals' in function setup.
194 gdb_test
"frame 1" ".* in setup .*" "set frame 1 for info locals"
196 with_test_prefix
"info locals matching all locals" {
199 "info locals loc_arg_"
201 "info locals -- .*" } {
204 "loc_arg_c = 100 'd'" \
211 with_test_prefix
"info locals matching some locals" {
214 "info locals arg_[ij]"
215 "info locals loc_arg_[ij]"} {
224 with_test_prefix
"info locals no match" {
225 gdb_test
"info locals nowaythiscanmatch" "No matching locals." "no matching locals"
226 gdb_test_no_output
"info locals -q nowaythiscanmatch" "quiet no matching locals"
227 gdb_test_no_output
"info locals -q -t ganze_Zahl loc" "quiet no matching locals with type"
230 # Verify that the rest of the
args is taken as a single regexp.
231 with_test_prefix
"rest of args as single regexp" {
232 gdb_test
"info functions abc def" \
233 "All functions matching regular expression \\\"abc def\\\":" \
236 gdb_test
"info functions -t uvw abc def" \
237 "All functions matching regular expression \\\"abc def\\\" with type matching regular expression \\\"uvw\\\":" \
238 "-t noquote single regexp"
240 gdb_test
"info functions -t 'uvw xyz' abc def" \
241 "All functions matching regular expression \\\"abc def\\\" with type matching regular expression \\\"uvw xyz\\\":" \
242 "-t quote single regexp"