From f5911ea11965af3dc626c1c6278e45e214fc640c Mon Sep 17 00:00:00 2001 From: Hafiz Abid Qadeer Date: Fri, 15 Feb 2013 09:47:50 +0000 Subject: 2013-02-15 Pedro Alves Hafiz Abid Qadeer gdb/ * NEWS: Mention new field "trace-file". * 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. Check the "filename" field explicitely. (trace_status_command): Explicitely check "filename" field. (trace_find_command): Ditto. (trace_find_pc_command): Ditto. (trace_find_tracepoint_command): Ditto. (trace_find_line_command): Ditto. (trace_find_range_command): Ditto. (trace_find_outside_command): Ditto. * tracepoint.h (struct trace_status) : Rename it to "filename" and make it hold the trace file's filename instead of a boolean. * remote.c (remote_get_trace_status): Initialize "filename" field with NULL instead of 0. gdb/doc/ * gdb.texinfo (GDB/MI Tracepoint Commands) <-trace-status>: Document the "trace-file" field. gdb/testsuite/ * gdb.trace/tfile.exp: Add test for -trace-status command. --- gdb/tracepoint.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'gdb/tracepoint.c') diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2e50164..ca104aa 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1940,7 +1940,7 @@ trace_status_command (char *args, int from_tty) if (status == -1) { - if (ts->from_file) + if (ts->filename != NULL) printf_filtered (_("Using a trace file.\n")); else { @@ -2100,17 +2100,20 @@ trace_status_mi (int on_stop) status = target_get_trace_status (ts); - if (status == -1 && !ts->from_file) + if (status == -1 && ts->filename == NULL) { ui_out_field_string (uiout, "supported", "0"); return; } - if (ts->from_file) + if (ts->filename != NULL) ui_out_field_string (uiout, "supported", "file"); else if (!on_stop) ui_out_field_string (uiout, "supported", "1"); + if (ts->filename != NULL) + ui_out_field_string (uiout, "trace-file", ts->filename); + gdb_assert (ts->running_known); if (ts->running) @@ -2399,7 +2402,8 @@ trace_find_command (char *args, int from_tty) { /* This should only be called with a numeric argument. */ int frameno = -1; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -2450,7 +2454,8 @@ trace_find_pc_command (char *args, int from_tty) { CORE_ADDR pc; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -2468,7 +2473,8 @@ trace_find_tracepoint_command (char *args, int from_tty) int tdp; struct tracepoint *tp; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -2507,7 +2513,8 @@ trace_find_line_command (char *args, int from_tty) struct symtab_and_line sal; struct cleanup *old_chain; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -2572,7 +2579,8 @@ trace_find_range_command (char *args, int from_tty) static CORE_ADDR start, stop; char *tmp; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -2605,7 +2613,8 @@ trace_find_outside_command (char *args, int from_tty) CORE_ADDR start, stop; char *tmp; - if (current_trace_status ()->running && !current_trace_status ()->from_file) + if (current_trace_status ()->running + && current_trace_status ()->filename == NULL) error (_("May not look at trace frames while trace is running.")); if (args == 0 || *args == 0) @@ -3762,8 +3771,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->filename = trace_filename; /* Set defaults in case there is no status line. */ ts->running_known = 0; ts->stop_reason = trace_stop_reason_unknown; @@ -4213,8 +4222,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. */ -- cgit v1.1