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.
This commit is contained in:
Tom Tromey
2017-08-19 22:26:20 -06:00
parent 36bd8eaaa0
commit b270e6f9e0
7 changed files with 69 additions and 66 deletions

View File

@@ -387,8 +387,7 @@ handle_gnu_v3_exceptions (int tempflag, std::string &&except_rx,
re_set_exception_catchpoint (cp.get ());
install_breakpoint (0, cp.get (), 1);
cp.release ();
install_breakpoint (0, std::move (cp), 1);
}
/* Look for an "if" token in *STRING. The "if" token must be preceded