Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. |
9d6e6e84 HZ |
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 | if [is_remote target] then { | |
17 | # Testing with remote/non-stop is racy at the moment. | |
18 | unsupported "Testing dprintf with remote/non-stop is not supported." | |
19 | return 0 | |
20 | } | |
21 | ||
22 | standard_testfile | |
23 | ||
24 | if [prepare_for_testing "failed to prepare for dprintf with non-stop" \ | |
25 | ${testfile} ${srcfile} {debug}] { | |
26 | return -1 | |
27 | } | |
28 | ||
29 | gdb_test_no_output "set target-async on" | |
30 | gdb_test_no_output "set non-stop on" | |
31 | ||
32 | if ![runto main] { | |
33 | fail "Can't run to main" | |
34 | return -1 | |
35 | } | |
36 | ||
37 | gdb_test "dprintf foo,\"At foo entry\\n\"" "Dprintf .*" | |
38 | ||
39 | gdb_test "continue &" "Continuing\\." | |
40 | ||
41 | # Wait for the dprintf to trigger. | |
42 | set test "dprintf triggered" | |
43 | gdb_expect { | |
44 | -re "At foo entry" { | |
45 | pass "$test" | |
46 | } | |
47 | timeout { | |
48 | fail "$test (timeout)" | |
49 | } | |
50 | } | |
51 | ||
52 | # Now test that we're still able to issue commands. GDB used to | |
53 | # implement re-resuming from dprintfs with a synchronous "continue" in | |
54 | # the dprintf's command list, which stole the prompt from the user. | |
55 | set test "interrupt" | |
56 | gdb_test_multiple $test $test { | |
57 | -re "interrupt\r\n$gdb_prompt " { | |
58 | pass $test | |
59 | } | |
60 | } | |
61 | ||
62 | set test "inferior stopped" | |
63 | gdb_test_multiple "" $test { | |
64 | -re "\r\n\\\[.* \[0-9\]+\\\] #1 stopped\\\.\r\n" { | |
65 | pass $test | |
66 | } | |
67 | } |