Make bp_location derive from refcounted_object

This changes bp_location to derive from refcounted_object, introduces
a ref_ptr specialization for this type, and then changes
bpstats::bp_location_at to use that specialization.  This removes some
manual reference counting and simplifies the code.

gdb/ChangeLog
2020-12-11  Tom Tromey  <tom@tromey.com>

	* inline-frame.c (stopped_by_user_bp_inline_frame): Update.
	* ada-lang.c (check_status_exception): Update.
	* breakpoint.c (free_bp_location): Remove.
	(decref_bp_location): Use bp_location_ref_policy.
	(bpstats::bpstats): Don't call incref_bp_location.
	(bpstats::~bpstats): Remove.
	(bpstats::bpstats): Update.
	(bpstat_check_watchpoint, bpstat_check_breakpoint_conditions)
	(bp_location::bp_location): Update.
	(incref_bp_location): Remove.
	(bkpt_print_it): Update.
	* breakpoint.h (class bp_location): Derive from
	refcounted_object.
	(struct bpstats): Remove destructor.
	<bp_location_at>: Now a bp_location_ref_ptr.
	<refc>: Remove.
	(bp_location_ref_ptr): New typedef.
	(struct bp_location_ref_policy): New.
This commit is contained in:
Tom Tromey
2020-12-11 09:21:53 -07:00
parent bfcb9db853
commit b6433ede07
5 changed files with 53 additions and 45 deletions

View File

@ -12255,7 +12255,7 @@ should_stop_exception (const struct bp_location *bl)
static void
check_status_exception (bpstat bs)
{
bs->stop = should_stop_exception (bs->bp_location_at);
bs->stop = should_stop_exception (bs->bp_location_at.get ());
}
/* Implement the PRINT_IT method in the breakpoint_ops structure