From 6e9bcaad3fd8f7635afb9fa7013762da2eeff8e5 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 31 May 2023 15:06:40 +0200 Subject: [PATCH] [gdb/testsuite] Fix gdb.tui/pr30056.exp for native-extended-gdbserver When running test-case gdb.tui/pr30056.exp with target board native-extended-gdbserver, I run into: ... Quit^[[K^M^[[B(gdb) PASS: gdb.tui/pr30056.exp: Control-C Remote debugging from host ::1, port 38810^M ^M(failed reverse-i-search)`xyz': ^M(gdb) target extended-remote \ localhost:2346^[[7GWARNING: Timed out waiting for EOF in server after \ monitor exit ... This is due to the fact that ^C doesn't abort the reverse-i-search. This appears to be due to a readline problem. A PR is open about this: PR cli/30498. Add a KFAIL for the PR, and ensure that the isearch is aborted by using ^G, such that we have a responsive prompt to handle the "monitor exit" command that native-extended-gdbserver issues. Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/pr30056.exp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gdb/testsuite/gdb.tui/pr30056.exp b/gdb/testsuite/gdb.tui/pr30056.exp index 4ca7a8b56a8..48eaa5735b8 100644 --- a/gdb/testsuite/gdb.tui/pr30056.exp +++ b/gdb/testsuite/gdb.tui/pr30056.exp @@ -53,4 +53,35 @@ save_vars { env(LC_ALL) } { # Send ^C. send_gdb "\003" gdb_assert { [Term::wait_for "Quit"] } "Control-C" + + # Uncomment this to simulate that PR cli/30498 is fixed. + #send_gdb "\007" + + set test "Control-C aborts isearch" + + # Send "xyz", again. + send_gdb "xyz" + # Wait for xyx to appear. + Term::wait_for_region_contents 0 $Term::_cur_row $Term::_cols 1 "xyz" + + if { [Term::check_region_contents_p 0 $Term::_cur_row $Term::_cols 1 \ + "^$gdb_prompt xyz"] } { + pass $test + + # Send ^C to clear the command line. + send_gdb "\003" + } else { + # Sending ^C currently doesn't abort the i-search. PR cli/30498 is + # open about this. + kfail cli/30498 $test + + # At this point we don't have a reponsive prompt. Send ^G to abort + # the i-search. + send_gdb "\007" + } + + # We need a reponsive prompt here, to deal with the "monitor exit" + # that native-extended-gdbserver will send. Check that we have a + # responsive prompt. + Term::command "echo \\n" } -- 2.30.2