Support disconnected tracing.

* infcmd.c (detach_command): Ask whether to stop tracing.
	* cli/cli-cmds.c (quit_command): Ditto.
	* breakpoint.h (struct breakpoint): New field number_on_target.
	* breakpoint.c (create_tracepoint_from_upload): New function.
	(get_tracepoint_by_number_on_target): New function.
	* remote.c (struct remote): New field disconnected_tracing.
	(remote_disconnected_tracing_feature): New function.
	(remote_protocol_features): Add DisconnectedTracing.
	(struct uploaded_tp): New struct.
	(uploaded_tps): New global.
	(get_uploaded_tp): New function.
	(find_matching_tracepoint): New function.
	(remote_get_tracing_state): New function.
	(remote_start_remote): Call it.
	* tracepoint.c (disconnected_tracing): New global.
	(trace_start_command): Initialize number_on_target.
	(stop_tracing): New function, split out from...
	(trace_stop_command): Call stop_tracing.
	(get_trace_status): New function, split out from...
	(trace_status_command): Call get_trace_status, add info on
	disconnection behavior.
	(disconnect_or_stop_tracing): New function.
	(finish_tfind_command): Translate from number on target.
	(trace_find_tracepoint_command): Translate to number on target.
	(send_disconnected_tracing_value): New function.
	(set_disconnected_tracing): New function.
	(_initialize_tracepoint): Add disconnected-tracing variable.
	* NEWS: Mention disconnected tracing.

	* gdb.texinfo (Starting and Stopping Trace Experiments): Document
	disconnected tracing.
	(Tracepoint Packets): Document new protocol.
This commit is contained in:
Stan Shebs
2010-01-06 20:31:28 +00:00
parent 30fd33bb93
commit d5551862df
10 changed files with 503 additions and 26 deletions

View File

@@ -1,3 +1,9 @@
2010-01-06 Stan Shebs <stan@codesourcery.com>
* gdb.texinfo (Starting and Stopping Trace Experiments): Document
disconnected tracing.
(Tracepoint Packets): Document new protocol.
2010-01-05 Stan Shebs <stan@codesourcery.com>
* gdb.texinfo (Create and Delete Tracepoints): Describe fast

View File

@@ -9781,6 +9781,47 @@ Enter actions for tracepoint #1, one per line.
(@value{GDBP}) @b{tstop}
@end smallexample
@cindex disconnected tracing
You can choose to continue running the trace experiment even if
@value{GDBN} disconnects from the target, voluntarily or
involuntarily. For commands such as @code{detach}, the debugger will
ask what you want to do with the trace. But for unexpected
terminations (@value{GDBN} crash, network outage), it would be
unfortunate to lose hard-won trace data, so the variable
@code{disconnected-tracing} lets you decide whether the trace should
continue running without @value{GDBN}.
@table @code
@item set disconnected-tracing on
@itemx set disconnected-tracing off
@kindex set disconnected-tracing
Choose whether a tracing run should continue to run if @value{GDBN}
has disconnected from the target. Note that @code{detach} or
@code{quit} will ask you directly what to do about a running trace no
matter what this variable's setting, so the variable is mainly useful
for handling unexpected situations, such as loss of the network.
@item show disconnected-tracing
@kindex show disconnected-tracing
Show the current choice for disconnected tracing.
@end table
When you reconnect to the target, the trace experiment may or may not
still be running; it might have filled the trace buffer in the
meantime, or stopped for one of the other reasons. If it is running,
it will continue after reconnection.
Upon reconnection, the target will upload information about the
tracepoints in effect. @value{GDBN} will then compare that
information to the set of tracepoints currently defined, and attempt
to match them up, allowing for the possibility that the numbers may
have changed due to creation and deletion in the meantime. If one of
the target's tracepoints does not match any in @value{GDBN}, the
debugger will create a new tracepoint, so that you have a number with
which to specify that tracepoint. This matching-up process is
necessarily heuristic, and it may result in useless tracepoints being
created; you may simply delete them if they are of no use.
@node Analyze Collected Data
@section Using the Collected Data
@@ -29721,7 +29762,10 @@ encoded). @value{GDBN} will continue to supply the values of symbols
(if available), until the target ceases to request them.
@end table
@item QTDP
@item QTDisconnected
@itemx QTDP
@itemx QTDV
@itemx QTfP
@itemx QTFrame
@xref{Tracepoint Packets}.
@@ -29750,11 +29794,13 @@ the command by a @samp{,}, not a @samp{:}, contrary to the naming
conventions above. Please don't use this packet as a model for new
packets.)
@item QTStart
@item QTsP
@itemx QTStart
@itemx QTStop
@itemx QTinit
@itemx QTro
@itemx qTStatus
@itemx qTV
@xref{Tracepoint Packets}.
@item qXfer:@var{object}:read:@var{annex}:@var{offset},@var{length}
@@ -30152,6 +30198,12 @@ containing program code. Since these areas never change, they should
still have the same contents they did when the tracepoint was hit, so
there's no reason for the stub to refuse to provide their contents.
@item QTDisconnected:@var{value}
Set the choice to what to do with the tracing run when @value{GDBN}
disconnects from the target. A @var{value} of 1 directs the target to
continue the tracing run, while 0 tells the target to stop tracing if
@value{GDBN} is no longer in the picture.
@item qTStatus
Ask the stub if there is a trace experiment running right now.
@@ -30184,6 +30236,14 @@ if the user is examining a trace frame in which the requested variable
was not collected.
@end table
@item qTfP
@itemx qTsP
These packets request data about tracepoints that are being used by
the target. @value{GDBN} sends @code{qTfP} to get the first piece
of data, and multiple @code{qTsP} to get additional pieces. Replies
to these packets generally take the form of the @code{QTDP} packets
that define tracepoints. (FIXME add detailed syntax)
@end table
@node Host I/O Packets