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: Patrick Palka <patrick at parcs dot ath dot cx>
- To: Pedro Alves <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 29 Jul 2015 07:39:13 -0400
- 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> <55B81606 dot 6090706 at redhat dot com>
On Tue, Jul 28, 2015 at 7:53 PM, Pedro Alves <palves@redhat.com> wrote:
> (Small request: I find it helpful when the proposed commit
> log is always present in patch resubmissions, making patches
> self-contained.)
Sure, no problem.
>
>> 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.
Will do.