aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2025-08-15 14:48:10 +0200
committerTom de Vries <tdevries@suse.de>2025-08-15 14:48:10 +0200
commitbd619420b35508495bb4ae8cf0b32a3257411fa3 (patch)
treea2a265850c40f1237c028121d89e913197c13274
parent65af9c1531b681edf533d7c1a9d8e61c3ba6e9b3 (diff)
downloadbinutils-bd619420b35508495bb4ae8cf0b32a3257411fa3.zip
binutils-bd619420b35508495bb4ae8cf0b32a3257411fa3.tar.gz
binutils-bd619420b35508495bb4ae8cf0b32a3257411fa3.tar.bz2
[gdb/testsuite] Add gdb.tui/tui-mode-switch.exp
Add test-case gdb.tui/tui-mode-switch.exp, a regression test for PR tui/30523. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30523
-rw-r--r--gdb/testsuite/gdb.tui/tui-mode-switch.exp52
1 files changed, 52 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.tui/tui-mode-switch.exp b/gdb/testsuite/gdb.tui/tui-mode-switch.exp
new file mode 100644
index 0000000..827677c
--- /dev/null
+++ b/gdb/testsuite/gdb.tui/tui-mode-switch.exp
@@ -0,0 +1,52 @@
+require allow_tui_tests
+
+tuiterm_env
+
+if { [ishost *-*-*bsd*] } {
+ # We need support for alternate screen, and xterm doesn't have it.
+ set term xterm-clear
+} else {
+ set term xterm
+}
+
+Term::with_term $term {
+ Term::clean_restart 12 40
+}
+
+if {![Term::prepare_for_tui]} {
+ unsupported "TUI not supported"
+ return 0
+}
+
+# Generate prompt.
+Term::gen_prompt
+
+# Move to last line.
+for { set i 1 } { $i <= 11 } { incr i } {
+ send_gdb "\n"
+ Term::wait_for ""
+}
+
+# Type "foo".
+send_gdb "foo"
+set line { 0 11 40 1 }
+Term::wait_for_region_contents {*}$line "^$gdb_prompt foo"
+
+# Enter TUI.
+send_gdb "\030\001"
+Term::wait_for ""
+
+# Exit TUI, type b.
+send_gdb "\030\001"
+send_gdb "b"
+Term::wait_for_region_contents {*}$line "^$gdb_prompt b"
+
+# Check that we don't see "boo".
+gdb_assert { ![Term::check_region_contents_p {*}$line "^$gdb_prompt boo"] } \
+ "no boo"
+Term::dump_screen
+
+# We need an empty prompt here, to deal with the "monitor exit" that
+# native-extended-gdbserver will send. Send a backspace.
+send_gdb "\010"
+Term::wait_for ""