]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/source-open.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / source-open.exp
CommitLineData
1d506c26 1# Copyright 2021-2024 Free Software Foundation, Inc.
fde1a9a3
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# Test the 'set source open on|off' command.
17
18standard_testfile
19
20if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
21 return -1
22}
23
24gdb_test "show source open" "Source opening is \"on\"\\." \
25 "source opening is initially on"
26gdb_test_no_output "set listsize 1"
27gdb_test_no_output "set source open on"
28gdb_test "list 18" "18\t#include <stdio.h>" "source reading on"
29
30# File opening is turned off therefore source lines are not printed.
31gdb_test_no_output "set source open off"
32gdb_test "show source open" "Source opening is \"off\"\\." \
33 "source opening is now off"
34gdb_test "list 18" "18\tin .*/${srcfile}" "source reading off"
35
36gdb_test "forward-search main" "source code access disabled"
37gdb_test "reverse-search main" "source code access disabled"
38
39# And finally, turn source code reading back on.
40gdb_test_no_output "set source open on" \
41 "turn source reading back on"
42gdb_test "show source open" "Source opening is \"on\"\\." \
43 "source opening is on again"
44gdb_test "list 18" "18\t#include <stdio.h>" "source reading on again"