From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31716 invoked by alias); 13 Feb 2013 14:38:32 -0000 Received: (qmail 31708 invoked by uid 22791); 13 Feb 2013 14:38:32 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,WEIRD_QUOTING X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Feb 2013 14:38:21 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U5dTY-0002Q6-Ou from Hafiz_Abid@mentor.com ; Wed, 13 Feb 2013 06:38:20 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 13 Feb 2013 06:38:19 -0800 Received: from abidh-ubunto1104 (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.1.289.1; Wed, 13 Feb 2013 14:38:18 +0000 Date: Wed, 13 Feb 2013 14:38:00 -0000 From: "Abid, Hafiz" Subject: [Patch] Get trace file name when using 'target tfile' To: CC: , Message-ID: <1360766298.2842.0@abidh-ubunto1104> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-OX+7a4aDqg7VSpv2Ed+X" 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: 2013-02/txt/msg00305.txt.bz2 --=-OX+7a4aDqg7VSpv2Ed+X Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1702 Hi All, When using 'target tfile', commands like 'info target' and 'info files'=20= =20 don't show the name of the trace file. This patch adds this=20=20 information. It also add a new field in the output of the -trace-status=20= =20 command so that frontends can get this inforamtion. This patch was originally written by Pedro. I have updated and=20=20 regtested it. Regards, Abid Before: (gdb) info target Local trace dump file: Looking at a trace file. (gdb) interpreter-exec mi -trace-status ^done,supported=3D"file",running=3D"0",stop-reason=3D"request",frames=3D"72= 15",frames-created=3D"7215",buffer-size=3D"5242880",buffer-free=3D"2833070"= ,disconnected=3D"0",circular=3D"0",user-name=3D"",notes=3D"",start-time=3D"= 0.000000",stop-time=3D"0.000000" After: (gdb) info target Local trace dump file: `/home/abidh/trace.txt' (gdb) interpreter-exec mi -trace-status ^done,supported=3D"file",trace-file=3D"/home/abidh/trace.txt",running=3D"0"= ,stop-reason=3D"request",frames=3D"7215",frames-created=3D"7215",buffer-siz= e=3D"5242880",buffer-free=3D"2833070",disconnected=3D"0",circular=3D"0",use= r-name=3D"",notes=3D"",start-time=3D"0.000000",stop-time=3D"0.000000" 2013-02-13 Pedro Alves Hafiz Abid Qadeer gdb/ * tracepoint.c (trace_status_mi): Output "trace-file" field. (tfile_open): Record the trace file's filename in the trace status. (tfile_files_info): Mention the name of the trace file. * tracepoint.h (struct trace_status) : Make it hold=20=20 the trace file's filename instead of a boolean. gdb/doc/ * gdb.texinfo (GDB/MI Tracepoint Commands) <-trace-status>: Document the "trace-file" field.= --=-OX+7a4aDqg7VSpv2Ed+X Content-Type: text/x-patch; charset="us-ascii"; name="trace.patch" Content-Disposition: attachment; filename="trace.patch" Content-Transfer-Encoding: quoted-printable Content-length: 2274 diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e3f336e..e8ac8c5 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -32094,6 +32094,10 @@ The value of the disconnected tracing flag. @code= {1} means that tracing will continue after @value{GDBN} disconnects, @code{0} means that the trace run will stop. =20 +@item trace-file +The filename of the trace file being examined. This field is +optional, and only present when examining a trace file. + @end table =20 @subsubheading @value{GDBN} Command diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index b45863e..848a1b1 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2094,6 +2094,9 @@ trace_status_mi (int on_stop) else if (!on_stop) ui_out_field_string (uiout, "supported", "1"); =20 + if (ts->from_file) + ui_out_field_string (uiout, "trace-file", ts->from_file); + gdb_assert (ts->running_known); =20 if (ts->running) @@ -3745,8 +3748,8 @@ tfile_open (char *filename, int from_tty) =20 trace_regblock_size =3D 0; ts =3D current_trace_status (); - /* We know we're working with a file. */ - ts->from_file =3D 1; + /* We know we're working with a file. Record its name. */ + ts->from_file =3D trace_filename; /* Set defaults in case there is no status line. */ ts->running_known =3D 0; ts->stop_reason =3D trace_stop_reason_unknown; @@ -4196,8 +4199,7 @@ tfile_close (int quitting) static void tfile_files_info (struct target_ops *t) { - /* (it would be useful to mention the name of the file). */ - printf_filtered ("Looking at a trace file.\n"); + printf_filtered ("\t`%s'\n", trace_filename); } =20 /* The trace status for a file is that tracing can never be run. */ diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 2e1d83a..f407046 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -72,9 +72,9 @@ enum trace_stop_reason =20 struct trace_status { - /* This is true if the status is coming from a file rather - than a live target. */ - int from_file; + /* If the status is coming from a file rather than a live target, + this points at the file's filename. Otherwise, this is NULL. */ + const char *from_file; =20 /* This is true if the value of the running field is known. */ int running_known; --=-OX+7a4aDqg7VSpv2Ed+X--