From f51e0e20bd303a9b366084ac719db10978402713 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 5 Jun 2018 10:22:01 -0600 Subject: Remove VEC from breakpoint This removes a use of VEC from breakpoint.h, also removing the now-unnecessary breakpoint_p typedef. This patch fixes a latent memory leak in find_matching_tracepoint_location, which neglected to free the vector returned by all_tracepoints. Tested by the buildbot. gdb/ChangeLog 2018-07-03 Tom Tromey * tracepoint.c (process_tracepoint_on_disconnect, start_tracing) (stop_tracing, tstatus_command) (find_matching_tracepoint_location, merge_uploaded_tracepoints) (print_one_static_tracepoint_marker): Update. * breakpoint.c (static_tracepoints_here, all_tracepoints): Return std::vector. * breakpoint.h (breakpoint_p): Remove typedef. Don't declare VEC. (all_tracepoints, static_tracepoints_here): Return std::vector. --- gdb/breakpoint.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 3f75aa47d33..7da9452fd15 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -904,8 +904,6 @@ struct tracepoint : public breakpoint int static_trace_marker_id_idx; }; -typedef struct breakpoint *breakpoint_p; -DEF_VEC_P(breakpoint_p); /* The following stuff is an abstract data type "bpstat" ("breakpoint status"). This provides the ability to determine whether we have @@ -1626,16 +1624,13 @@ extern struct tracepoint * get_tracepoint_by_number (const char **arg, number_or_range_parser *parser); -/* Return a vector of all tracepoints currently defined. The vector - is newly allocated; the caller should free when done with it. */ -extern VEC(breakpoint_p) *all_tracepoints (void); +/* Return a vector of all tracepoints currently defined. */ +extern std::vector all_tracepoints (void); extern int is_tracepoint (const struct breakpoint *b); -/* Return a vector of all static tracepoints defined at ADDR. The - vector is newly allocated; the caller should free when done with - it. */ -extern VEC(breakpoint_p) *static_tracepoints_here (CORE_ADDR addr); +/* Return a vector of all static tracepoints defined at ADDR. */ +extern std::vector static_tracepoints_here (CORE_ADDR addr); /* Create an instance of this to start registering breakpoint numbers for a later "commands" command. */ -- cgit v1.2.1