]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - 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
1 # Copyright 2019-2024 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 # 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.
28
29 gdb_test "info variables" \
30 [multi_line \
31 "All defined variables:" \
32 "" \
33 "File .*${srcfile}:" \
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;" \
41 "" \
42 "File .*${srcfile2}:" \
43 "18:\[ \t\]+int global_var;" \
44 "20:\[ \t\]+static int f2_var;" \
45 "(" \
46 "File .*:(" \
47 "$decimal:.*" \
48 ")+)*" \
49 "Non-debugging symbols:" \
50 ".*"]
51
52 gdb_test "info variables -n" \
53 [multi_line \
54 "All defined variables:" \
55 "" \
56 "File .*${srcfile}:" \
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;" \
64 "" \
65 "File .*${srcfile2}:" \
66 "18:\[ \t\]+int global_var;" \
67 "20:\[ \t\]+static int f2_var;(" \
68 "" \
69 "File .*:(" \
70 "$decimal:.*)+)*"]
71
72 gdb_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;" ]