diff options
author | Tom Tromey <tom@tromey.com> | 2017-08-19 22:26:20 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-08-22 09:38:07 -0600 |
commit | b270e6f9e09814c82e198859f218b37118eaf098 (patch) | |
tree | 1f123a9b425950be050f19ce29eedd9916832d58 /gdb/ada-lang.c | |
parent | 36bd8eaaa0afe3ff8e8b1b1b9edc9686f5c159e6 (diff) | |
download | gdb-b270e6f9e09814c82e198859f218b37118eaf098.zip gdb-b270e6f9e09814c82e198859f218b37118eaf098.tar.gz gdb-b270e6f9e09814c82e198859f218b37118eaf098.tar.bz2 |
Change install_breakpoint to take a std::unique_ptr
This changes install_breakpoint to take a std::unique_ptr rvalue-ref
argument. This makes it clear that install_breakpoint takes ownership
of the pointer, and prevents bugs like the one fixed by the previous
patch.
ChangeLog
2017-08-22 Tom Tromey <tom@tromey.com>
* breakpoint.h (install_breakpoint): Update.
* breakpoint.c (add_solib_catchpoint): Update.
(install_breakpoint): Change argument to a std::unique_ptr.
(create_fork_vfork_event_catchpoint): Use std::unique_ptr.
(create_breakpoint_sal, create_breakpoint): Update.
(watch_command_1, catch_exec_command_1)
(strace_marker_create_breakpoints_sal): Use std::unique_ptr.
(add_to_breakpoint_chain): Change argument to a std::unique_ptr.
Return the breakpoint.
(set_raw_breakpoint_without_location, set_raw_breakpoint)
(new_single_step_breakpoint): Update.
* break-catch-throw.c (handle_gnu_v3_exceptions): Use
std::unique_ptr.
* break-catch-syscall.c (create_syscall_event_catchpoint): Use
std::unique_ptr.
* break-catch-sig.c (create_signal_catchpoint): Use
std::unique_ptr.
* ada-lang.c (create_ada_exception_catchpoint): Use
std::unique_ptr.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 280247b..476f700 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13010,20 +13010,19 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch, int disabled, int from_tty) { - struct ada_catchpoint *c; char *addr_string = NULL; const struct breakpoint_ops *ops = NULL; struct symtab_and_line sal = ada_exception_sal (ex_kind, excep_string, &addr_string, &ops); - c = new ada_catchpoint (); - init_ada_exception_breakpoint (c, gdbarch, sal, addr_string, + std::unique_ptr<ada_catchpoint> c (new ada_catchpoint ()); + init_ada_exception_breakpoint (c.get (), gdbarch, sal, addr_string, ops, tempflag, disabled, from_tty); c->excep_string = excep_string; - create_excep_cond_exprs (c); + create_excep_cond_exprs (c.get ()); if (cond_string != NULL) - set_breakpoint_condition (c, cond_string, from_tty); - install_breakpoint (0, c, 1); + set_breakpoint_condition (c.get (), cond_string, from_tty); + install_breakpoint (0, std::move (c), 1); } /* Implement the "catch exception" command. */ |