1# Copyright 2019-2020 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 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 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 29gdb_test "info variables" \ 30 [multi_line \ 31 "All defined variables:" \ 32 "" \ 33 "File .*${srcfile}:" \ 34 "18:\[ \t\]+static int f1_var;" \ 35 "" \ 36 "File .*${srcfile2}:" \ 37 "18:\[ \t\]+int global_var;" \ 38 "20:\[ \t\]+static int f2_var;" \ 39 "(" \ 40 "File .*:(" \ 41 "$decimal:.*" \ 42 ")+)*" \ 43 "Non-debugging symbols:" \ 44 ".*"] 45 46gdb_test "info variables -n" \ 47 [multi_line \ 48 "All defined variables:" \ 49 "" \ 50 "File .*${srcfile}:" \ 51 "18:\[ \t\]+static int f1_var;" \ 52 "" \ 53 "File .*${srcfile2}:" \ 54 "18:\[ \t\]+int global_var;" \ 55 "20:\[ \t\]+static int f2_var;(" \ 56 "" \ 57 "File .*:(" \ 58 "$decimal:.*)+)*"] 59 60gdb_test "info variables -n global" \ 61 [multi_line \ 62 "All variables matching regular expression \"global\":" \ 63 "" \ 64 "File .*${srcfile2}:" \ 65 "18:\[ \t\]+int global_var;" ] 66