diff options
author | Kwok Yeung <kcy@sourceware.org> | 2011-05-12 12:09:17 +0000 |
---|---|---|
committer | Kwok Yeung <kcy@sourceware.org> | 2011-05-12 12:09:17 +0000 |
commit | d248b706a328fbba18c4320880b36df5488b1e91 (patch) | |
tree | 4147e6bb3093b75c1a62833173b0213b060505bf /gdb/remote.c | |
parent | de1491f042ec18741bc7427aeb69d9c5ffa1cbd7 (diff) | |
download | gdb-d248b706a328fbba18c4320880b36df5488b1e91.zip gdb-d248b706a328fbba18c4320880b36df5488b1e91.tar.gz gdb-d248b706a328fbba18c4320880b36df5488b1e91.tar.bz2 |
Add support for enabling and disabling tracepoints while a trace
experiment is still running.
gdb/
* breakpoint.c (disable_breakpoint): Disable all locations
associated with a tracepoint on target if a trace experiment is
running.
(disable_command): Disable a specific tracepoint location on target if
a trace experiment is running.
(do_enable_breakpoint): Enable all locations associated with a
tracepoint on target if a trace experiment is running.
(enable_command) Enable a specific tracepoint location on target if a
trace experiment is running.
* target.c (update_current_target): Add INHERIT and de_fault clauses for
to_supports_enable_disable_tracepoint, to_enable_tracepoint and
to_disable_tracepoint.
* target.h: Add declaration of struct bp_location.
(struct target_ops): Add new functions
to_supports_enable_disable_tracepoint, to_enable_tracepoint and
to_disable_tracepoint to target operations.
(target_supports_enable_disable_tracepoint): New macro.
(target_enable_tracepoint): New macro.
(target_disable_tracepoint): New macro.
* remote.c (struct remote_state): Add new field.
(remote_enable_disable_tracepoint_feature): New.
(remote_protocol_features): Add new entry.
(remote_supports_enable_disable_tracepoint): New.
(remote_enable_tracepoint): New.
(remote_disable_tracepoint): New.
(init_remote_ops): Add remote_enable_tracepoint,
remote_disable_tracepoint and remote_supports_enable_disable_tracepoint
to remote operations.
* tracepoint.c (start_tracing): Allow tracing to start without any
tracepoints enabled with just a warning if they can be re-enabled
later.
* NEWS: Add news item for the new behaviour of the enable and disable
GDB commands when applied to tracepoints.
Add news items for the new remote packets QTEnable and QTDisable.
gdb/doc/
* gdb.texinfo: Document change in the behaviour of the enable and
disable GDB commands when applied to tracepoints.
Document the EnableDisableTracepoints remote stub feature.
Document QTEnable and QTDisable in the list of tracepoint packets.
gdb/gdbserver/
* server.c (handle_query): Add EnableDisableTracepoints to the list
of supported features.
* tracepoint.c (clear_installed_tracepoints): Uninstall disabled
tracepoints.
(cmd_qtenable_disable): New.
(cmd_qtstart): Install tracepoints even if disabled.
(handle_tracepoint_general_set): Add call to cmd_qtenable_disable on
receiving a QTEnable or QTDisable packet.
(gdb_collect): Skip data collection if fast tracepoint is disabled.
(ust_marker_to_static_tracepoint): Do not ignore disabled static
tracepoints.
(gdb_probe): Skip data collection if static tracepoint is disabled.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 76c137a..ff64b04 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -329,6 +329,10 @@ struct remote_state disconnected. */ int disconnected_tracing; + /* True if the stub reports support for enabling and disabling + tracepoints while a trace experiment is running. */ + int enable_disable_tracepoints; + /* Nonzero if the user has pressed Ctrl-C, but the target hasn't responded to that. */ int ctrlc_pending_p; @@ -3689,6 +3693,16 @@ remote_disconnected_tracing_feature (const struct protocol_feature *feature, rs->disconnected_tracing = (support == PACKET_ENABLE); } +static void +remote_enable_disable_tracepoint_feature (const struct protocol_feature *feature, + enum packet_support support, + const char *value) +{ + struct remote_state *rs = get_remote_state (); + + rs->enable_disable_tracepoints = (support == PACKET_ENABLE); +} + static struct protocol_feature remote_protocol_features[] = { { "PacketSize", PACKET_DISABLE, remote_packet_size, -1 }, { "qXfer:auxv:read", PACKET_DISABLE, remote_supported_packet, @@ -3735,6 +3749,8 @@ static struct protocol_feature remote_protocol_features[] = { PACKET_TracepointSource }, { "QAllow", PACKET_DISABLE, remote_supported_packet, PACKET_QAllow }, + { "EnableDisableTracepoints", PACKET_DISABLE, + remote_enable_disable_tracepoint_feature, -1 }, }; static char *remote_support_xml; @@ -9648,6 +9664,14 @@ remote_supports_static_tracepoints (void) return rs->static_tracepoints; } +static int +remote_supports_enable_disable_tracepoint (void) +{ + struct remote_state *rs = get_remote_state (); + + return rs->enable_disable_tracepoints; +} + static void remote_trace_init (void) { @@ -9919,6 +9943,38 @@ remote_download_trace_state_variable (struct trace_state_variable *tsv) } static void +remote_enable_tracepoint (struct bp_location *location) +{ + struct remote_state *rs = get_remote_state (); + char addr_buf[40]; + + sprintf_vma (addr_buf, location->address); + sprintf (rs->buf, "QTEnable:%x:%s", location->owner->number, addr_buf); + putpkt (rs->buf); + remote_get_noisy_reply (&rs->buf, &rs->buf_size); + if (*rs->buf == '\0') + error (_("Target does not support enabling tracepoints while a trace run is ongoing.")); + if (strcmp (rs->buf, "OK") != 0) + error (_("Error on target while enabling tracepoint.")); +} + +static void +remote_disable_tracepoint (struct bp_location *location) +{ + struct remote_state *rs = get_remote_state (); + char addr_buf[40]; + + sprintf_vma (addr_buf, location->address); + sprintf (rs->buf, "QTDisable:%x:%s", location->owner->number, addr_buf); + putpkt (rs->buf); + remote_get_noisy_reply (&rs->buf, &rs->buf_size); + if (*rs->buf == '\0') + error (_("Target does not support disabling tracepoints while a trace run is ongoing.")); + if (strcmp (rs->buf, "OK") != 0) + error (_("Error on target while disabling tracepoint.")); +} + +static void remote_trace_set_readonly_regions (void) { asection *s; @@ -10308,10 +10364,13 @@ Specify the serial device it is connected to\n\ remote_ops.to_terminal_ours = remote_terminal_ours; remote_ops.to_supports_non_stop = remote_supports_non_stop; remote_ops.to_supports_multi_process = remote_supports_multi_process; + remote_ops.to_supports_enable_disable_tracepoint = remote_supports_enable_disable_tracepoint; remote_ops.to_trace_init = remote_trace_init; remote_ops.to_download_tracepoint = remote_download_tracepoint; remote_ops.to_download_trace_state_variable = remote_download_trace_state_variable; + remote_ops.to_enable_tracepoint = remote_enable_tracepoint; + remote_ops.to_disable_tracepoint = remote_disable_tracepoint; remote_ops.to_trace_set_readonly_regions = remote_trace_set_readonly_regions; remote_ops.to_trace_start = remote_trace_start; remote_ops.to_get_trace_status = remote_get_trace_status; |