From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28017 invoked by alias); 9 Jul 2014 16:37:21 -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 27986 invoked by uid 89); 9 Jul 2014 16:37:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f201.google.com Received: from mail-qc0-f201.google.com (HELO mail-qc0-f201.google.com) (209.85.216.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 09 Jul 2014 16:37:16 +0000 Received: by mail-qc0-f201.google.com with SMTP id i17so417634qcy.4 for ; Wed, 09 Jul 2014 09:37:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:cc:subject:in-reply-to :references; bh=oGdv2jLD4uUSSLab58QiEk8HYfqPkH+Bb/RzehQWw98=; b=SG1HgRsDAGkir587FPUg2ydmFa+DqRKaVGVrE/2+62etErNN883KV4rAfe5tSqShva KxR7MqaECl45mKWKz1s35AJgsZacJaSohrPQ+1eW2Hj2KEzuBArSv7c4j82yasoCvfBs XRXTQ5Ik6dma3fPlYwrtA9s0SSG9/CceGfe4Jts6i99c+PRU2g/B5so9VK9PPY9vifVG 2SyjD+TUUGf1gEB/T3US9t5BG5ENUJb7hHDeyB611Xu01zsXeKx6ZYUL8Fv7teBbiRVQ KCOdBuROwSK/qM28rk3jm7IwTFPrwR6buVNBaQhb5Ri9fXJZwuePZvC9jsL9XIg+RyQY vJwg== X-Gm-Message-State: ALoCoQkxyTD0wjkUrTnglHhWO6VRiAz70U3dg0FiiUVWh/VucGyNvQGRrVeDF70/JNdD4XvzkGgG X-Received: by 10.58.46.79 with SMTP id t15mr20043398vem.35.1404923834171; Wed, 09 Jul 2014 09:37:14 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id z50si2823281yhb.3.2014.07.09.09.37.14 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Jul 2014 09:37:14 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 524DA5A4686; Wed, 9 Jul 2014 09:37:13 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21437.28600.751354.629884@ruffy.mtv.corp.google.com> Date: Wed, 09 Jul 2014 16:37:00 -0000 To: Pedro Alves Cc: Mark Wielaard , Jan Kratochvil , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix "attach" command vs user input race [Re: Regression for attach from stdin [Re: [pushed] Re: [PATCH v6 0/2] enable target-async by default]] In-Reply-To: <53BC0D0B.7040001@redhat.com> References: <1400878753-24688-1-git-send-email-palves@redhat.com> <538739A2.2050105@redhat.com> <20140701162830.GA25877@host2.jankratochvil.net> <1404291574.3766.35.camel@bordewijk.wildebeest.org> <53B3CDCC.9050502@redhat.com> <53B57911.10304@redhat.com> <53B6B0B8.2050702@redhat.com> <21434.52532.737427.778289@ruffy.mtv.corp.google.com> <53BC0D0B.7040001@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00191.txt.bz2 Pedro Alves writes: > On 07/07/2014 05:39 PM, Doug Evans wrote: > > > Our nomenclature here is problematic. I always do a double take when > > I see attach and target_terminal_foo mentioned in the same sentence. > > Bleah. > > Why? "run; detach; attach SAME_PID" is a trivial case where we end > up attached to an inferior that is sharing the same tty as GDB. In > fact, the test does that. I know. But for me it's not the normal case. I wish the naming/wording could better reflect what's happening. [but that's not something that has to be addressed here of course] > @@ -2495,10 +2492,26 @@ attach_command (char *args, int from_tty) > shouldn't refer to attach_target again. */ > attach_target = NULL; > > - /* Set up the "saved terminal modes" of the inferior > - based on what modes we are starting it with. */ > + /* Set up the "saved terminal modes" of the inferior based on what > + modes we are starting it with. */ > target_terminal_init (); spurious change > > + /* Install inferior's terminal modes. This may look like a no-op, > + as we've just saved them above, however, this does more than > + restore terminal settings: > + > + - installs a SIGINT handler that forwards SIGINT to the inferior. > + Otherwise a Ctrl-C pressed just while waiting for that initial > + stop would end up as a spurious Quit. > + > + - removes stdin from the event loop, which we need if attaching > + in the foreground, otherwise on targets that report an initial > + stop on attach (which are most) we'd process input/commands > + while we're in the event loop waiting for that stop. That is, > + before the attach continuation runs and the command is really > + finished. */ > + target_terminal_inferior (); > + > /* Set up execution context to know that we should return from > wait_for_inferior as soon as the target reports a stop. */ > init_wait_for_inferior (); I like this a lot better. Thanks. The patch is ok with me, modulo removing the spurious change.