1 # Copyright 2019 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Some basic testing of 'info variables'.
18 standard_testfile info-var-f1.c info-var-f2.c
20 if {[prepare_for_testing "failed to prepare" \
21 "${testfile}" "$srcfile $srcfile2" "debug"]} {
25 if ![runto_main] then {
26 fail "can't run to main"
30 gdb_test "info variables" \
32 "All defined variables:" \
34 "File .*${srcfile}:" \
35 "18:\[ \t\]+static int f1_var;" \
37 "File .*${srcfile2}:" \
38 "18:\[ \t\]+int global_var;" \
39 "20:\[ \t\]+static int f2_var;" \
41 "Non-debugging symbols:" \
44 gdb_test "info variables -n" \
46 "All defined variables:" \
48 "File .*${srcfile}:" \
49 "18:\[ \t\]+static int f1_var;" \
51 "File .*${srcfile2}:" \
52 "18:\[ \t\]+int global_var;" \
53 "20:\[ \t\]+static int f2_var;" ]
55 gdb_test "info variables -n global" \
57 "All variables matching regular expression \"global\":" \
59 "File .*${srcfile2}:" \
60 "18:\[ \t\]+int global_var;" ]