From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 52698 invoked by alias); 26 May 2019 22:43:00 -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 52557 invoked by uid 89); 26 May 2019 22:43:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.3 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=signals, thinking, H*f:sk:fad2a97, H*f:sk:3935437 X-HELO: mail-wm1-f67.google.com Received: from mail-wm1-f67.google.com (HELO mail-wm1-f67.google.com) (209.85.128.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 26 May 2019 22:42:58 +0000 Received: by mail-wm1-f67.google.com with SMTP id z23so9905952wma.4 for ; Sun, 26 May 2019 15:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=fkhzgLKopz9saIIOqyqLyTSjHt525uDMqr7jNuZ8wiE=; b=Wyrpcxxokb008GsqDeibttuVCa8GTPOOgWw1Sf40yAsLIjEitasUbdvCY1hXJniyeA jaE/A6cmXwvkj3nM2AOE0NnYDeV2hbEYeTCR0UOwU5q/Kp2zVSBJb0O34KvmIxYfQVbl NzSG/2Qc7uHyl7Lrr4MdA3ey9K2PAuY7VJ9xhSRUTbLSd+2ICVsq1vr23KIDiByFQhud oQSZ4D6UYg1rBWNGOcg7wzhNREa0vtjC2g13p0gCn43clJUkSqT2b+KXu7ZiBfdMGxRu bVh4kWJWy80d3as1eNFYFELvFoMuQT5ajQBOrPK8z8gq9p2X7WeOizN2vbZ++8+B4gjg APBw== Return-Path: Received: from localhost (host86-180-62-212.range86-180.btcentralplus.com. [86.180.62.212]) by smtp.gmail.com with ESMTPSA id q15sm8412958wrr.19.2019.05.26.15.42.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 26 May 2019 15:42:55 -0700 (PDT) Date: Sun, 26 May 2019 22:43:00 -0000 From: Andrew Burgess To: Alan Hayward Cc: Pedro Alves , "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH] Supress SIGTTOU when handling errors Message-ID: <20190526224253.GA5667@embecosm.com> References: <20190516155150.71826-1-alan.hayward@arm.com> <20190516180640.GS2568@embecosm.com> <3935437B-CD4F-4474-B84A-05859CE822DF@arm.com> <7483f478-44d2-b2ce-b0cb-3e984054305a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Fortune: Give me a sleeping pill and tell me your troubles. X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00585.txt.bz2 * Alan Hayward [2019-05-24 12:36:43 +0000]: >=20 >=20 > > On 24 May 2019, at 12:02, Pedro Alves wrote: > >=20 > > On 5/24/19 9:54 AM, Alan Hayward wrote: > >=20 > >> Looking back at my original patch again, I=E2=80=99m wondering if it= =E2=80=99s better to > >> move the ignore higher up the call stack in print_flush, so that it=E2= =80=99s set > >> across both flushes: > >=20 > > What are the two flushes? I only see one, from the serial_drain_output= call? >=20 > Sorry, I was forgot it was that call. I was thinking it was as part of the > gdb_flush call. >=20=20 > >=20 > > In any case, I think it's better to keep the SIGTTOU handling close to > > the tcdrain call, to make to code a lot more obvious -- SIGTTOU suppres= sion > > is described in tcdrain manuals -- and I don't think we have to worry > > about efficiency here? >=20 > True - errors from gdb shouldn=E2=80=99t be frequent enough to be an issu= e. >=20 > >=20 > >> ...or if it really should be left just around the tcdrain. > >> Not quite sure what the behaviour is on non-Linux targets. > >=20 > > The behavior should be the same on all POSIX systems: > >=20 > > https://pubs.opengroup.org/onlinepubs/009695399/functions/tcdrain.html > >=20 > > "Any attempts to use tcdrain() from a process which is a member of a ba= ckground > > process group on a fildes associated with its controlling terminal, sha= ll cause the process > > group to be sent a SIGTTOU signal. If the calling process is blocking o= r ignoring > > SIGTTOU signals, the process shall be allowed to perform the operation,= and > > no signal is sent." > >=20 > > On non-POSIX systems, the serial_drain_output call doesn't end up in > > ser-unix.c:hardwire_drain_output, so from that perspective, putting > > the SIGTTOU suppression in common code is a bit of an abstraction viola= tion. >=20 > Ok, agreed. >=20 > Any objections to me pushing the original patch then? Not from me. Sorry for any delay I caused in getting the patch merged. Thanks, Andrew >=20 >=20 > >=20 > >>=20 > >>=20 > >>>=20 > >>> That isn't to say that your patch _isn't_ also correct. We have many > >>> latent bugs around this area. Let me take a better look at that one = too. > >>>=20 > >>> I think that even if we get something like your patch in, then > >>> Alan's is still correct because we can have places doing > >>> try/catch to swallow an error but still print it with exception_print, > >>> all while the inferior is running. Of course such spots should > >>> call ours_for_output(), but that will run into the tcdrain issue. > >>>=20 > >>=20 > >> Minor issue is that once my patch is in, it=E2=80=99ll hide the missin= g ours_for_output > >> bugs (?) > >>=20 > >=20 > > Sure. But we shouldn't avoid fixing one bug because of that. The > > palves/tty-always-separate-session branch on my github exposes such > > bugs because with a missing ours_for_output call, gdb prints to > > the screen while the terminal is in raw mode, resulting in output > > like > >=20 > > this is line one > > this is line two > > this is line three > >=20 > > instead of: > >=20 > > this is line one > > this is line two > > this is line three > >=20 > > Thanks, > > Pedro Alves >=20