Consider this gdb session: ... $ gdb -q (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". >bar >end (gdb) show user User command "foo": bar (gdb) ... Now let's try the same in TUI: ... (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". (gdb) show user User command "foo": bar (gdb) ... The secondary prompt lines are not terminated with a \n, and are consequently overwritten. With this tentative patch: ... diff --git a/gdb/top.c b/gdb/top.c index 90ddc5f5ea7..f9b967c5c64 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -77,6 +77,7 @@ #if defined(TUI) # include "tui/tui.h" +# include "tui/tui-io.h" #endif #ifndef O_NOCTTY @@ -958,6 +959,9 @@ gdb_readline_wrapper_line (gdb::unique_xmalloc_ptr<char> &&line) saved_after_char_processing_hook = after_char_processing_hook; after_char_processing_hook = NULL; + if (tui_active) + tui_inject_newline_into_command_window (); + /* Prevent parts of the prompt from being redisplayed if annotations are enabled, and readline's state getting out of sync. We'll reinstall the callback handler, which puts the terminal in raw ... we get instead: ... (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". >bar >end (gdb) show user User command "foo": bar (gdb) ...
https://sourceware.org/pipermail/gdb-patches/2023-July/200892.html
The master branch has been updated by Tom de Vries <vries@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=87c9b0289d73382cc72adb84d221b0a8ceb33ef8 commit 87c9b0289d73382cc72adb84d221b0a8ceb33ef8 Author: Tom de Vries <tdevries@suse.de> Date: Wed Jul 26 13:31:53 2023 +0200 [gdb/tui] Fix secondary prompt With CLI, a session defining a command looks like: ... (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". >bar >end (gdb) ... With TUI however, we get the same secondary prompts, and type the same, but are left with: ... (gdb) define foo Type commands for definition of "foo". End with a line saying just "end". (gdb) ... Fix this by calling tui_inject_newline_into_command_window in gdb_readline_wrapper_line, as is done in tui_command_line_handler. Tested on x86_64-linux. PR tui/30636 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30636
Fixed.