]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/paginate-inferior-exit.exp
2d52581d09203131916f58afcb002719ffb8e96f
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / paginate-inferior-exit.exp
1 # Copyright (C) 2014-2015 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 # A collection of tests related to running execution commands directly
17 # from the command line, with "-ex".
18
19 standard_testfile
20
21 if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
22 return -1
23 }
24
25 # Test paginating while printing about the inferior having exited.
26 #
27 proc test_paginate_inferior_exited {} {
28 global binfile
29 global gdb_prompt pagination_prompt
30 global inferior_exited_re
31
32 with_test_prefix "paginate" {
33 clean_restart $binfile
34
35 if ![runto_main] then {
36 fail "Can't run to main"
37 return 0
38 }
39
40 # Force pagination.
41 gdb_test_no_output "set height 2"
42
43 set test "continue to pagination"
44
45 # Wait for the "Starting program" line, indicating the program
46 # is running.
47 set saw_starting 0
48 gdb_test_multiple "continue" $test {
49 -re "$pagination_prompt" {
50 if {$saw_starting} {
51 pass $test
52 } else {
53 send_gdb "\n"
54 exp_continue
55 }
56 }
57 -re "Continuing" {
58 set saw_starting 1
59 exp_continue
60 }
61 }
62
63 # We're now stopped in a pagination output while handling a
64 # target event, trying to print about the program exiting.
65 set test "inferior exits normally"
66
67 send_gdb "\n"
68 gdb_test_multiple "" $test {
69 -re "$inferior_exited_re normally.*$gdb_prompt $" {
70 pass $test
71 }
72 }
73
74 gdb_test "p 1" " = 1" "GDB accepts further input"
75
76 # In case the board file wants to send further commands.
77 gdb_test_no_output "set height unlimited"
78 }
79 }
80
81 test_paginate_inferior_exited