+2017-10-14 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * tracepoint.h (struct traceframe_info) <tvars>: Change type to
+ std::vector<int>.
+ * tracepoint.c (free_traceframe_info): Deallocate with delete.
+ (traceframe_info_start_tvar): Adjust to vector change.
+ (parse_traceframe_info): Allocate with new.
+ * ctf.c (ctf_traceframe_info): Allocate with new, adjust to
+ vector change.
+ * tracefile-tfile.c (build_traceframe_info): Adjust to vector
+ change.
+ tfile_traceframe_info): Allocate with new.
+ * mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to vector
+ change.
+
2017-10-14 Simon Marchi <simon.marchi@polymtl.ca>
* tracepoint.c (traceframe_info): Rename to...
static struct traceframe_info *
ctf_traceframe_info (struct target_ops *self)
{
- struct traceframe_info *info = XCNEW (struct traceframe_info);
+ traceframe_info *info = new traceframe_info;
const char *name;
struct bt_iter_pos *pos;
def = bt_ctf_get_field (event, scope, "num");
vnum = (int) bt_ctf_get_uint64 (def);
- VEC_safe_push (int, info->tvars, vnum);
+ info->tvars.push_back (vnum);
}
else
{
/* Trace state variables. */
{
- int tvar;
- int i;
-
ui_out_emit_list list_emitter (uiout, "tvars");
- for (i = 0; VEC_iterate (int, tinfo->tvars, i, tvar); i++)
+ for (int tvar : tinfo->tvars)
{
struct trace_state_variable *tsv;
int vnum;
tfile_read ((gdb_byte *) &vnum, 4);
- VEC_safe_push (int, info->tvars, vnum);
+ info->tvars.push_back (vnum);
}
case 'R':
case 'S':
static struct traceframe_info *
tfile_traceframe_info (struct target_ops *self)
{
- struct traceframe_info *info = XCNEW (struct traceframe_info);
+ traceframe_info *info = new traceframe_info;
traceframe_walk_blocks (build_traceframe_info, 0, info);
return info;
if (info != NULL)
{
VEC_free (mem_range_s, info->memory);
- VEC_free (int, info->tvars);
- xfree (info);
+ delete info;
}
}
= (const char *) xml_find_attribute (attributes, "id")->value;
int id = gdb_xml_parse_ulongest (parser, id_attrib);
- VEC_safe_push (int, info->tvars, id);
+ info->tvars.push_back (id);
}
/* Discard the constructed trace frame info (if an error occurs). */
struct traceframe_info *
parse_traceframe_info (const char *tframe_info)
{
- struct traceframe_info *result;
+ traceframe_info *result = new traceframe_info;
struct cleanup *back_to;
- result = XCNEW (struct traceframe_info);
back_to = make_cleanup (free_result, result);
if (gdb_xml_parse_quick (_("trace frame info"),
struct traceframe_info
{
/* Collected memory. */
- VEC(mem_range_s) *memory;
+ VEC(mem_range_s) *memory = NULL;
/* Collected trace state variables. */
- VEC(int) *tvars;
+ std::vector<int> tvars;
};
/* A trace state variable is a value managed by a target being