+2010-04-08 Stan Shebs <stan@codesourcery.com>
+ Pedro Alves <pedro@codesourcery.com>
+
+ * tracepoint.h (struct trace_status): New fields disconnected_tracing
+ and circular_buffer.
+ (disconnect_tracing): Rename from disconnect_or_stop_tracing.
+ * tracepoint.c (trace_status_command): Display target's status for
+ disconnected tracing and circular buffer.
+ (disconnect_tracing): Rename from disconnect_or_stop_tracing, add
+ query for non-disconnected-tracing case, remove the stop_tracing
+ call.
+ (tfile_open): Clear disconnected and circular buffer status.
+ (trace_save): Save disconnected and circular buffer status.
+ (parse_trace_status): Parse disconnected and circular buffer status,
+ also recognize disconnected as a stop reason.
+ * remote.c (remote_set_disconnected_tracing): Only set
+ QTDisconnected if the remote end supports disconnected tracing.
+ Warn otherwise, if trying to enable disconnected tracing.
+ * infcmd.c (detach_command): Update disconnect_tracing call.
+ * cli/cli-cmds.c (quit_command): Ditto.
+
2010-04-08 H.J. Lu <hongjiu.lu@intel.com>
* i387-tdep.c (i387_collect_xsave): Replace abort with
@end table
-Additional optional fields supply statistical information. Although
-not required, they are extremely useful for users monitoring the
-progress of a trace run. If a trace has stopped, and these numbers
-are reported, they must reflect the state of the just-stopped trace.
+Additional optional fields supply statistical and other information.
+Although not required, they are extremely useful for users monitoring
+the progress of a trace run. If a trace has stopped, and these
+numbers are reported, they must reflect the state of the just-stopped
+trace.
@table @samp
@item tfree:@var{n}
The number of bytes still unused in the buffer.
+@item circular:@var{n}
+The value of the circular trace buffer flag. @code{1} means that the
+trace buffer is circular and old trace frames will be discarded if
+necessary to make room, @code{0} means that the trace buffer is linear
+and may fill up.
+
+@item disconn:@var{n}
+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.
+
@end table
@item qTV:@var{var}
else if (ts->running)
{
printf_filtered (_("Trace is running on the target.\n"));
- if (disconnected_tracing)
- printf_filtered (_("Trace will continue if GDB disconnects.\n"));
- else
- printf_filtered (_("Trace will stop if GDB disconnects.\n"));
}
else
{
ts->buffer_free);
}
+ if (ts->disconnected_tracing)
+ printf_filtered (_("Trace will continue if GDB disconnects.\n"));
+ else
+ printf_filtered (_("Trace will stop if GDB disconnects.\n"));
+
+ if (ts->circular_buffer)
+ printf_filtered (_("Trace buffer is circular.\n"));
+
/* Now report on what we're doing with tfind. */
if (traceframe_number >= 0)
printf_filtered (_("Looking at trace frame %d, tracepoint %d.\n"),
ui_out_field_int (uiout, "buffer-free", (int) ts->buffer_free);
}
-
+/* This function handles the details of what to do about an ongoing
+ tracing run if the user has asked to detach or otherwise disconnect
+ from the target. */
void
-disconnect_or_stop_tracing (int from_tty)
+disconnect_tracing (int from_tty)
{
/* It can happen that the target that was tracing went away on its
own, and we didn't notice. Get a status update, and if the
if (target_get_trace_status (current_trace_status ()) < 0)
current_trace_status ()->running = 0;
+ /* If running interactively, give the user the option to cancel and
+ then decide what to do differently with the run. Scripts are
+ just going to disconnect and let the target deal with it,
+ according to how it's been instructed previously via
+ disconnected-tracing. */
if (current_trace_status ()->running && from_tty)
{
- int cont = query (_("Trace is running. Continue tracing after detach? "));
- /* Note that we send the query result without affecting the
- user's setting of disconnected_tracing, so that the answer is
- a one-time-only. */
- send_disconnected_tracing_value (cont);
-
- /* Also ensure that we do the equivalent of a tstop command if
- tracing is not to continue after the detach. */
- if (!cont)
- stop_tracing ();
+ if (current_trace_status ()->disconnected_tracing)
+ {
+ if (!query (_("Trace is running and will continue after detach; detach anyway? ")))
+ error (_("Not confirmed."));
+ }
+ else
+ {
+ if (!query (_("Trace is running but will stop on detach; detach anyway? ")))
+ error (_("Not confirmed."));
+ }
}
/* Also we want to be out of tfind mode, otherwise things can get
fprintf (fp, ";tfree:%x", ts->buffer_free);
if (ts->buffer_size >= 0)
fprintf (fp, ";tsize:%x", ts->buffer_size);
+ if (ts->disconnected_tracing)
+ fprintf (fp, ";disconn:%x", ts->disconnected_tracing);
+ if (ts->circular_buffer)
+ fprintf (fp, ";circular:%x", ts->circular_buffer);
fprintf (fp, "\n");
/* Note that we want to upload tracepoints and save those, rather
ts->stop_reason = trace_stop_reason_unknown;
ts->traceframe_count = -1;
ts->buffer_free = 0;
+ ts->disconnected_tracing = 0;
+ ts->circular_buffer = 0;
/* Read through a section of newline-terminated lines that
define things like tracepoints. */
ts->traceframes_created = -1;
ts->buffer_free = -1;
ts->buffer_size = -1;
+ ts->disconnected_tracing = 0;
+ ts->circular_buffer = 0;
while (*p++)
{
p = unpack_varlen_hex (++p1, &val);
ts->stop_reason = tstop_command;
}
+ else if (strncmp (p, stop_reason_names[trace_disconnected], p1 - p) == 0)
+ {
+ p = unpack_varlen_hex (++p1, &val);
+ ts->stop_reason = trace_disconnected;
+ }
else if (strncmp (p, stop_reason_names[tracepoint_error], p1 - p) == 0)
{
p2 = strchr (++p1, ':');
p = unpack_varlen_hex (++p1, &val);
ts->buffer_size = val;
}
+ else if (strncmp (p, "disconn", p1 - p) == 0)
+ {
+ p = unpack_varlen_hex (++p1, &val);
+ ts->disconnected_tracing = val;
+ }
+ else if (strncmp (p, "circular", p1 - p) == 0)
+ {
+ p = unpack_varlen_hex (++p1, &val);
+ ts->circular_buffer = val;
+ }
else
{
/* Silently skip unknown optional info. */