This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Call target_terminal_ours in quit_force
- 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: Mon, 27 Jul 2015 15:12:33 -0400
- Subject: Re: [PATCH] Call target_terminal_ours in quit_force
- Authentication-results: sourceware.org; auth=none
- References: <1438013299-1449-1-git-send-email-patrick at parcs dot ath dot cx> <CA+C-WL-wNHbKxg95yLtN6V9myY5iqXSWcwOkTmO5ZOjS=x3jnQ at mail dot gmail dot com> <55B65EAE dot 5090000 at redhat dot com> <CA+C-WL9z2dTcGEf=P4z0YVyQkWhx3V=qmbkORe+zcwg27Fshkw at mail dot gmail dot com>
On Mon, Jul 27, 2015 at 2:49 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> On Mon, Jul 27, 2015 at 12:39 PM, Pedro Alves <palves@redhat.com> wrote:
>> On 07/27/2015 05:11 PM, Patrick Palka wrote:
>>> On Mon, Jul 27, 2015 at 12:08 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
>>>> We should make sure our terminal settings are in effect before finally
>>>> quitting GDB. Our terminal settings may not be in effect at this point
>>>> if we are e.g. quitting due to a SIGTERM.
>>>
>>> I should add, "quitting due to a SIGTERM while an inferior an inferior
>>> is running in the foreground."
>>
>> Looks OK, though I notice that the settings are broken even if we
>> we're not debugging anything:
>>
>> $ stty
>> speed 38400 baud; line = 0;
>> iutf8
>>
>> $ ./gdb
>> GNU gdb (GDB) 7.10.50.20150726-cvs
>> (gdb)
>> *sent SIGTERM from another terminal, gdb exits*
>> $
>> $ stty (echo is off)
>> speed 38400 baud; line = 0;
>> lnext = <undef>; min = 1; time = 0;
>> -icrnl iutf8
>> -icanon -echo
>> $
>>
>> Do you also see this?
>
> Yeah, even with this patch...
>
> $ stty
> speed 38400 baud; line = 0;
> -brkint -imaxbel iutf8
> $ gdb -q
> (gdb) *SIGTERM*
> $ stty
> speed 38400 baud; line = 0;
> lnext = <undef>;
> -brkint -icrnl -imaxbel iutf8
>
> Quitting via the "quit" command is OK though... strange.
This happens because when quitting via SIGTERM a readline callback
handler remains installed which means that the terminal is still
prepped by readline. The readline callback handler is temporarily
removed during the execution of a command (thus deprepping the
terminal) which is why quitting via "quit" does not leak our terminal
settings.