]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/info-var.exp
gdb: Add new -n flag to some info commands
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / info-var.exp
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
16 # Some basic testing of 'info variables'.
17
18 standard_testfile info-var-f1.c info-var-f2.c
19
20 if {[prepare_for_testing "failed to prepare" \
21 "${testfile}" "$srcfile $srcfile2" "debug"]} {
22 return -1
23 }
24
25 if ![runto_main] then {
26 fail "can't run to main"
27 return 0
28 }
29
30 gdb_test "info variables" \
31 [multi_line \
32 "All defined variables:" \
33 "" \
34 "File .*${srcfile}:" \
35 "18:\[ \t\]+static int f1_var;" \
36 "" \
37 "File .*${srcfile2}:" \
38 "18:\[ \t\]+int global_var;" \
39 "20:\[ \t\]+static int f2_var;" \
40 "" \
41 "Non-debugging symbols:" \
42 ".*"]
43
44 gdb_test "info variables -n" \
45 [multi_line \
46 "All defined variables:" \
47 "" \
48 "File .*${srcfile}:" \
49 "18:\[ \t\]+static int f1_var;" \
50 "" \
51 "File .*${srcfile2}:" \
52 "18:\[ \t\]+int global_var;" \
53 "20:\[ \t\]+static int f2_var;" ]
54
55 gdb_test "info variables -n global" \
56 [multi_line \
57 "All variables matching regular expression \"global\":" \
58 "" \
59 "File .*${srcfile2}:" \
60 "18:\[ \t\]+int global_var;" ]