This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make sure terminal settings are restored before exiting
- From: Pedro Alves <palves at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, gdb-patches at sourceware dot org
- Date: Wed, 29 Jul 2015 00:53:42 +0100
- Subject: Re: [PATCH] Make sure terminal settings are restored before exiting
- Authentication-results: sourceware.org; auth=none
- References: <1438053504-21507-1-git-send-email-patrick at parcs dot ath dot cx> <1438122009-28779-1-git-send-email-patrick at parcs dot ath dot cx>
(Small request: I find it helpful when the proposed commit
log is always present in patch resubmissions, making patches
self-contained.)
> diff --git a/gdb/top.c b/gdb/top.c
> index 1e30b1c..6df987a 100644
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -66,6 +66,7 @@
> #include "cli-out.h"
> #include "tracepoint.h"
> #include "inf-loop.h"
> +#include "tui/tui.h"
>
> extern void initialize_all_files (void);
>
> @@ -1494,6 +1495,14 @@ quit_force (char *args, int from_tty)
> int exit_code = 0;
> struct qt_args qt;
>
> + /* Make sure that the terminal is left in the state we acquired it. */
> + target_terminal_ours ();
> +#if defined(TUI)
> + tui_disable ();
> +#endif
> + if (async_command_editing_p)
> + gdb_disable_readline ();
> +
Can you put these new bits in a separate function, and call it here?
That'll make it easier to reuse, or play with moving the call elsewhere,
if needed. As bonus, if we do the latter, git blame on the function's contents
will still blame you. :-)
OK with that change.
Thanks,
Pedro Alves