]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/info-var.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / info-var.exp
CommitLineData
213516ef 1# Copyright 2019-2023 Free Software Foundation, Inc.
4acfdd20
AB
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
18standard_testfile info-var-f1.c info-var-f2.c
19
20if {[prepare_for_testing "failed to prepare" \
21 "${testfile}" "$srcfile $srcfile2" "debug"]} {
22 return -1
23}
24
98b0ebab
PW
25# Note: we do not run to main, as otherwise, the output of info variables
26# can be very long, showing thousands of glibc variables.
27# This long output then causes expect's buffer to overflow.
4acfdd20
AB
28
29gdb_test "info variables" \
30 [multi_line \
31 "All defined variables:" \
32 "" \
33 "File .*${srcfile}:" \
77791f9c
AB
34 "19:\\s+int \\* const foo_1\\\[3\\\];" \
35 "20:\\s+const int \\*foo_2\\\[3\\\];" \
36 "21:\\s+int \\*foo_3\\\[3\\\];" \
37 "22:\\s+const int foo_4\\\[3\\\];" \
38 "23:\\s+const int foo_5\\\[3\\\];" \
39 "24:\\s+int foo_6\\\[3\\\];" \
40 "26:\\s+static int f1_var;" \
4acfdd20
AB
41 "" \
42 "File .*${srcfile2}:" \
43 "18:\[ \t\]+int global_var;" \
44 "20:\[ \t\]+static int f2_var;" \
48352473
TV
45 "(" \
46 "File .*:(" \
47 "$decimal:.*" \
48 ")+)*" \
4acfdd20
AB
49 "Non-debugging symbols:" \
50 ".*"]
51
52gdb_test "info variables -n" \
53 [multi_line \
54 "All defined variables:" \
55 "" \
56 "File .*${srcfile}:" \
77791f9c
AB
57 "19:\\s+int \\* const foo_1\\\[3\\\];" \
58 "20:\\s+const int \\*foo_2\\\[3\\\];" \
59 "21:\\s+int \\*foo_3\\\[3\\\];" \
60 "22:\\s+const int foo_4\\\[3\\\];" \
61 "23:\\s+const int foo_5\\\[3\\\];" \
62 "24:\\s+int foo_6\\\[3\\\];" \
63 "26:\\s+static int f1_var;" \
4acfdd20
AB
64 "" \
65 "File .*${srcfile2}:" \
66 "18:\[ \t\]+int global_var;" \
48352473
TV
67 "20:\[ \t\]+static int f2_var;(" \
68 "" \
69 "File .*:(" \
70 "$decimal:.*)+)*"]
4acfdd20
AB
71
72gdb_test "info variables -n global" \
73 [multi_line \
74 "All variables matching regular expression \"global\":" \
75 "" \
76 "File .*${srcfile2}:" \
77 "18:\[ \t\]+int global_var;" ]