1 # This testcase is part of GDB
, the GNU debugger.
3 # Copyright
2018-2024 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 if {![runto setup_done
]} {
39 ############# Test
'info functions'.
41 with_test_prefix
"info functions nameregexp" {
43 "info functions info_fun"
44 "info functions -- info_fun"
45 "info functions ^info_fun" } {
48 "All functions matching regular expression \".*info_fun.*\":" \
51 "${number}: void info_fun1\\\(void\\\);" \
52 "${number}: int info_fun2\\\(char\\\);" \
53 "${number}: int info_fun2bis\\\(char\\\);" \
54 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
55 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
60 with_test_prefix
"info functions nameregexp quiet" {
62 "info functions -q info_fun"
63 "info functions -q -- info_fun" } {
68 "${number}: void info_fun1\\\(void\\\);" \
69 "${number}: int info_fun2\\\(char\\\);" \
70 "${number}: int info_fun2bis\\\(char\\\);" \
71 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
72 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
77 with_test_prefix
"info functions nameregexp quiet no match" {
79 "info functions -q nowaythiscanmatch"
80 "info functions -q -- -q" } {
81 gdb_test_no_output $cmd
85 with_test_prefix
"info functions typeregexp nameregexp" {
87 "info functions -t entier -q info_fun"
88 "info functions -q -t 'entier (' -- info_fun"
89 "info functions -q -t '(char, int, int)' -- info_fun"
90 "info functions -q -t 'entier (char, int, int)' -- info_fun" } {
95 "${number}: entier info_fun2xxx\\\(char, int, int\\\);" \
96 "${number}: entier info_fun2yyy\\\(char, int, int\\\);" \
101 with_test_prefix
"info functions typeregexp nameregexp no match" {
102 gdb_test_no_output
"info functions -t ganze_Zahl -q info_fun" \
103 "quiet output info functions no matching type"
106 ############# Test
'info variables'.
108 with_test_prefix
"info variables nameregexp" {
110 "info variables info_qt"
111 "info variables -- info_qt"
112 "info variables ^info_qt" } {
115 "All variables matching regular expression \".*info_qt.*\":" \
117 "File .*info_qt.c:" \
118 "${number}: entier info_qt_ent;" \
119 "${number}: int info_qt_inc;" \
124 with_test_prefix
"info variables nameregexp quiet no match" {
126 "info variables -q nowaythiscanmatch"
127 "info variables -q -- -q" } {
128 gdb_test_no_output $cmd
132 with_test_prefix
"info variables typeregexp nameregexp quiet" {
134 "info variables -t entier -q info_qt"
135 "info variables -q -t entier -- info_qt" } {
139 "File .*info_qt.c:" \
140 "${number}: entier info_qt_ent;" \
145 with_test_prefix
"info variables typeregexp nameregexp quiet no match" {
146 gdb_test_no_output
"info variables -t ganze_Zahl -q info_at" \
147 "quiet output info variables no matching type"
152 ############# Test
'info args' in function setup.
154 gdb_test
"frame 1" ".* in setup .*" "set frame 1 for info args"
156 with_test_prefix
"info args matching all args" {
161 "info args -- .*" } {
171 with_test_prefix
"info args matching some args" {
174 "info args arg_[ij]"} {
183 with_test_prefix
"info args no match" {
184 gdb_test
"info args nowaythiscanmatch" "No matching arguments." "no matching args"
185 gdb_test_no_output
"info args -q nowaythiscanmatch" "quiet no matching args"
186 gdb_test_no_output
"info args -q -t entier" "quiet no matching args with type"
189 ############# Test
'info locals' in function setup.
191 gdb_test
"frame 1" ".* in setup .*" "set frame 1 for info locals"
193 with_test_prefix
"info locals matching all locals" {
196 "info locals loc_arg_"
198 "info locals -- .*" } {
201 "loc_arg_c = 100 'd'" \
208 with_test_prefix
"info locals matching some locals" {
211 "info locals arg_[ij]"
212 "info locals loc_arg_[ij]"} {
221 with_test_prefix
"info locals no match" {
222 gdb_test
"info locals nowaythiscanmatch" "No matching locals." "no matching locals"
223 gdb_test_no_output
"info locals -q nowaythiscanmatch" "quiet no matching locals"
224 gdb_test_no_output
"info locals -q -t ganze_Zahl loc" "quiet no matching locals with type"
227 # Verify that the rest of the
args is taken as a single regexp.
228 with_test_prefix
"rest of args as single regexp" {
229 gdb_test
"info functions abc def" \
230 "All functions matching regular expression \\\"abc def\\\":" \
233 gdb_test
"info functions -t uvw abc def" \
234 "All functions matching regular expression \\\"abc def\\\" with type matching regular expression \\\"uvw\\\":" \
235 "-t noquote single regexp"
237 gdb_test
"info functions -t 'uvw xyz' abc def" \
238 "All functions matching regular expression \\\"abc def\\\" with type matching regular expression \\\"uvw xyz\\\":" \
239 "-t quote single regexp"