]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/continue-all-already-running.exp
39435814d2bf34f9f00a94b953d913bc81e8a8d9
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / continue-all-already-running.exp
1 # Copyright (C) 2014-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 # Test that "c -a" doesn't leave GDB processing input, even if all
17 # threads were already running. PR gdb/17300.
18
19 standard_testfile
20
21 save_vars { GDBFLAGS } {
22 set GDBFLAGS "$GDBFLAGS -ex \"set non-stop on\""
23 if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile] } {
24 return -1
25 }
26 }
27
28 if ![runto_main] {
29 return
30 }
31
32 set linenum [gdb_get_line_number "set break here"]
33 gdb_breakpoint "$linenum"
34
35 gdb_test "c -a&" "Continuing\\."
36
37 set test "no stop"
38 gdb_test_multiple "" $test {
39 -timeout 1
40 timeout {
41 pass $test
42 }
43 }
44
45 # Paranoia. Check that input works after bg command.
46 gdb_test "print 1" " = 1"
47
48 # Continue in the foreground, and wait one second to make sure the
49 # inferior really starts running. If we get a prompt to soon (e.g.,
50 # the program stops), this issues a fail.
51 set saw_continuing 0
52 set test "c -a"
53 gdb_test_multiple "c -a" $test {
54 -timeout 1
55 -re "Continuing\\." {
56 set saw_continuing 1
57 exp_continue
58 }
59 timeout {
60 gdb_assert $saw_continuing $test
61 }
62 }
63
64 # Type something while the inferior is running in the foreground.
65 send_gdb "print 2\n"
66
67 # Poor buggy GDB would crash before the breakpoint was hit.
68 set test "breakpoint hit"
69 gdb_test_multiple "" $test {
70 -re "set break here ..\r\n$gdb_prompt " {
71 pass $test
72 }
73 }
74
75 set test "print command result"
76 gdb_test_multiple "" $test {
77 -re " = 2\r\n$gdb_prompt $" {
78 pass $test
79 }
80 }