From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1059 invoked by alias); 30 Sep 2013 19:34:57 -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 1021 invoked by uid 89); 30 Sep 2013 19:34:56 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2013 19:34:56 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8UJYpWI003454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 Sep 2013 15:34:52 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8UJYn7K017707; Mon, 30 Sep 2013 15:34:50 -0400 Message-ID: <5249D259.5070101@redhat.com> Date: Mon, 30 Sep 2013 19:34: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: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: Move pending_event to remote_notif_state ([PATCH 1/6] Move notif_queue to remote_state) References: <1376877311-4135-1-git-send-email-yao@codesourcery.com> <1376877311-4135-2-git-send-email-yao@codesourcery.com> <52430B69.4090301@redhat.com> <5249293D.8050700@codesourcery.com> <52492EAE.5030802@codesourcery.com> In-Reply-To: <52492EAE.5030802@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-09/txt/msg01024.txt.bz2 Eh, sorry, somehow I only noticed this patch now. (Still, I'd have preferred if the previous patch didn't create an intermediate state that leaks.) Anyway... On 09/30/2013 08:56 AM, Yao Qi wrote: > /* Return an allocated remote_notif_state. */ > > struct remote_notif_state * > @@ -238,6 +246,8 @@ remote_notif_state_allocate (void) > = create_async_event_handler (remote_async_get_pending_events_handler, > notif_state); > > + memset (notif_state->pending_event, 0, sizeof (notif_state->pending_event)); Could use xzalloc to begin with. Might be more future proof. > @@ -5414,16 +5409,22 @@ discard_pending_stop_replies (struct inferior *inf) > { > int i; > struct queue_iter_param param; > - struct stop_reply *reply > - = (struct stop_reply *) notif_client_stop.pending_event; > + struct stop_reply *reply; > + struct remote_state *rs = get_remote_state (); > + struct remote_notif_state *rns = rs->notif_state; > + > + /* This function can be notified when an inferior exists. When the > + target is not remote, the notification state is NULL. */ > + if (rns == NULL) > + return; I'd rather we use the same "target is remote" predicate we use everywhere else: if (rs->remote_desc == NULL) return; Otherwise this looks fine. Thanks, -- Pedro Alves