summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-21 21:51:11 -0600
committerTom Tromey <tom@tromey.com>2017-09-20 22:05:16 -0600
commitd1b0a7bfd3df05fd2009b62b19b7535bbc6555c0 (patch)
tree5e3f5adeb00c1fcc0bcde2994c29f925f98c1d25 /gdb/breakpoint.h
parent48649e1bfe2ef4cceff15a34e5a9e37201894ecd (diff)
Change counted_command_line to a shared_ptr
This changes counted_command_line to be a typedef for std::shared_ptr and removes the associated cleanups. In the long run I believe that cmd_list_element should also be changed to use a shared_ptr. gdb/ChangeLog 2017-09-20 Tom Tromey <tom@tromey.com> * breakpoint.c (struct counted_command_line): Remove. (breakpoint_commands): Update. (alloc_counted_command_line, incref_counted_command_line) (decref_counted_command_line, do_cleanup_counted_command_line) (make_cleanup_decref_counted_command_line): Remove. (breakpoint_set_commands, commands_command_1, ~bpstats, bpstats) (bpstat_clear_actions, bpstat_do_actions_1, watchpoint_check) (bpstat_stop_status, print_one_breakpoint_location, ~breakpoint) (save_breakpoints): Update. * breakpoint.h (counted_command_line): Now a typedef to shared_ptr. (struct breakpoint) <commands>: Now a counted_command_line. (struct bpstats) <command>: Likewise.
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r--gdb/breakpoint.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index cbbe0a928a..6afe4cc5b3 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -657,10 +657,9 @@ enum watchpoint_triggered
typedef struct bp_location *bp_location_p;
DEF_VEC_P(bp_location_p);
-/* A reference-counted struct command_line. This lets multiple
- breakpoints share a single command list. This is an implementation
+/* A reference-counted struct command_line. This is an implementation
detail to the breakpoints module. */
-struct counted_command_line;
+typedef std::shared_ptr<command_line> counted_command_line;
/* Some targets (e.g., embedded PowerPC) need two debug registers to set
a watchpoint over a memory region. If this flag is true, GDB will use
@@ -712,7 +711,7 @@ struct breakpoint
/* Chain of command lines to execute when this breakpoint is
hit. */
- counted_command_line *commands = NULL;
+ counted_command_line commands;
/* Stack depth (address of frame). If nonzero, break only if fp
equals this. */
struct frame_id frame_id = null_frame_id;
@@ -1118,7 +1117,7 @@ struct bpstats
struct breakpoint *breakpoint_at;
/* The associated command list. */
- struct counted_command_line *commands;
+ counted_command_line commands;
/* Old value associated with a watchpoint. */
struct value *old_val;