Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / continue-all-already-running.exp
CommitLineData
88b9d363 1# Copyright (C) 2014-2022 Free Software Foundation, Inc.
0ff33695
PA
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
19standard_testfile
20
93df4a1d
SM
21save_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 }
0ff33695
PA
26}
27
0ff33695 28if ![runto_main] {
cfc75767 29 fail "can't run to main"
0ff33695
PA
30 return
31}
32
33set linenum [gdb_get_line_number "set break here"]
34gdb_breakpoint "$linenum"
35
36gdb_test "c -a&" "Continuing\\."
37
38set test "no stop"
39gdb_test_multiple "" $test {
40 -timeout 1
41 timeout {
42 pass $test
43 }
44}
45
46# Paranoia. Check that input works after bg command.
47gdb_test "print 1" " = 1"
48
49# Continue in the foreground, and wait one second to make sure the
50# inferior really starts running. If we get a prompt to soon (e.g.,
51# the program stops), this issues a fail.
52set saw_continuing 0
53set test "c -a"
54gdb_test_multiple "c -a" $test {
55 -timeout 1
56 -re "Continuing\\." {
57 set saw_continuing 1
58 exp_continue
59 }
60 timeout {
61 gdb_assert $saw_continuing $test
62 }
63}
64
65# Type something while the inferior is running in the foreground.
66send_gdb "print 2\n"
67
68# Poor buggy GDB would crash before the breakpoint was hit.
69set test "breakpoint hit"
70gdb_test_multiple "" $test {
71 -re "set break here ..\r\n$gdb_prompt " {
72 pass $test
73 }
74}
75
76set test "print command result"
77gdb_test_multiple "" $test {
78 -re " = 2\r\n$gdb_prompt $" {
79 pass $test
80 }
81}
This page took 1.054225 seconds and 4 git commands to generate.