]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.base/interact.exp
Automatic Copyright Year update after running gdb/copyright.py
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / interact.exp
CommitLineData
4a94e368 1# Copyright 2011-2022 Free Software Foundation, Inc.
de8fa76c
JB
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# Create a GDB script that we can source. The script needs to generate
17# some output, to allow us to verify that it is executed properly.
08b3fe69
TT
18set script [standard_output_file zzz-gdbscript]
19set fd [open $script "w"]
de8fa76c
JB
20puts $fd "print 1"
21puts $fd "print 2"
22close $fd
23
24# The expected output from the script...
25set script_output "\\$\[0-9\]+ = 1\[\r\n\]+\\$\[0-9\]+ = 2.*"
26
27# Start a fresh GDB. We don't need an executable for this test, so
28# nothing else to do in terms of testcase setup.
29gdb_exit
30gdb_start
31
6b0c4c1f
JB
32# Test sourcing of the script with interactive mode `auto'.
33# Verify that evaluating the script does not cause an unexpected
34# change of the interactive-mode setting.
de8fa76c 35gdb_test_no_output "set interactive-mode auto"
08b3fe69 36gdb_test "source $script" "$script_output" \
de8fa76c
JB
37 "source script with interactive-mode auto"
38gdb_test "print 3" "= 3" "sanity check with interactive-mode auto"
6b0c4c1f
JB
39gdb_test "show interactive-mode" \
40 "Debugger's interactive mode is auto \\(currently .*\\)\\." \
41 "show interactive-mode (auto)"
de8fa76c 42
6b0c4c1f
JB
43# Test sourcing of the script with interactive mode `on'.
44# Verify that evaluating the script does not cause an unexpected
45# change of the interactive-mode setting.
de8fa76c 46gdb_test_no_output "set interactive-mode on"
08b3fe69 47gdb_test "source $script" "$script_output" \
de8fa76c
JB
48 "source script with interactive-mode on"
49gdb_test "print 4" "= 4" "sanity check with interactive-mode on"
6b0c4c1f
JB
50gdb_test "show interactive-mode" \
51 "Debugger's interactive mode is on\\." \
52 "show interactive-mode (on)"
de8fa76c 53
6b0c4c1f
JB
54# Test sourcing of the script with interactive mode `off'.
55# Verify that evaluating the script does not cause an unexpected
56# change of the interactive-mode setting.
de8fa76c 57gdb_test_no_output "set interactive-mode off"
08b3fe69 58gdb_test "source $script" "$script_output" \
de8fa76c
JB
59 "source script with interactive-mode off"
60gdb_test "print 5" "= 5" "sanity check with interactive-mode off"
6b0c4c1f
JB
61gdb_test "show interactive-mode" \
62 "Debugger's interactive mode is off\\." \
63 "show interactive-mode (off)"
de8fa76c 64