]>
Commit | Line | Data |
---|---|---|
3666a048 | 1 | # Copyright (C) 2014-2021 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 | ||
19 | standard_testfile | |
20 | ||
93df4a1d SM |
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 | } | |
0ff33695 PA |
26 | } |
27 | ||
0ff33695 | 28 | if ![runto_main] { |
cfc75767 | 29 | fail "can't run to main" |
0ff33695 PA |
30 | return |
31 | } | |
32 | ||
33 | set linenum [gdb_get_line_number "set break here"] | |
34 | gdb_breakpoint "$linenum" | |
35 | ||
36 | gdb_test "c -a&" "Continuing\\." | |
37 | ||
38 | set test "no stop" | |
39 | gdb_test_multiple "" $test { | |
40 | -timeout 1 | |
41 | timeout { | |
42 | pass $test | |
43 | } | |
44 | } | |
45 | ||
46 | # Paranoia. Check that input works after bg command. | |
47 | gdb_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. | |
52 | set saw_continuing 0 | |
53 | set test "c -a" | |
54 | gdb_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. | |
66 | send_gdb "print 2\n" | |
67 | ||
68 | # Poor buggy GDB would crash before the breakpoint was hit. | |
69 | set test "breakpoint hit" | |
70 | gdb_test_multiple "" $test { | |
71 | -re "set break here ..\r\n$gdb_prompt " { | |
72 | pass $test | |
73 | } | |
74 | } | |
75 | ||
76 | set test "print command result" | |
77 | gdb_test_multiple "" $test { | |
78 | -re " = 2\r\n$gdb_prompt $" { | |
79 | pass $test | |
80 | } | |
81 | } |