Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.base / long-inferior-output.exp
blob58fd715a5c58f51776be2bf108caf01dda89c73d
1 # Copyright 2017-2023 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 # When debugging with "target remote |", the inferior's output is
17 # connected to a pipe, and if GDB doesn't flush the pipe while the
18 # inferior is running and the pipe becomes full, then the inferior
19 # deadlocks:
21 #  1. User sets breakpoint, and types "continue"
23 #  2. Inferior prints to stdout/stderr before reaching breakpoint
24 #     location.
26 #  3. The output pipe becomes full, so the inferior blocks forever in
27 #     the printf/write call.
29 #  4. The breakpoint is never reached.
31 if [target_info exists gdb,noinferiorio] {
32     verbose "Skipping because of noinferiorio."
33     return
36 standard_testfile
38 if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
39     return -1
42 if {![runto_main]} {
43     return
46 set printing_done_line [gdb_get_line_number "printing done"]
47 gdb_test "break $printing_done_line" ".*" "set breakpoint after printing"
49 send_gdb "continue\n"
51 set expected_lines 3000
52 set more 1
53 set i 0
54 while {$more} {
55     set more 0
56     gdb_expect {
57         -i $inferior_spawn_id
58         -ex "this is line number $i" {
59             incr i
60            if {$i != $expected_lines} {
61                 set more 1
62             }
63         }
64     }
67 gdb_assert {$i == $expected_lines} "saw all lines"
69 set test "breakpoint reached"
70 gdb_test_multiple "" $test {
71     -re "Breakpoint .* main .*$srcfile:$printing_done_line.*$gdb_prompt $" {
72         pass $test
73     }