1 1.1.1.2 christos # Copyright 2016-2017 Free Software Foundation, Inc. 2 1.1 christos 3 1.1 christos # This program is free software; you can redistribute it and/or modify 4 1.1 christos # it under the terms of the GNU General Public License as published by 5 1.1 christos # the Free Software Foundation; either version 3 of the License, or 6 1.1 christos # (at your option) any later version. 7 1.1 christos # 8 1.1 christos # This program is distributed in the hope that it will be useful, 9 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 1.1 christos # GNU General Public License for more details. 12 1.1 christos # 13 1.1 christos # You should have received a copy of the GNU General Public License 14 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>. 15 1.1 christos 16 1.1 christos load_lib mi-support.exp 17 1.1 christos set MIFLAGS "-i=mi" 18 1.1 christos 19 1.1 christos standard_testfile 20 1.1 christos 21 1.1 christos if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable {debug}] != "" } { 22 1.1 christos return -1 23 1.1 christos } 24 1.1 christos 25 1.1 christos # This tests the resolution of PR 20039. 26 1.1 christos # 27 1.1 christos # With a multi-threaded inferior and with MI/all-stop, it was not possible 28 1.1 christos # to interrupt it with ctrl-C after a continue. 29 1.1 christos 30 1.1 christos proc test_continue_interrupt { } { 31 1.1 christos global binfile 32 1.1 christos global async 33 1.1 christos 34 1.1 christos gdb_exit 35 1.1 christos if {[mi_gdb_start]} { 36 1.1 christos continue 37 1.1 christos } 38 1.1 christos 39 1.1 christos # Load the binary in gdb... 40 1.1 christos mi_gdb_load $binfile 41 1.1 christos 42 1.1 christos # ... and run it. 43 1.1 christos # 44 1.1 christos # Note this test relies on mi_runto deleting the breakpoint. 45 1.1 christos # A step-over here would mask the bug. 46 1.1 christos mi_runto "all_threads_created" 47 1.1 christos 48 1.1 christos # Consistency check. 49 1.1 christos mi_check_thread_states {"stopped" "stopped" "stopped"} "check thread states" 50 1.1 christos 51 1.1 christos # Continue. 52 1.1 christos mi_send_resuming_command "exec-continue" "continue" 53 1.1 christos 54 1.1 christos # Wait a bit to make sure all MI events are sent, before sending the 55 1.1 christos # interruption request. 56 1.1 christos sleep 1 57 1.1 christos 58 1.1 christos # Send the interrupt request. 59 1.1 christos if { $async } { 60 1.1 christos mi_gdb_test "888-exec-interrupt" "888\\^done" "interrupt" 61 1.1 christos } else { 62 1.1 christos send_gdb "\003" 63 1.1 christos } 64 1.1 christos 65 1.1 christos # Wait for the *stopped. 66 1.1 christos mi_expect_interrupt "interrupt reported" 67 1.1 christos } 68 1.1 christos 69 1.1 christos test_continue_interrupt 70