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;