[PATCH 2/5] tui: use tui_putc to output newline entered by the user

Patrick Palka patrick@parcs.ath.cx
Sun Jul 5 21:04:00 GMT 2015


This is necessary to make sure that start_line and cur_line are set
properly right after a command has been entered.  We usually get away
with not doing so because most commands output text, and when they do
they do it through tui_putc/tui_puts which makes start_line and cur_line
get updated.  However if a command does not output text, then start_line
will not get updated in time.

This fixes the following bug in the TUI:

(gdb) break foo
No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) n<Enter>

After typing n followed by pressing Enter, the last line starting with
"Make breakpoint pending ..." (i.e. the subprompt) will get overwritten
by the next prompt.  With this patch, the last line does not get
overwritten.  (That the subprompt gets overwritten when no text is
entered at all is mostly a separate issue.)

gdb/ChangeLog:

	* tui/tui-io.c (tui_getc): Use tui_putc instead of waddch to
	emit the newline.
---
 gdb/tui/tui-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 97906ce..ba42c18 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -620,7 +620,7 @@ tui_getc (FILE *fp)
 	  py += px / TUI_CMD_WIN->generic.width;
 	  px %= TUI_CMD_WIN->generic.width;
 	  wmove (w, py, px);
-	  waddch (w, ch);
+	  tui_putc ('\n');
         }
     }
   
-- 
2.5.0.rc0.5.g91e10c5.dirty



More information about the Gdb-patches mailing list