From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13330 invoked by alias); 6 Dec 2013 19:06:14 -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 13317 invoked by uid 89); 6 Dec 2013 19:06:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Dec 2013 19:06:11 +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 (8.14.4/8.14.4) with ESMTP id rB6J62es002461 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Dec 2013 14:06:03 -0500 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 rB6J60wI022416; Fri, 6 Dec 2013 14:06:00 -0500 Message-ID: <52A22018.8000203@redhat.com> Date: Fri, 06 Dec 2013 19:06:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [PATCH v4 2/9] add "this" pointers to more target APIs References: <1382464769-2465-1-git-send-email-tromey@redhat.com> <1382464769-2465-3-git-send-email-tromey@redhat.com> <526E8AF2.7050202@redhat.com> <87r4b5cpxd.fsf@fleche.redhat.com> <526E9451.6050103@redhat.com> <87mwltcp8v.fsf@fleche.redhat.com> <527D2323.2010708@redhat.com> <87ob5uodry.fsf@fleche.redhat.com> <527D5D58.4030707@redhat.com> <87siu5kfe1.fsf@fleche.redhat.com> In-Reply-To: <87siu5kfe1.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00262.txt.bz2 On 12/06/2013 06:23 PM, Tom Tromey wrote: >>>>>> "Pedro" == Pedro Alves writes: > > Tom> I'll remove "is_async". Unless you'd rather I remove "can_async". > > Pedro> No, that's fine. "is_async" would be my choice as well. > > I looked deeper than the two are still subtly different. > Specifically, remote.c delegates to serial: > > return serial_can_async_p (rs->remote_desc); > return serial_is_async_p (rs->remote_desc); > > And these really do differ: > > int > serial_can_async_p (struct serial *scb) > { > return (scb->ops->async != NULL); > } > > int > serial_is_async_p (struct serial *scb) > { > return (scb->ops->async != NULL) && (scb->async_handler != NULL); > } > > > I find it a bit odd that the upper layers rely on the serial layer to do > this bookkeeping. Hmm, indeed. So target_is_async only returns true while target_async (inferior_event_handler) is active. Guess we need to go through target_is_async_p calls and see how to eliminate them. The remote.c ones seem simply replaceable with checking whether we're doing a blocking wait, but the others look more tricky. (below's untested) --- gdb/remote.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 2ac8c36..a164455 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -6001,7 +6001,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) int ret; int is_notif; - if (!target_is_async_p ()) + if ((options & TARGET_WNOHANG) == 0) { ofunc = signal (SIGINT, sync_remote_interrupt); /* If the user hit C-c before this packet, or between packets, @@ -6020,7 +6020,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options) ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size, wait_forever_enabled_p, &is_notif); - if (!target_is_async_p ()) + if ((options & TARGET_WNOHANG) == 0) signal (SIGINT, ofunc); /* GDB gets a notification. Return to core as this event is -- 1.7.11.7