From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18029 invoked by alias); 6 Dec 2012 20:57:26 -0000 Received: (qmail 18021 invoked by uid 22791); 6 Dec 2012 20:57:26 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 06 Dec 2012 20:57:19 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB6KvIN8015869 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Dec 2012 15:57:18 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qB6KvH54015248; Thu, 6 Dec 2012 15:57:17 -0500 Message-ID: <50C106AD.4060804@redhat.com> Date: Thu, 06 Dec 2012 20:57:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH 4/6] Notify breakpoint-modified when uploaded tracepoints are merged. References: <1354596282-32526-1-git-send-email-yao@codesourcery.com> <1354596282-32526-5-git-send-email-yao@codesourcery.com> In-Reply-To: <1354596282-32526-5-git-send-email-yao@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2012-12/txt/msg00118.txt.bz2 On 12/04/2012 04:44 AM, Yao Qi wrote: > When any location of a tracepoint is marked as installed/inserted, > notify 'breakpoint-modified' observer. > > gdb: > > 2012-12-03 Yao Qi > > * tracepoint.c (merge_uploaded_tracepoints): Record all modified > tracepoints and notify 'breakpoint-modified' observer for them. This looks good to me. Some comment suggestions below. I ran out of time for now, so I'll review the rest of the series later or tomorrow. > --- > gdb/tracepoint.c | 28 ++++++++++++++++++++++++++++ > 1 files changed, 28 insertions(+), 0 deletions(-) > > diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c > index c467b9c..0c023bd 100644 > --- a/gdb/tracepoint.c > +++ b/gdb/tracepoint.c > @@ -3475,6 +3475,10 @@ void > merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) > { > struct uploaded_tp *utp; > + /* A set of tracepoints which are modified. */ > + VEC(breakpoint_p) *modified_tp = NULL; > + int ix; > + struct breakpoint *b; > > /* Look for GDB tracepoints that match up with our uploaded versions. */ > for (utp = *uploaded_tps; utp; utp = utp->next) > @@ -3485,6 +3489,8 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) > loc = find_matching_tracepoint_location (utp); > if (loc) > { > + int found = 0; > + > /* Mark this location as already inserted. */ > loc->inserted = 1; > t = (struct tracepoint *) loc->owner; > @@ -3492,6 +3498,22 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) > "as target's tracepoint %d at %s.\n"), > loc->owner->number, utp->number, > paddress (loc->gdbarch, utp->addr)); > + > + /* One location LOC of tracepoint is modified ('inserted' is > + set to 1), save LOC->owner in MODIFIED_TP if LOC->owner > + is not added to MODIFIED_TP before. The observer > + 'breakpoint-modified' will be notified later with every > + tracepoint saved in MODIFIED_TP. */ I suggest: /* The tracepoint was modified (a location was marked as inserted in the target). Save it in MODIFIED_TP if not there yet. The 'breakpoint-modified' observers will be notified later once for each tracepoint saved in MODIFIED_TP. */ > + for (ix = 0; > + VEC_iterate (breakpoint_p, modified_tp, ix, b); > + ix++) > + if (b == loc->owner) > + { > + found = 1; > + break; > + } > + if (!found) > + VEC_safe_push (breakpoint_p, modified_tp, loc->owner); > } > else > { > @@ -3514,6 +3536,12 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps) > t->number_on_target = utp->number; > } > > + /* Notify 'breakpoint-modified' observer that at least one of B's > + locations is changed. */ /* Notify 'breakpoint-modified' observers that at least one of B's locations was changed. */ > + for (ix = 0; VEC_iterate (breakpoint_p, modified_tp, ix, b); ix++) > + observer_notify_breakpoint_modified (b); > + > + VEC_free (breakpoint_p, modified_tp); > free_uploaded_tps (uploaded_tps); > } -- Pedro Alves