[pushed,gdb/testsuite] Fix gdb.tui/pr30056.exp for native-extended-gdbserver

Message ID 20230531130703.18985-1-tdevries@suse.de
State Committed
Headers
Series [pushed,gdb/testsuite] Fix gdb.tui/pr30056.exp for native-extended-gdbserver |

Commit Message

Tom de Vries May 31, 2023, 1:07 p.m. UTC
  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(+)


base-commit: 768d1d879be2d134e049521f28d4d5e03b69bafc
  

Patch

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"
 }