2011-11-02 Stan Shebs <stan@codesourcery.com>

String collection for tracepoints.
	* NEWS: Mention string collection.
	* common/ax.def (tracenz): New bytecode.
	* ax-gdb.h (trace_string_kludge): Declare.
	* ax-gdb.c: Include valprint.h and c-lang.h.
	(trace_string_kludge): New global.
	(gen_traced_pop): Add string case.
	(agent_command): Add string case.
	* tracepoint.h (decode_agent_options): Declare.
	* tracepoint.c: Include cli-utils.h.
	(decode_agent_options): New function.
	(validate_actionline): Call it.
	(encode_actions_1): Ditto.
	* target.h (struct target_ops): New method to_supports_string_tracing.
	(target_supports_string_tracing): New macro.
	* target.c (update_current_target): Add to_supports_string_tracing.
	* remote.c (struct remote_state): New field string_tracing.
	(remote_string_tracing_feature): New function.
	(remote_protocol_features): New feature tracenz.
	(remote_supports_string_tracing): New function.
	(init_remote_ops): Set to_supports_string_tracing.

	* tracepoint.c (agent_mem_read_string): New function.
	(eval_agent_expr): Call it for tracenz.
	* server.c (handle_query): Report support for tracenz.

	* gdb.texinfo (Tracepoint Action Lists): Document collect/s.
	(General Query Packets): Describe tracenz feature.
	* agentexpr.texi (Bytecode Descriptions): Describe tracenz.

	* gdb.trace/collection.c: Add code using strings.
	* gdb.trace/collection.exp: Add tests of string collection.
This commit is contained in:
Stan Shebs
2011-11-02 23:44:21 +00:00
parent 39f4f51d8b
commit 3065dfb6b4
19 changed files with 349 additions and 6 deletions

View File

@@ -331,6 +331,9 @@ struct remote_state
tracepoints while a trace experiment is running. */
int enable_disable_tracepoints;
/* True if the stub can collect strings using tracenz bytecode. */
int string_tracing;
/* Nonzero if the user has pressed Ctrl-C, but the target hasn't
responded to that. */
int ctrlc_pending_p;
@@ -3712,6 +3715,16 @@ remote_enable_disable_tracepoint_feature (const struct protocol_feature *feature
rs->enable_disable_tracepoints = (support == PACKET_ENABLE);
}
static void
remote_string_tracing_feature (const struct protocol_feature *feature,
enum packet_support support,
const char *value)
{
struct remote_state *rs = get_remote_state ();
rs->string_tracing = (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,
@@ -3764,6 +3777,8 @@ static struct protocol_feature remote_protocol_features[] = {
PACKET_qXfer_fdpic },
{ "QDisableRandomization", PACKET_DISABLE, remote_supported_packet,
PACKET_QDisableRandomization },
{ "tracenz", PACKET_DISABLE,
remote_string_tracing_feature, -1 },
};
static char *remote_support_xml;
@@ -9740,6 +9755,14 @@ remote_supports_enable_disable_tracepoint (void)
return rs->enable_disable_tracepoints;
}
static int
remote_supports_string_tracing (void)
{
struct remote_state *rs = get_remote_state ();
return rs->string_tracing;
}
static void
remote_trace_init (void)
{
@@ -10459,6 +10482,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_supports_disable_randomization
= remote_supports_disable_randomization;
remote_ops.to_supports_enable_disable_tracepoint = remote_supports_enable_disable_tracepoint;
remote_ops.to_supports_string_tracing = remote_supports_string_tracing;
remote_ops.to_trace_init = remote_trace_init;
remote_ops.to_download_tracepoint = remote_download_tracepoint;
remote_ops.to_download_trace_state_variable