2014-11-12 Pedro Alves <palves@redhat.com>
+ Mark locations as permanent, not the whole breakpoint.
+ * breakpoint.c (remove_breakpoint_1, remove_breakpoint): Adjust.
+ (mark_breakpoints_out): Don't mark permanent breakpoints as
+ uninserted.
+ (breakpoint_init_inferior): Use mark_breakpoints_out.
+ (breakpoint_here_p): Adjust.
+ (bpstat_stop_status, describe_other_breakpoints): Remove handling
+ of permanent breakpoints.
+ (make_breakpoint_permanent): Mark each location as permanent,
+ instead of marking the breakpoint.
+ (add_location_to_breakpoint): If the location is permanent, mark
+ it as such, and as inserted.
+ (init_breakpoint_sal): Don't make the breakpoint permanent here.
+ (bp_location_compare, update_global_location_list): Adjust.
+ (update_breakpoint_locations): Don't make the breakpoint permanent
+ here.
+ (disable_breakpoint, enable_breakpoint_disp): Don't skip permanent
+ breakpoints.
+ * breakpoint.h (enum enable_state) <bp_permanent>: Delete field.
+ (struct bp_location) <permanent>: New field.
+ * guile/scm-breakpoint.c (bpscm_enable_state_to_string): Remove
+ reference to bp_permanent.
+
+2014-11-12 Pedro Alves <palves@redhat.com>
+
* arch-utils.c (default_skip_permanent_breakpoint): New function.
* arch-utils.h (default_skip_permanent_breakpoint): New
declaration.
/* BL is never in moribund_locations by our callers. */
gdb_assert (bl->owner != NULL);
- if (bl->owner->enable_state == bp_permanent)
+ if (bl->permanent)
/* Permanent breakpoints cannot be inserted or removed. */
return 0;
/* BL is never in moribund_locations by our callers. */
gdb_assert (bl->owner != NULL);
- if (bl->owner->enable_state == bp_permanent)
+ if (bl->permanent)
/* Permanent breakpoints cannot be inserted or removed. */
return 0;
struct bp_location *bl, **blp_tmp;
ALL_BP_LOCATIONS (bl, blp_tmp)
- if (bl->pspace == current_program_space)
+ if (bl->pspace == current_program_space
+ && !bl->permanent)
bl->inserted = 0;
}
if (gdbarch_has_global_breakpoints (target_gdbarch ()))
return;
- ALL_BP_LOCATIONS (bl, blp_tmp)
- {
- /* ALL_BP_LOCATIONS bp_location has BL->OWNER always non-NULL. */
- if (bl->pspace == pspace
- && bl->owner->enable_state != bp_permanent)
- bl->inserted = 0;
- }
+ mark_breakpoints_out ();
ALL_BREAKPOINTS_SAFE (b, b_tmp)
{
/* ALL_BP_LOCATIONS bp_location has BL->OWNER always non-NULL. */
if ((breakpoint_enabled (bl->owner)
- || bl->owner->enable_state == bp_permanent)
+ || bl->permanent)
&& breakpoint_location_address_match (bl, aspace, pc))
{
if (overlay_debugging
&& section_is_overlay (bl->section)
&& !section_is_mapped (bl->section))
continue; /* unmapped overlay -- can't be a match */
- else if (bl->owner->enable_state == bp_permanent)
+ else if (bl->permanent)
return permanent_breakpoint_here;
else
any_breakpoint_here = 1;
ALL_BREAKPOINTS (b)
{
- if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
+ if (!breakpoint_enabled (b))
continue;
for (bl = b->loc; bl != NULL; bl = bl->next)
if (b->disposition == disp_disable)
{
--(b->enable_count);
- if (b->enable_count <= 0
- && b->enable_state != bp_permanent)
+ if (b->enable_count <= 0)
b->enable_state = bp_disabled;
removed_any = 1;
}
((b->enable_state == bp_disabled
|| b->enable_state == bp_call_disabled)
? " (disabled)"
- : b->enable_state == bp_permanent
- ? " (permanent)"
: ""),
(others > 1) ? ","
: ((others == 1) ? " and" : ""));
{
struct bp_location *bl;
- b->enable_state = bp_permanent;
-
/* By definition, permanent breakpoints are already present in the
code. Mark all locations as inserted. For now,
make_breakpoint_permanent is called in just one place, so it's
hard to say if it's reasonable to have permanent breakpoint with
multiple locations or not, but it's easy to implement. */
for (bl = b->loc; bl; bl = bl->next)
- bl->inserted = 1;
+ {
+ bl->permanent = 1;
+ bl->inserted = 1;
+ }
}
/* Call this routine when stepping and nexting to enable a breakpoint
}
\f
+static int bp_loc_is_permanent (struct bp_location *loc);
+
static struct bp_location *
add_location_to_breakpoint (struct breakpoint *b,
const struct symtab_and_line *sal)
set_breakpoint_location_function (loc,
sal->explicit_pc || sal->explicit_line);
+
+ if (bp_loc_is_permanent (loc))
+ {
+ loc->inserted = 1;
+ loc->permanent = 1;
+ }
+
return loc;
}
\f
loc->inserted = 1;
}
- if (bp_loc_is_permanent (loc))
- make_breakpoint_permanent (b);
-
if (b->cond_string)
{
const char *arg = b->cond_string;
/* A comparison function for bp_location AP and BP being interfaced to
qsort. Sort elements primarily by their ADDRESS (no matter what
does breakpoint_address_is_meaningful say for its OWNER),
- secondarily by ordering first bp_permanent OWNERed elements and
+ secondarily by ordering first permanent elements and
terciarily just ensuring the array is sorted stable way despite
qsort being an unstable algorithm. */
{
struct bp_location *a = *(void **) ap;
struct bp_location *b = *(void **) bp;
- /* A and B come from existing breakpoints having non-NULL OWNER. */
- int a_perm = a->owner->enable_state == bp_permanent;
- int b_perm = b->owner->enable_state == bp_permanent;
if (a->address != b->address)
return (a->address > b->address) - (a->address < b->address);
- (a->pspace->num < b->pspace->num));
/* Sort permanent breakpoints first. */
- if (a_perm != b_perm)
- return (a_perm < b_perm) - (a_perm > b_perm);
+ if (a->permanent != b->permanent)
+ return (a->permanent < b->permanent) - (a->permanent > b->permanent);
/* Make the internal GDB representation stable across GDB runs
where A and B memory inside GDB can differ. Breakpoint locations of
}
/* Permanent breakpoint should always be inserted. */
- if (b->enable_state == bp_permanent && ! loc->inserted)
+ if (loc->permanent && ! loc->inserted)
internal_error (__FILE__, __LINE__,
_("allegedly permanent breakpoint is not "
"actually inserted"));
/* Clear the condition modification flag. */
loc->condition_changed = condition_unchanged;
- if ((*loc_first_p)->owner->enable_state == bp_permanent && loc->inserted
- && b->enable_state != bp_permanent)
+ if (loc->inserted && !loc->permanent
+ && (*loc_first_p)->permanent)
internal_error (__FILE__, __LINE__,
_("another breakpoint was inserted on top of "
"a permanent breakpoint"));
}
}
- /* Update locations of permanent breakpoints. */
- if (b->enable_state == bp_permanent)
- make_breakpoint_permanent (b);
-
/* If possible, carry over 'disable' status from existing
breakpoints. */
{
if (bpt->type == bp_watchpoint_scope)
return;
- /* You can't disable permanent breakpoints. */
- if (bpt->enable_state == bp_permanent)
- return;
-
bpt->enable_state = bp_disabled;
/* Mark breakpoint locations modified. */
}
}
- if (bpt->enable_state != bp_permanent)
- bpt->enable_state = bp_enabled;
-
bpt->enable_state = bp_enabled;
/* Mark breakpoint locations modified. */