diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-03-30 17:18:54 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-03-30 17:18:54 -0400 |
commit | a18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756 (patch) | |
tree | 0305bf8d7650858d6095d28a0dd9c2d55e186562 /gdb/tracefile-tfile.c | |
parent | a7961323e2fce4f831e117cc43e20e5144192240 (diff) | |
download | gdb-a18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756.zip gdb-a18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756.tar.gz gdb-a18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756.tar.bz2 |
Use std::vector in uploaded_tp
This patch changes the VEC(char_ptr) fields in uploaded_tp to use
std::vector<char *>. At first, I wanted to creep in more changes, like
using std::string, but it was making the patch too big and less focused,
so I decided to keep it to just that.
It also looks like the strings in those vectors are never free'd. If
so, we can fix that in another patch.
gdb/ChangeLog:
* tracepoint.h (struct uploaded_tp): Initialize fields.
<actions, step_actions, cmd_strings>: Change type to
std::vector<char *>.
* tracepoint.c (get_uploaded_tp): Allocate with new.
(free_uploaded_tps): Free with delete.
(parse_tracepoint_definition): Adjust to std::vector change.
* breakpoint.c (read_uploaded_action): Likewise.
(create_tracepoint_from_upload): Likewise.
* ctf.c (ctf_write_uploaded_tp): Likewise.
(SET_ARRAY_FIELD): Likewise.
* tracefile-tfile.c (tfile_write_uploaded_tp): Likewise.
Diffstat (limited to 'gdb/tracefile-tfile.c')
-rw-r--r-- | gdb/tracefile-tfile.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 4f0dc59..d7e9347 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -221,8 +221,6 @@ tfile_write_uploaded_tp (struct trace_file_writer *self, { struct tfile_trace_file_writer *writer = (struct tfile_trace_file_writer *) self; - int a; - char *act; char buf[MAX_TRACE_UPLOAD]; fprintf (writer->fp, "tp T%x:%s:%c:%x:%x", @@ -235,10 +233,10 @@ tfile_write_uploaded_tp (struct trace_file_writer *self, ":X%x,%s", (unsigned int) strlen (utp->cond) / 2, utp->cond); fprintf (writer->fp, "\n"); - for (a = 0; VEC_iterate (char_ptr, utp->actions, a, act); ++a) + for (char *act : utp->actions) fprintf (writer->fp, "tp A%x:%s:%s\n", utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act); - for (a = 0; VEC_iterate (char_ptr, utp->step_actions, a, act); ++a) + for (char *act : utp->step_actions) fprintf (writer->fp, "tp S%x:%s:%s\n", utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act); if (utp->at_string) @@ -254,7 +252,7 @@ tfile_write_uploaded_tp (struct trace_file_writer *self, buf, MAX_TRACE_UPLOAD); fprintf (writer->fp, "tp Z%s\n", buf); } - for (a = 0; VEC_iterate (char_ptr, utp->cmd_strings, a, act); ++a) + for (char *act : utp->cmd_strings) { encode_source_string (utp->number, utp->addr, "cmd", act, buf, MAX_TRACE_UPLOAD); |