diff options
author | Tom Tromey <tom@tromey.com> | 2017-11-01 22:32:45 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-11-04 10:27:20 -0600 |
commit | 454dafbdf2d1293a9b18a6fe9e9c9e0911eb740c (patch) | |
tree | f33b5a538c368cfafb7784aa18e3cd6251aa74dd /gdb/breakpoint.h | |
parent | 331b71e5ee226cb5455969899274f0e43e83aa1e (diff) | |
download | gdb-454dafbdf2d1293a9b18a6fe9e9c9e0911eb740c.zip gdb-454dafbdf2d1293a9b18a6fe9e9c9e0911eb740c.tar.gz gdb-454dafbdf2d1293a9b18a6fe9e9c9e0911eb740c.tar.bz2 |
Introduce gdb_breakpoint_up
This introduces gdb_breakpoint_up, a unique_ptr typedef that owns a
breakpoint. It then changes set_momentary_breakpoint to return a
gdb_breakpoint_up and fixes up the fallout. This then allows the
removal of make_cleanup_delete_breakpoint.
Once breakpoints are fully C++-ified, this typedef can be removed in
favor of a plain std::unique_ptr.
gdb/ChangeLog
2017-11-04 Tom Tromey <tom@tromey.com>
* breakpoint.c (set_momentary_breakpoint): Return
breakpoint_up.
(until_break_command): Update.
(new_until_break_fsm): Change argument types to
breakpoint_up.
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(do_delete_breakpoint_cleanup, make_cleanup_delete_breakpoint):
Remove.
* infcmd.c (finish_forward): Update.
* breakpoint.h (set_momentary_breakpoint)
(set_momentary_breakpoint_at_pc): Return breakpoint_up.
(make_cleanup_delete_breakpoint): Remove.
(struct breakpoint_deleter): New.
(breakpoint_up): New typedef.
* infrun.c (insert_step_resume_breakpoint_at_sal_1): Update.
(insert_exception_resume_breakpoint): Update.
(insert_exception_resume_from_probe): Update.
(insert_longjmp_resume_breakpoint): Update.
* arm-linux-tdep.c (arm_linux_copy_svc): Update.
* elfread.c (elf_gnu_ifunc_resolver_stop): Update.
* infcall.c (call_function_by_hand_dummy): Update
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 69b63ea..aa06d11 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1223,10 +1223,22 @@ extern void breakpoint_re_set (void); extern void breakpoint_re_set_thread (struct breakpoint *); -extern struct breakpoint *set_momentary_breakpoint +extern void delete_breakpoint (struct breakpoint *); + +struct breakpoint_deleter +{ + void operator() (struct breakpoint *b) const + { + delete_breakpoint (b); + } +}; + +typedef std::unique_ptr<struct breakpoint, breakpoint_deleter> breakpoint_up; + +extern breakpoint_up set_momentary_breakpoint (struct gdbarch *, struct symtab_and_line, struct frame_id, enum bptype); -extern struct breakpoint *set_momentary_breakpoint_at_pc +extern breakpoint_up set_momentary_breakpoint_at_pc (struct gdbarch *, CORE_ADDR pc, enum bptype type); extern struct breakpoint *clone_momentary_breakpoint (struct breakpoint *bpkt); @@ -1235,10 +1247,6 @@ extern void set_ignore_count (int, int, int); extern void breakpoint_init_inferior (enum inf_context); -extern struct cleanup *make_cleanup_delete_breakpoint (struct breakpoint *); - -extern void delete_breakpoint (struct breakpoint *); - extern void breakpoint_auto_delete (bpstat); typedef void (*walk_bp_location_callback) (struct bp_location *, void *); |