From: "Abid, Hafiz" <hafiz_abid@mentor.com>
To: <gdb-patches@sourceware.org>
Cc: <palves@redhat.com>, <marc.khouzam@ericsson.com>
Subject: [Patch] Get trace file name when using 'target tfile'
Date: Wed, 13 Feb 2013 14:38:00 -0000 [thread overview]
Message-ID: <1360766298.2842.0@abidh-ubunto1104> (raw)
[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]
Hi All,
When using 'target tfile', commands like 'info target' and 'info files'
don't show the name of the trace file. This patch adds this
information. It also add a new field in the output of the -trace-status
command so that frontends can get this inforamtion.
This patch was originally written by Pedro. I have updated and
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="file",running="0",stop-reason="request",frames="7215",frames-created="7215",buffer-size="5242880",buffer-free="2833070",disconnected="0",circular="0",user-name="",notes="",start-time="0.000000",stop-time="0.000000"
After:
(gdb) info target
Local trace dump file:
`/home/abidh/trace.txt'
(gdb) interpreter-exec mi -trace-status
^done,supported="file",trace-file="/home/abidh/trace.txt",running="0",stop-reason="request",frames="7215",frames-created="7215",buffer-size="5242880",buffer-free="2833070",disconnected="0",circular="0",user-name="",notes="",start-time="0.000000",stop-time="0.000000"
2013-02-13 Pedro Alves <pedro@codesourcery.com>
Hafiz Abid Qadeer <abidh@codesourcery.com>
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) <from_file>: Make it hold
the
trace file's filename instead of a boolean.
gdb/doc/
* gdb.texinfo (GDB/MI Tracepoint Commands) <-trace-status>:
Document the "trace-file" field.
[-- Attachment #2: trace.patch --]
[-- Type: text/x-patch, Size: 2311 bytes --]
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.
+@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
@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");
+ if (ts->from_file)
+ ui_out_field_string (uiout, "trace-file", ts->from_file);
+
gdb_assert (ts->running_known);
if (ts->running)
@@ -3745,8 +3748,8 @@ tfile_open (char *filename, int from_tty)
trace_regblock_size = 0;
ts = current_trace_status ();
- /* We know we're working with a file. */
- ts->from_file = 1;
+ /* We know we're working with a file. Record its name. */
+ ts->from_file = trace_filename;
/* Set defaults in case there is no status line. */
ts->running_known = 0;
ts->stop_reason = 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);
}
/* 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
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;
/* This is true if the value of the running field is known. */
int running_known;
next reply other threads:[~2013-02-13 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 14:38 Abid, Hafiz [this message]
2013-02-13 16:34 ` Pedro Alves
2013-02-13 17:59 ` Eli Zaretskii
2013-02-14 3:17 ` Yao Qi
2013-02-14 14:34 ` Pedro Alves
2013-02-14 15:49 ` Abid, Hafiz
2013-02-14 15:57 ` Pedro Alves
2013-02-14 22:02 ` Eli Zaretskii
2013-02-15 10:15 ` Abid, Hafiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360766298.2842.0@abidh-ubunto1104 \
--to=hafiz_abid@mentor.com \
--cc=gdb-patches@sourceware.org \
--cc=marc.khouzam@ericsson.com \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox