1 # Copyright 2023-2024 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 # Regression test for PR30056. 17 18 # This PR is fixed in the in-repo copy of readline. System readline may or 19 # may not be fixed, so skip this test-case. 20 require !with_system_readline 21 require {have_host_locale C.UTF-8} 22 23 tuiterm_env 24 25 save_vars { env(LC_ALL) } { 26 setenv LC_ALL C.UTF-8 27 28 # Start terminal. 29 Term::clean_restart 24 80 30 31 # Start TUI. 32 if {![Term::enter_tui]} { 33 unsupported "TUI not supported" 34 return 35 } 36 37 # Send "^R", starting reverse-i-search. 38 send_gdb "\022" 39 Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \ 40 [string_to_regexp "(reverse-i-search)`': "] 41 42 # Send "xyz". 43 send_gdb "xyz" 44 Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 \ 45 [string_to_regexp "(failed reverse-i-search)`xyz': "] 46 47 # Send arrow-right. 48 send_gdb "\033\[C" 49 50 # We need to the arrow-right to be processed by readline, before we 51 # send the following ^C. Waiting 1 ms seems to do that. 52 after 1 53 54 # Send ^C. 55 send_gdb "\003" 56 gdb_assert { [Term::wait_for "Quit"] } "Control-C" 57 58 # Uncomment this to simulate that PR cli/30498 is fixed. 59 #send_gdb "\007" 60 61 set test "Control-C aborts isearch" 62 63 # Send "xyz", again. 64 send_gdb "xyz" 65 # Wait for xyx to appear. 66 Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 "xyz" 67 68 if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \ 69 "^$gdb_prompt xyz"] } { 70 pass $test 71 72 # Send ^C to clear the command line. 73 send_gdb "\003" 74 } else { 75 # Sending ^C currently doesn't abort the i-search. PR cli/30498 is 76 # open about this. 77 kfail cli/30498 $test 78 79 # At this point we don't have a reponsive prompt. Send ^G to abort 80 # the i-search. 81 send_gdb "\007" 82 } 83 84 # We need a reponsive prompt here, to deal with the "monitor exit" 85 # that native-extended-gdbserver will send. Check that we have a 86 # responsive prompt. 87 Term::command "echo \\n" 88 } 89