From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30297 invoked by alias); 11 Apr 2013 06:17: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 30247 invoked by uid 89); 11 Apr 2013 06:17:57 -0000 X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 06:17:56 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UQApW-0004XC-Ia from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Wed, 10 Apr 2013 23:17:54 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 10 Apr 2013 23:17:52 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Wed, 10 Apr 2013 23:17:50 -0700 Message-ID: <5166558B.90201@mentor.com> Date: Thu, 11 Apr 2013 10:33:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: gdb-patches ml Subject: [PATCH] store trace default-collect to target [3/6] tfile References: <51665508.5050706@mentor.com> In-Reply-To: <51665508.5050706@mentor.com> Content-Type: multipart/mixed; boundary="------------060901040603080307000900" X-Virus-Found: No X-SW-Source: 2013-04/txt/msg00312.txt.bz2 --------------060901040603080307000900 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 592 Hi, This patch is to store trace default-collect to tfile when tsave and read it out when tfile target open a tfile. Thanks, Hui 2013-04-11 Hui Zhu * ctf.c (ctf_write_default_collect): New. (trace_file_write_ops): Add ctf_write_default_collect. * tracepoint.c (tfile_write_default_collect): New. (trace_file_write_ops): Add tfile_write_default_collect. (trace_save): Call writer->ops->write_default_collect. (tfile_interp_line): Add collectp. (tfile_open): Add support of default collect. * tracepoint.h (trace_file_write_ops): Add write_default_collect. --------------060901040603080307000900 Content-Type: text/plain; charset="us-ascii"; name="defc-tfile.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="defc-tfile.txt" Content-length: 4085 --- a/ctf.c +++ b/ctf.c @@ -616,6 +616,17 @@ ctf_write_uploaded_tp (struct trace_file } /* This is the implementation of trace_file_write_ops method + write_default_collect. */ + +static void +ctf_write_default_collect (struct trace_file_writer *self, + char *collect) +{ + /* It is not supported yet to write default collect + into CTF trace data. */ +} + +/* This is the implementation of trace_file_write_ops method write_definition_end. */ static void @@ -847,6 +858,7 @@ static const struct trace_file_write_ops ctf_write_status, ctf_write_uploaded_tsv, ctf_write_uploaded_tp, + ctf_write_default_collect, ctf_write_definition_end, NULL, &ctf_write_frame_ops, --- a/tracepoint.c +++ b/tracepoint.c @@ -3237,6 +3237,19 @@ tfile_write_uploaded_tp (struct trace_fi } /* This is the implementation of trace_file_write_ops method + write_default_collect. */ + +static void +tfile_write_default_collect (struct trace_file_writer *self, + char *collect) +{ + struct tfile_trace_file_writer *writer + = (struct tfile_trace_file_writer *) self; + + fprintf (writer->fp, "dc %s\n", collect); +} + +/* This is the implementation of trace_file_write_ops method write_definition_end. */ static void @@ -3289,6 +3302,7 @@ static const struct trace_file_write_ops tfile_write_status, tfile_write_uploaded_tsv, tfile_write_uploaded_tp, + tfile_write_default_collect, tfile_write_definition_end, tfile_write_raw_data, NULL, @@ -3378,6 +3392,8 @@ trace_save (const char *filename, struct for (utp = uploaded_tps; utp; utp = utp->next) writer->ops->write_uploaded_tp (writer, utp); + writer->ops->write_default_collect (writer, default_collect); + free_uploaded_tps (&uploaded_tps); /* Mark the end of the definition section. */ @@ -4147,7 +4163,8 @@ int trace_regblock_size; static void tfile_interp_line (char *line, struct uploaded_tp **utpp, - struct uploaded_tsv **utsvp); + struct uploaded_tsv **utsvp, + char **collectp); /* Read SIZE bytes into READBUF from the trace frame, starting at TRACE_FD's current position. Note that this call `read' @@ -4182,6 +4199,7 @@ tfile_open (char *filename, int from_tty struct trace_status *ts; struct uploaded_tp *uploaded_tps = NULL; struct uploaded_tsv *uploaded_tsvs = NULL; + char *uploaded_default_collest = NULL; target_preopen (from_tty); if (!filename) @@ -4251,7 +4269,8 @@ tfile_open (char *filename, int from_tty break; linebuf[i] = '\0'; i = 0; - tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs); + tfile_interp_line (linebuf, &uploaded_tps, &uploaded_tsvs, + &uploaded_default_collest); } else linebuf[i++] = byte; @@ -4289,6 +4308,8 @@ tfile_open (char *filename, int from_tty merge_uploaded_tracepoints (&uploaded_tps); + trace_set_default_collect (uploaded_default_collest); + post_create_inferior (&tfile_ops, from_tty); } @@ -4297,7 +4318,8 @@ tfile_open (char *filename, int from_tty static void tfile_interp_line (char *line, - struct uploaded_tp **utpp, struct uploaded_tsv **utsvp) + struct uploaded_tp **utpp, struct uploaded_tsv **utsvp, + char **collectp) { char *p = line; @@ -4321,6 +4343,11 @@ tfile_interp_line (char *line, p += strlen ("tsv "); parse_tsv_definition (p, utsvp); } + else if (strncmp (p, "dc ", strlen ("dc ")) == 0) + { + p += strlen ("dc "); + *collectp = xstrdup (p); + } else warning (_("Ignoring trace file definition \"%s\""), line); } --- a/tracepoint.h +++ b/tracepoint.h @@ -296,6 +296,10 @@ struct trace_file_write_ops void (*write_uploaded_tp) (struct trace_file_writer *self, struct uploaded_tp *tp); + /* Write the tracepoint default collect. */ + void (*write_default_collect) (struct trace_file_writer *self, + char *collect); + /* Write to mark the end of the definition part. */ void (*write_definition_end) (struct trace_file_writer *self); --------------060901040603080307000900--