[PATCH] tui: don't overwrite a subprompt line that was given no input

Pedro Alves palves@redhat.com
Fri Aug 21 18:04:00 GMT 2015

On 08/21/2015 05:45 PM, Patrick Palka wrote:
> This patch fixes the following bug in TUI:
>   (gdb) break foo
>   No symbol table is loaded.  Use the "file" command.
>   Make breakpoint pending on future shared library load? (y or [n]) <ENTER>
> By submitting an empty command line to a subprompt, the subprompt line
> is undesirably cleared and overwritten.  Outside of a subprompt,
> clearing the prompt line after submitting an empty command line is
> intended behavior which complements GDB's repeat-command shorthand.  But
> inside a subprompt, this behavior is undesired since the shorthand is
> not applicable in that case.  We should retain the subprompt line even
> when it's given to input.
> This patch makes sure that a prompt given an empty command line is
> cleared and overwritten only if it's not a subprompt.  To acheive this,
> a new predicate is defined which informs us whether the current input
> handler is a subprompt.
> gdb/ChangeLog:
> 	* top.h (gdb_in_subprompt_p): Declare.
> 	* top.c (gdb_subprompt_depth): Define.
> 	(gdb_in_subprompt_p): Define.
> 	(gdb_readline_wrapper_cleanup): Decrement gdb_subprompt_depth.
> 	(gdb_readline_wrapper): Increment gdb_subprompt_depth.
> 	* tui/tui-io.c (tui_getc): Don't clear the prompt line if we
> 	are in a subprompt.

OK, but should really be s/subprompt/secondary prompt/ everywhere.

Pedro Alves

More information about the Gdb-patches mailing list