From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6440 invoked by alias); 30 Jul 2014 15:34:25 -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 6426 invoked by uid 89); 30 Jul 2014 15:34:23 -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-vc0-f179.google.com Received: from mail-vc0-f179.google.com (HELO mail-vc0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 30 Jul 2014 15:34:20 +0000 Received: by mail-vc0-f179.google.com with SMTP id hq11so2050305vcb.24 for ; Wed, 30 Jul 2014 08:34:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=lddihUqoYC5DfcD27fUMM6x7p22JCW+d6CzpaXCa1d8=; b=GzJ1+4ZpxTG8YDQOn5x5pawhXAFAWUXstOA7CW33sKWwKEauEjXjwOiWp/G20H21jx yFGTt6aABLissd/T6Cngx7Ai1A61izxVOaVnnipIY39Rvjha4fCaCMR/c2Tucg77210E +/uYN0IHFsc6/LUsTjj04EmivBL4+2NSV8uWMIcYFfHdYm1ChuxTE3JaW90PrHjxHRvJ um8tjy6FAk7fGrX1jeq2ylSabsbK/aZsyfdn0HoNnoOuVUxHNVRjVakfxbN/FHd9xBkH vlPLjYgxsx/CGbLSK1sxsMQ+qwiazkdJRynBBl65/P33oJrXyaKvRmxYnBGpuU8RGdEm 9ZPQ== X-Gm-Message-State: ALoCoQmrnm7QulX0krlYwliCWBWxq812fqzp408t3COlAC/iObpb3RNMS3KyyR+dKRc8DF4HkJvE MIME-Version: 1.0 X-Received: by 10.221.56.132 with SMTP id wc4mr5634013vcb.38.1406734457765; Wed, 30 Jul 2014 08:34:17 -0700 (PDT) Received: by 10.52.28.233 with HTTP; Wed, 30 Jul 2014 08:34:17 -0700 (PDT) In-Reply-To: <53D8DF7E.6070506@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> <21437.28600.751354.629884@ruffy.mtv.corp.google.com> <53BD7749.5000800@redhat.com> <53D8DF7E.6070506@redhat.com> Date: Wed, 30 Jul 2014 16:59:00 -0000 Message-ID: Subject: Re: [pushed+7.8] 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]] From: Doug Evans To: Pedro Alves Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00793.txt.bz2 On Wed, Jul 30, 2014 at 5:05 AM, Pedro Alves wrote: >>> [...] >>> gdb/ >>> 2014-07-09 Pedro Alves >>> >>> * infcmd.c (attach_command_post_wait): Don't call >>> target_terminal_inferior here. >>> (attach_command): Call it here instead. >>> >>> gdb/testsuite/ >>> 2014-07-09 Pedro Alves >>> >>> * gdb.base/attach-wait-input.exp: New file. >>> * gdb.base/attach-wait-input.c: New file. >> >> Hi. >> >> Is this TODO still needed after this patch? >> >> infcmd.c: >> >> /* >> * TODO: >> * Should save/restore the tty state since it might be that the >> * program to be debugged was started on this tty and it wants >> * the tty in some state other than what we want. If it's running >> * on another terminal or without a terminal, then saving and >> * restoring the tty state is a harmless no-op. >> * This only needs to be done if we are attaching to a process. >> */ >> > > As usual, git blame/log is your friend... > > That's been in place for over 20 years. In bd5635a1 (1991), we see: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /* > * TODO: > * Should save/restore the tty state since it might be that the > * program to be debugged was started on this tty and it wants > * the tty in some state other than what we want. If it's running > * on another terminal or without a terminal, then saving and > * restoring the tty state is a harmless no-op. > * This only needs to be done if we are attaching to a process. > */ > > /* > * attach_command -- > * takes a program started up outside of gdb and ``attaches'' to it. > * This stops it cold in its tracks and allows us to start tracing it. > * For this to work, we must be able to send the process a > * signal and we must have the same effective uid as the program. > */ > void > attach_command (args, from_tty) > char *args; > int from_tty; > { > target_attach (args, from_tty); > } > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > So clearly the TODO has been stale for a long while. 23 years? Zoinks! :) > We've been saving/restoring the tty state way before > my patch. > > Thanks, > Pedro Alves > It wasn't clear to me whether the comment was (trying to) refer to something more specific for the task at hand. Just being too literal I guess. Thanks.