static struct bp_location *allocate_bp_location (struct breakpoint *bpt);
-static void update_global_location_list (int);
+/* update_global_location_list's modes of operation wrt to whether to
+ insert locations now. */
+enum ugll_insert_mode
+{
+ /* Don't insert any breakpoint locations into the inferior, only
+ remove already-inserted locations that no longer should be
+ inserted. Functions that delete a breakpoint or breakpoints
+ should specify this mode, so that deleting a breakpoint doesn't
+ have the side effect of inserting the locations of other
+ breakpoints that are marked not-inserted, but should_be_inserted
+ returns true on them.
+
+ This behavior is useful is situations close to tear-down -- e.g.,
+ after an exec, while the target still has execution, but
+ breakpoint shadows of the previous executable image should *NOT*
+ be restored to the new image; or before detaching, where the
+ target still has execution and wants to delete breakpoints from
+ GDB's lists, and all breakpoints had already been removed from
+ the inferior. */
+ UGLL_DONT_INSERT,
+
+ /* May insert breakpoints if breakpoints_always_inserted_mode is
+ true. */
+ UGLL_MAY_INSERT
+};
+
+static void update_global_location_list (enum ugll_insert_mode);
-static void update_global_location_list_nothrow (int);
+static void update_global_location_list_nothrow (enum ugll_insert_mode);
static int is_hardware_watchpoint (const struct breakpoint *bpt);
}
/* Do the update. */
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
return;
set_breakpoint_condition (b, p, from_tty);
if (is_breakpoint (b))
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
return;
}
/* Now update the global location list to permanently delete the
removed locations above. */
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
}
/* Make sure all breakpoints are inserted in inferior.
update_watchpoint (w, 0 /* don't reparse. */);
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
/* update_global_location_list does not insert breakpoints when
always_inserted_mode is not enabled. Explicitly insert them
overlay_events_enabled = 0;
}
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
static void
}
}
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
do_cleanups (old_chain);
}
}
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
do_cleanups (old_chain);
}
b->enable_state = bp_disabled;
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
void
}
if (need_remove_insert)
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
else if (removed_any)
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
return bs_head;
}
if (b->type == bp_overlay_event)
{
b->enable_state = bp_enabled;
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
overlay_events_enabled = 1;
}
}
if (b->type == bp_overlay_event)
{
b->enable_state = bp_disabled;
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
overlay_events_enabled = 0;
}
}
b->addr_string
= xstrprintf ("*%s", paddress (b->loc->gdbarch, b->loc->address));
- update_global_location_list_nothrow (1);
+ update_global_location_list_nothrow (UGLL_MAY_INSERT);
return b;
}
b = create_internal_breakpoint (gdbarch, address, bp_jit_event,
&internal_breakpoint_ops);
- update_global_location_list_nothrow (1);
+ update_global_location_list_nothrow (UGLL_MAY_INSERT);
return b;
}
b = create_internal_breakpoint (gdbarch, address, bp_shlib_event,
&internal_breakpoint_ops);
- update_global_location_list_nothrow (1);
+ update_global_location_list_nothrow (UGLL_MAY_INSERT);
return b;
}
observer_notify_breakpoint_created (b);
if (update_gll)
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
static void
if (is_watchpoint (b) && breakpoint_enabled (b))
{
b->enable_state = bp_call_disabled;
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
}
}
}
if (is_watchpoint (b) && b->enable_state == bp_call_disabled)
{
b->enable_state = bp_enabled;
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
}
}
disable_breakpoints_before_startup (void)
{
current_program_space->executing_startup = 1;
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
}
void
if (in_thread_list (inferior_ptid))
b->thread = pid_to_thread_id (inferior_ptid);
- update_global_location_list_nothrow (1);
+ update_global_location_list_nothrow (UGLL_MAY_INSERT);
return b;
}
copy->disposition = disp_donttouch;
copy->number = internal_breakpoint_number--;
- update_global_location_list_nothrow (0);
+ update_global_location_list_nothrow (UGLL_DONT_INSERT);
return copy;
}
do_cleanups (old_chain);
/* error call may happen here - have BKPT_CHAIN already discarded. */
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
return 1;
}
mention (b);
observer_notify_breakpoint_created (b);
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
/* Return non-zero if EXP is verified as constant. Returned zero
}
}
}
+/* Called whether new breakpoints are created, or existing breakpoints
+ deleted, to update the global location list and recompute which
+ locations are duplicate of which.
-/* If SHOULD_INSERT is false, do not insert any breakpoint locations
- into the inferior, only remove already-inserted locations that no
- longer should be inserted. Functions that delete a breakpoint or
- breakpoints should pass false, so that deleting a breakpoint
- doesn't have the side effect of inserting the locations of other
- breakpoints that are marked not-inserted, but should_be_inserted
- returns true on them.
-
- This behaviour is useful is situations close to tear-down -- e.g.,
- after an exec, while the target still has execution, but breakpoint
- shadows of the previous executable image should *NOT* be restored
- to the new image; or before detaching, where the target still has
- execution and wants to delete breakpoints from GDB's lists, and all
- breakpoints had already been removed from the inferior. */
+ The INSERT_MODE flag determines whether locations may or may not be
+ inserted now. See 'enum ugll_insert_mode' for more info. */
static void
-update_global_location_list (int should_insert)
+update_global_location_list (enum ugll_insert_mode insert_mode)
{
struct breakpoint *b;
struct bp_location **locp, *loc;
&& (have_live_inferiors ()
|| (gdbarch_has_global_breakpoints (target_gdbarch ()))))
{
- if (should_insert)
+ if (insert_mode == UGLL_MAY_INSERT)
insert_breakpoint_locations ();
else
{
- /* Though should_insert is false, we may need to update conditions
- on the target's side if it is evaluating such conditions. We
+ /* Even though the caller told us to not insert new
+ locations, we may still need to update conditions on the
+ target's side of breakpoints that were already inserted
+ if the target is evaluating breakpoint conditions. We
only update conditions for locations that are marked
"needs_update". */
update_inserted_breakpoint_locations ();
}
}
- if (should_insert)
+ if (insert_mode == UGLL_MAY_INSERT)
download_tracepoint_locations ();
do_cleanups (cleanups);
}
static void
-update_global_location_list_nothrow (int inserting)
+update_global_location_list_nothrow (enum ugll_insert_mode insert_mode)
{
volatile struct gdb_exception e;
TRY_CATCH (e, RETURN_MASK_ERROR)
- update_global_location_list (inserting);
+ update_global_location_list (insert_mode);
}
/* Clear BKP from a BPS. */
itself, since remove_breakpoint looks at location's owner. It
might be better design to have location completely
self-contained, but it's not the case now. */
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
bpt->ops->dtor (bpt);
/* On the chance that someone will soon try again to delete this
/* Ranged breakpoints have only one start location and one end
location. */
b->enable_state = bp_disabled;
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
printf_unfiltered (_("Could not reset ranged breakpoint %d: "
"multiple locations found\n"),
b->number);
if (!locations_are_equal (existing_locations, b->loc))
observer_notify_breakpoint_modified (b);
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
/* Find the SaL locations corresponding to the given ADDR_STRING.
target_disable_tracepoint (location);
}
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
observer_notify_breakpoint_modified (bpt);
}
&& is_tracepoint (loc->owner))
target_disable_tracepoint (loc);
}
- update_global_location_list (0);
+ update_global_location_list (UGLL_DONT_INSERT);
}
else
map_breakpoint_numbers (num, do_map_disable_breakpoint, NULL);
bpt->disposition = disposition;
bpt->enable_count = count;
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
observer_notify_breakpoint_modified (bpt);
}
&& is_tracepoint (loc->owner))
target_enable_tracepoint (loc);
}
- update_global_location_list (1);
+ update_global_location_list (UGLL_MAY_INSERT);
}
else
map_breakpoint_numbers (num, do_map_enable_breakpoint, NULL);