From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21997 invoked by alias); 16 Aug 2011 09:28:35 -0000 Received: (qmail 21985 invoked by uid 22791); 16 Aug 2011 09:28:34 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-fx0-f41.google.com (HELO mail-fx0-f41.google.com) (209.85.161.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 16 Aug 2011 09:28:19 +0000 Received: by fxg9 with SMTP id 9so4787459fxg.0 for ; Tue, 16 Aug 2011 02:28:18 -0700 (PDT) Received: by 10.223.13.13 with SMTP id z13mr6982721faz.114.1313486898125; Tue, 16 Aug 2011 02:28:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.115.11 with HTTP; Tue, 16 Aug 2011 02:27:38 -0700 (PDT) In-Reply-To: References: <4E406AE9.100@earthlink.net> From: Hui Zhu Date: Tue, 16 Aug 2011 09:28:00 -0000 Message-ID: Subject: Re: [PATCH]tracepoint.c: Add conditionals num to find_matching_tracepoint To: Stan Shebs , gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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: 2011-08/txt/msg00322.txt.bz2 On Sun, Aug 14, 2011 at 21:40, Hui Zhu wrote: > On Tue, Aug 9, 2011 at 07:02, Stan Shebs wrote: >> On 8/7/11 9:28 AM, Hui Zhu wrote: >>> >>> Hi, >>> >>> I found that when I set some tracepoint to a same address, and use >>> tsave. =A0 And use "target tfile " to open it. =A0It will only one >>> tracepoint available. >>> And output some words like: >>> Created tracepoint 1 for target's tracepoint 1 at 0x40050a. >>> Assuming tracepoint 1 is same as target's tracepoint 2 at 0x40050a. >>> Assuming tracepoint 1 is same as target's tracepoint 3 at 0x40050a. >>> >>> This is because find_matching_tracepoint didn't check the num. >> >> >> The number is exactly the one property that tracepoint upload must never >> consider when looking for matching tracepoints, since the numbers vary >> depending on what the user has been doing during the current GDB session. >> =A0Addressing the FIXME will help the multiple-tracepoint case, although= it's >> kind of messy. >> >> There is another useful heuristic that would be easy to add, which is to >> exclude matching on a tracepoint that has already been uploaded. =A0Havi= ng >> created tracepoint 1 from the uploaded info, it's never going to be the = case >> that uploaded tracepoints 2 and 3 are the same as 1. =A0It might be as s= imple >> as testing number_on_target, but beware that it might be nonzero due to >> other trace runs or some such. >> >> Stan >> stan@codesourcery.com >> >>> >>> And I think the tracepoint have the same address is really helpful for >>> user. =A0Because we can set different condition to make tracepoint more >>> powerful. >>> So I make following patch. >>> >>> Please help me review it. >>> >>> Thanks, >>> Hui >>> >>> >>> 2011-08-08 =A0Hui Zhu >>> >>> =A0 =A0 =A0 =A0* tracepoint.c (find_matching_tracepoint): Add number ch= eck. >> >> Ping. Thanks, Hui > > Hi Stan, > > Thanks for your review. > > I make a new patch that check the condition according to your mail. > > Best, > Hui > > 2011-08-14 =A0Hui Zhu =A0 > > =A0 =A0 =A0 =A0* tracepoint.c (cond_string_is_same): New function. > =A0 =A0 =A0 =A0(find_matching_tracepoint): Add condition check > =A0 =A0 =A0 =A0by cond_string_is_same. > --- > =A0tracepoint.c | =A0 19 ++++++++++++++++++- > =A01 file changed, 18 insertions(+), 1 deletion(-) > > --- a/tracepoint.c > +++ b/tracepoint.c > @@ -3091,6 +3091,22 @@ free_uploaded_tsvs (struct uploaded_tsv > =A0 =A0 } > =A0} > > +static int > +cond_string_is_same(char *str1, char *str2) > +{ > + =A0if (str1 =3D=3D NULL || str2 =3D=3D NULL) > + =A0 =A0{ > + =A0 =A0 =A0if (str1 =3D=3D str2) > + =A0 =A0 =A0 return 1; > + =A0 =A0 =A0else > + =A0 =A0 =A0 return 0; > + =A0 =A0} > + =A0if (strcmp (str1, str2)) > + =A0 =A0return 0; > + > + =A0return 1; > +} > + > =A0/* Look for an existing tracepoint that seems similar enough to the > =A0 =A0uploaded one. =A0Enablement isn't compared, because the user can > =A0 =A0toggle that freely, and may have done so in anticipation of the > @@ -3111,7 +3127,8 @@ find_matching_tracepoint (struct uploade > =A0 =A0 =A0 if (b->type =3D=3D utp->type > =A0 =A0 =A0 =A0 =A0&& t->step_count =3D=3D utp->step > =A0 =A0 =A0 =A0 =A0&& t->pass_count =3D=3D utp->pass > - =A0 =A0 =A0 =A0 /* FIXME also test conditionals and actions. =A0*/ > + =A0 =A0 =A0 =A0 && cond_string_is_same (t->base.cond_string, utp->cond_= string) > + =A0 =A0 =A0 =A0 /* FIXME also test actions. =A0*/ > =A0 =A0 =A0 =A0 =A0) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0/* Scan the locations for an address match. =A0*/ >