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
This commit is contained in:
Tom Tromey 2017-11-01 22:32:45 -06:00
parent 331b71e5ee
commit 454dafbdf2
8 changed files with 63 additions and 41 deletions

View file

@ -7402,7 +7402,7 @@ insert_step_resume_breakpoint_at_sal_1 (struct gdbarch *gdbarch,
paddress (gdbarch, sr_sal.pc));
inferior_thread ()->control.step_resume_breakpoint
= set_momentary_breakpoint (gdbarch, sr_sal, sr_id, sr_type);
= set_momentary_breakpoint (gdbarch, sr_sal, sr_id, sr_type).release ();
}
void
@ -7491,7 +7491,7 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
paddress (gdbarch, pc));
inferior_thread ()->control.exception_resume_breakpoint =
set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume).release ();
}
/* Insert an exception resume breakpoint. TP is the thread throwing
@ -7526,7 +7526,8 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
(unsigned long) handler);
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
handler, bp_exception_resume);
handler,
bp_exception_resume).release ();
/* set_momentary_breakpoint_at_pc invalidates FRAME. */
frame = NULL;
@ -7567,7 +7568,7 @@ insert_exception_resume_from_probe (struct thread_info *tp,
handler));
bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame),
handler, bp_exception_resume);
handler, bp_exception_resume).release ();
bp->thread = tp->global_num;
inferior_thread ()->control.exception_resume_breakpoint = bp;
}