From: Tom de Vries Date: Fri, 15 Aug 2025 12:48:10 +0000 (+0200) Subject: [gdb/testsuite] Add gdb.tui/tui-mode-switch.exp X-Git-Tag: gdb-17-branchpoint~288 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd619420b35508495bb4ae8cf0b32a3257411fa3;p=thirdparty%2Fbinutils-gdb.git [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 --- 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 00000000000..827677c39b9 --- /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 ""