Remove VEC(tsv_s), use std::vector instead

This patch removes VEC(tsv_s), using an std::vector instead.  I C++ified
trace_state_variable a bit in the process, using std::string for the
name.  I also thought it would be nicer to pass a const reference to
target_download_trace_state_variable, since we know it will never be
NULL.  This highlighted that the make-target-delegates script didn't
handle references well, so I adjusted this as well.  It will surely be
useful in the future.

gdb/ChangeLog:

	* tracepoint.h (struct trace_state_variable): Add constructor.
	<name>: Change type to std::string.
	* tracepoint.c (tsv_s): Remove.
	(DEF_VEC_O(tsv_s)): Remove.
	(tvariables): Change to std::vector.
	(create_trace_state_variable): Adjust to std::vector.
	(find_trace_state_variable): Likewise.
	(find_trace_state_variable_by_number): Likewise.
	(delete_trace_state_variable): Likewise.
	(trace_variable_command): Adjust to std::string.
	(delete_trace_variable_command): Likewise.
	(tvariables_info_1): Adjust to std::vector.
	(save_trace_state_variables): Likewise.
	(start_tracing): Likewise.
	(merge_uploaded_trace_state_variables): Adjust to std::vector
	and std::string.
	* target.h (struct target_ops)
	<to_download_trace_state_variable>: Pass reference to
	trace_state_variable.
	* target-debug.h (target_debug_print_const_trace_state_variable_r): New.
	* target-delegates.c: Re-generate.
	* mi/mi-interp.c (mi_tsv_created): Adjust to std::string.
	(mi_tsv_deleted): Likewise.
	* mi/mi-main.c (mi_cmd_trace_frame_collected): Likewise.
	* remote.c (remote_download_trace_state_variable): Change
	pointer to reference and adjust.
	* make-target-delegates (parse_argtypes): Handle references.
	(write_function_header): Likewise.
	(munge_type): Likewise.
This commit is contained in:
Simon Marchi
2018-04-09 15:16:19 -04:00
committed by Simon Marchi
parent c9638d2669
commit c252925ccc
10 changed files with 114 additions and 103 deletions

View File

@ -12448,18 +12448,18 @@ remote_can_download_tracepoint (struct target_ops *self)
static void
remote_download_trace_state_variable (struct target_ops *self,
struct trace_state_variable *tsv)
const trace_state_variable &tsv)
{
struct remote_state *rs = get_remote_state ();
char *p;
xsnprintf (rs->buf, get_remote_packet_size (), "QTDV:%x:%s:%x:",
tsv->number, phex ((ULONGEST) tsv->initial_value, 8),
tsv->builtin);
tsv.number, phex ((ULONGEST) tsv.initial_value, 8),
tsv.builtin);
p = rs->buf + strlen (rs->buf);
if ((p - rs->buf) + strlen (tsv->name) * 2 >= get_remote_packet_size ())
if ((p - rs->buf) + tsv.name.length () * 2 >= get_remote_packet_size ())
error (_("Trace state variable name too long for tsv definition packet"));
p += 2 * bin2hex ((gdb_byte *) (tsv->name), p, strlen (tsv->name));
p += 2 * bin2hex ((gdb_byte *) (tsv.name.data ()), p, tsv.name.length ());
*p++ = '\0';
putpkt (rs->buf);
remote_get_noisy_reply ();