aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2018-03-30 17:18:54 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2018-03-30 17:18:54 -0400
commita18ba4e4c9d64eeb2ea65e5315fbd8b4261a1756 (patch)
tree0305bf8d7650858d6095d28a0dd9c2d55e186562 /gdb/breakpoint.c
parenta7961323e2fce4f831e117cc43e20e5144192240 (diff)
downloadgdb-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/breakpoint.c')
-rw-r--r--gdb/breakpoint.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9de0e63..991c29c 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -14738,11 +14738,13 @@ static int next_cmd;
static char *
read_uploaded_action (void)
{
- char *rslt;
+ char *rslt = nullptr;
- VEC_iterate (char_ptr, this_utp->cmd_strings, next_cmd, rslt);
-
- next_cmd++;
+ if (next_cmd < this_utp->cmd_strings.size ())
+ {
+ rslt = this_utp->cmd_strings[next_cmd];
+ next_cmd++;
+ }
return rslt;
}
@@ -14814,7 +14816,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
special-purpose "reader" function and call the usual command line
reader, then pass the result to the breakpoint command-setting
function. */
- if (!VEC_empty (char_ptr, utp->cmd_strings))
+ if (!utp->cmd_strings.empty ())
{
command_line_up cmd_list;
@@ -14825,8 +14827,8 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
breakpoint_set_commands (tp, std::move (cmd_list));
}
- else if (!VEC_empty (char_ptr, utp->actions)
- || !VEC_empty (char_ptr, utp->step_actions))
+ else if (!utp->actions.empty ()
+ || !utp->step_actions.empty ())
warning (_("Uploaded tracepoint %d actions "
"have no source form, ignoring them"),
utp->number);