From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67040 invoked by alias); 28 Jul 2015 10:41:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 66941 invoked by uid 89); 28 Jul 2015 10:41:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 28 Jul 2015 10:41:29 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id BDE028F301; Tue, 28 Jul 2015 10:41:28 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6SAfR57029189; Tue, 28 Jul 2015 06:41:27 -0400 Message-ID: <55B75C57.6040409@redhat.com> Date: Tue, 28 Jul 2015 10:41:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Patrick Palka CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] Call target_terminal_ours in quit_force References: <1438013299-1449-1-git-send-email-patrick@parcs.ath.cx> <55B65EAE.5090000@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-07/txt/msg00822.txt.bz2 On 07/27/2015 08:12 PM, Patrick Palka wrote: > On Mon, Jul 27, 2015 at 2:49 PM, Patrick Palka wrote: >> On Mon, Jul 27, 2015 at 12:39 PM, Pedro Alves wrote: >>> On 07/27/2015 05:11 PM, Patrick Palka wrote: >>>> On Mon, Jul 27, 2015 at 12:08 PM, Patrick Palka 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 = ; 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 = ; >> -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. Yeah. Sounds like we should call gdb_rl_callback_handler_remove. And remove the input fd from the event loop too, otherwise pending input may end up waking some nested event loop and end up in readline with no callback installed, which aborts. Looks like gdb_disable_readline would do? Thanks, Pedro Alves