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