From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15609 invoked by alias); 13 May 2013 06:00: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 15599 invoked by uid 89); 13 May 2013 06:00:57 -0000 X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-oa0-f41.google.com (HELO mail-oa0-f41.google.com) (209.85.219.41) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 13 May 2013 06:00:55 +0000 Received: by mail-oa0-f41.google.com with SMTP id n9so2764873oag.28 for ; Sun, 12 May 2013 23:00:54 -0700 (PDT) X-Received: by 10.60.27.136 with SMTP id t8mr11893213oeg.92.1368424854092; Sun, 12 May 2013 23:00:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.13.133 with HTTP; Sun, 12 May 2013 23:00:14 -0700 (PDT) In-Reply-To: References: <51665508.5050706@mentor.com> <5166554D.2070906@mentor.com> <516694E8.4040107@codesourcery.com> From: Hui Zhu Date: Mon, 13 May 2013 06:00:00 -0000 Message-ID: Subject: Re: [PATCH] store trace default-collect to target [1/6] target, trace and remote To: gdb-patches ml Cc: Hui Zhu , Yao Qi , "Abid, Hafiz" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-05/txt/msg00416.txt.bz2 Ping http://sourceware.org/ml/gdb-patches/2013-04/msg00452.html Thanks, Hui On Tue, Apr 16, 2013 at 5:28 PM, Hui Zhu wrote: > Hi Yao and Abid, > > Thanks for your review. > > On Thu, Apr 11, 2013 at 6:48 PM, Yao Qi wrote: >> On 04/11/2013 02:16 PM, Hui Zhu wrote: >>> >>> --- a/remote.c >>> +++ b/remote.c >>> @@ -215,6 +215,8 @@ static int remote_get_trace_status (stru >>> static int remote_upload_tracepoints (struct uploaded_tp **utpp); >>> >>> static int remote_upload_trace_state_variables (struct uploaded_tsv >>> **utsvp); >>> + >>> +static void remote_upload_trace_default_collest (char **collectp); >> >> ^^^^^^^ typo "collect" > > Oops, all fixed. > >> >>> >>> static void remote_query_supported (void); >>> >>> @@ -3567,6 +3569,7 @@ remote_start_remote (int from_tty, struc >>> { >>> struct uploaded_tp *uploaded_tps =3D NULL; >>> struct uploaded_tsv *uploaded_tsvs =3D NULL; >>> + char *uploaded_default_collest =3D NULL; >> >> ^^^^^^^ typo. >> >>> >>> if (current_trace_status ()->running) >>> printf_filtered (_("Trace is already running on the target.\n")= ); >>> @@ -3581,6 +3584,10 @@ remote_start_remote (int from_tty, struc >>> remote_upload_tracepoints (&uploaded_tps); >>> >>> merge_uploaded_tracepoints (&uploaded_tps); >>> + >>> + remote_upload_trace_default_collest (&uploaded_default_collest); >>> + >>> + trace_set_default_collect (uploaded_default_collest); >> >> >> Likewise. >> >>> } >>> >>> /* The thread and inferior lists are now synchronized with the >>> @@ -10567,6 +10574,23 @@ remote_download_tracepoint (struct bp_lo >>> do_cleanups (old_chain); >>> } >>> >>> +static void >>> +remote_download_tracepoint_default_collect (char *collect) >> >> >> Add a comment to this function. > > Fixed. > > /* Download COLLECT that is default collect string to target. */ > >> >>> >>> +static void >>> +remote_upload_trace_default_collest (char **collectp) >> >> >> Comments to this function are needed as well. > > Fixed. > > > /* Download COLLECT that is default collect string to target. */ > > static void > remote_download_tracepoint_default_collect (char *collect) > >> >>> +/* Not overwrite default collect If COLLECT is NULL or its size is 0. = */ >>> + >>> +void >>> +trace_set_default_collect (char *collect) >>> +{ >>> + if (collect !=3D NULL && strlen (collect) !=3D 0) >>> + { >>> + xfree (default_collect); >>> + default_collect =3D collect; >>> + } >>> +} >> >> >> It looks incorrect to me. When we change target to a tfile, in which the >> default-collect is "", the variable default_collect won't be updated. >> >> Supposing we have two tfile actions.tf and actions1.tf, the default-coll= ect >> is "$regs" and "" respectively, >> >> (gdb) target tfile testsuite/gdb.trace/actions.tf >> (gdb) show default-collect >> The list of expressions to collect by default is "$regs". >> (gdb) target tfile testsuite/gdb.trace/actions1.tf >> (gdb) show default-collect >> The list of expressions to collect by default is "$regs". >> >> I don't have other comments. > > Agree with you. Updated patch for it. > >> >> -- >> Yao (=E9=BD=90=E5=B0=A7) > > On Thu, Apr 11, 2013 at 10:08 PM, Abid, Hafiz wro= te: >> Hi Hui, >>> >>> + putpkt (buf); >>> + remote_get_noisy_reply (&target_buf, &target_buf_size); >>> + if (strcmp (target_buf, "OK")) >>> + warning (_("\ >> >> >> Just a small comment on style. I think it is better to be explicit in su= ch >> case and write !=3D 0. Also I was advised by Pedro recently that new pac= kets >> should be using packet_ok which will eliminate the need for strcmp here >> anyway. >> > > Update there part use packet_ok. > >>> + putpkt ("qTDC"); >>> + getpkt (&rs->buf, &rs->buf_size, 0); >>> + if (strncmp (rs->buf, "DC", 2)) >>> + { >> >> Why not remote_get_noisy_reply here. > > Changed. And I also add "PACKET_qTDC" for this part. But I am not > sure set "remote_protocol_packets[PACKET_qTDC].support" inside the > function is a good choice or not. > >> >> >> Regards, >> Abid > > > Post a new version for that. Please help me review it. > > Best, > Hui > > > 2013-04-16 Hui Zhu > > * remote.c (remote_upload_trace_default_collect): New static. > (PACKET_QTDDCsrc, PACKET_qTDC): New. > (remote_start_remote): Call remote_upload_trace_default_collect > and trace_set_default_collect. > (remote_download_tracepoint_default_collect): New. > (remote_can_download_tracepoint): Set > to_download_tracepoint_default_collect. > (remote_upload_trace_default_collect): New. > (_initialize_remote): Add QTDDCsrc and qTDC. > * target.c (update_current_target): Add > to_download_tracepoint_default_collect. > * target.h (target_ops): to_download_tracepoint_default_collect. > (target_download_tracepoint_default_collect): New. > * tracepoint.c (start_tracing): Call > target_download_tracepoint_default_collect. > (trace_set_default_collect): New. > * tracepoint.h (trace_set_default_collect): New extern.