[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.base / double-prompt-target-event-error.exp
blob433c8cac2fca3932ade2255b00f49314a7fbbf91
1 # Copyright (C) 2014-2019 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 if [target_info exists gdb,nointerrupts] {
17 verbose "Skipping double-prompt-target-event-error.exp because of nointerrupts."
18 return
21 standard_testfile
23 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} {
24 return -1
27 # Test throwing an error while GDB is handling a target event. We use
28 # a ctrl-c/quit in a pagination prompt to emulate an error. COMMAND
29 # is either "continue" or "wrapcont". The latter is a continue issued
30 # from a user-defined command. That exercises the case of the
31 # interpreter forced sync, which was the case that originally had a
32 # bug.
34 proc cancel_pagination_in_target_event { command } {
35 global binfile srcfile
36 global gdb_prompt pagination_prompt
38 set testline [gdb_get_line_number "after sleep"]
40 with_test_prefix "ctrlc target event: $command" {
41 clean_restart $binfile
43 if ![runto_main] then {
44 fail "can't run to main"
45 return 0
48 gdb_test "b $srcfile:$testline" \
49 "Breakpoint .*$srcfile, line $testline.*" \
50 "set breakpoint"
52 gdb_test_no_output "set height 2"
54 if { $command == "wrapcont" } {
55 gdb_test_multiple "define wrapcont" "define user command: wrapcont" {
56 -re "Type commands for definition of \"wrapcont\".\r\nEnd with a line saying just \"end\".\r\n>$" {
57 # Note that "Continuing." is ommitted when
58 # "continue" is issued from a user-defined
59 # command. Issue it ourselves.
60 gdb_test "echo Continuing\.\ncontinue\nend" "" \
61 "define user command: wrapcont"
66 # Wait for pagination prompt after the "Continuing" line,
67 # indicating the program was running and then stopped.
68 set saw_continuing 0
69 set test "continue to pagination"
70 gdb_test_multiple "$command" $test {
71 -re "$pagination_prompt$" {
72 if {$saw_continuing} {
73 pass $test
74 } else {
75 send_gdb "\n"
76 exp_continue
79 -re "Continuing" {
80 set saw_continuing 1
81 exp_continue
85 # We're now stopped in a pagination query while handling a
86 # target event (printing where the program stopped). Quitting
87 # the pagination should result in only one prompt being
88 # output.
89 send_gdb "\003p 1\n"
91 # Note gdb_test_multiple has a default match for the prompt,
92 # which issues a FAIL. Consume the first prompt.
93 set test "first prompt"
94 gdb_test_multiple "" $test {
95 -re "$gdb_prompt" {
96 pass "first prompt"
100 # We should only see one prompt more, and it should be
101 # preceeded by print's output.
102 set test "no double prompt"
103 gdb_test_multiple "" $test {
104 -re "$gdb_prompt.*$gdb_prompt $" {
105 # The bug is present, and expect managed to read
106 # enough characters into the buffer to fill it with
107 # both prompts.
108 fail $test
110 -re " = 1\r\n$gdb_prompt $" {
111 pass $test
115 # In case the board file wants to send further commands.
116 gdb_test_no_output "set height unlimited"
120 foreach variant { "continue" "wrapcont" } {
121 cancel_pagination_in_target_event $variant