1 # Copyright
(C
) 2014-2019 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Test that repeating a background command doesn
't lose the "&" in the
17 # repeat, turning a background command into a foreground command. See
22 if { [build_executable "failed to prepare" ${testfile} $srcfile] } {
26 set linenum [gdb_get_line_number "set break here"]
28 # Run the test proper. CONTINUE_CMD is the background continue
31 proc test {continue_cmd} {
36 clean_restart $binfile
42 gdb_breakpoint "$linenum"
44 set test $continue_cmd
45 gdb_test_multiple $test $test {
46 -re "Continuing\\.\r\n$gdb_prompt " {
47 # Note no end anchor. If the breakpoint triggers soon enough
48 # enough we see further output after the prompt.
53 # Wait for the stop. Don't expect a prompt
, as we had resumed the
54 # inferior in the background.
55 set test
"breakpoint hit 1"
56 gdb_test_multiple
"" $test {
57 -re
"set break here" {
62 # Trigger a repeat. Buggy GDB used to lose the
"&", making this a
63 # foreground command...
65 gdb_test
"" "Continuing\\." "repeat bg command"
67 # ... and thus further input wouldn
't be processed until the target
69 gdb_test "print 1" " = 1" "input still accepted"
71 # Make sure we see a stop after the print, and not before. Don't
72 # expect a prompt
, as we had resumed the inferior in the background.
73 set test
"breakpoint hit 2"
74 gdb_test_multiple
"" $test {
75 -re
"set break here ..\r\n" {
81 # Test with and without extra arguments.
82 foreach cmd
{"c&" "c 1&"} {
83 with_test_prefix $cmd
{