fix up gdb.trace
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interact.exp
CommitLineData
28e7fd62 1# Copyright 2011-2013 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.
18set fd [open "zzz-gdbscript" "w"]
19puts $fd "print 1"
20puts $fd "print 2"
21close $fd
22
23# The expected output from the script...
24set script_output "\\$\[0-9\]+ = 1\[\r\n\]+\\$\[0-9\]+ = 2.*"
25
26# Start a fresh GDB. We don't need an executable for this test, so
27# nothing else to do in terms of testcase setup.
28gdb_exit
29gdb_start
30
6b0c4c1f
JB
31# Test sourcing of the script with interactive mode `auto'.
32# Verify that evaluating the script does not cause an unexpected
33# change of the interactive-mode setting.
de8fa76c
JB
34gdb_test_no_output "set interactive-mode auto"
35gdb_test "source zzz-gdbscript" "$script_output" \
36 "source script with interactive-mode auto"
37gdb_test "print 3" "= 3" "sanity check with interactive-mode auto"
6b0c4c1f
JB
38gdb_test "show interactive-mode" \
39 "Debugger's interactive mode is auto \\(currently .*\\)\\." \
40 "show interactive-mode (auto)"
de8fa76c 41
6b0c4c1f
JB
42# Test sourcing of the script with interactive mode `on'.
43# Verify that evaluating the script does not cause an unexpected
44# change of the interactive-mode setting.
de8fa76c
JB
45gdb_test_no_output "set interactive-mode on"
46gdb_test "source zzz-gdbscript" "$script_output" \
47 "source script with interactive-mode on"
48gdb_test "print 4" "= 4" "sanity check with interactive-mode on"
6b0c4c1f
JB
49gdb_test "show interactive-mode" \
50 "Debugger's interactive mode is on\\." \
51 "show interactive-mode (on)"
de8fa76c 52
6b0c4c1f
JB
53# Test sourcing of the script with interactive mode `off'.
54# Verify that evaluating the script does not cause an unexpected
55# change of the interactive-mode setting.
de8fa76c
JB
56gdb_test_no_output "set interactive-mode off"
57gdb_test "source zzz-gdbscript" "$script_output" \
58 "source script with interactive-mode off"
59gdb_test "print 5" "= 5" "sanity check with interactive-mode off"
6b0c4c1f
JB
60gdb_test "show interactive-mode" \
61 "Debugger's interactive mode is off\\." \
62 "show interactive-mode (off)"
de8fa76c 63
This page took 0.372973 seconds and 4 git commands to generate.