+2003-11-06 Daniel Jacobowitz <drow@mvista.com>
+
+ * breakpoint.h (struct bp_location): Add a chain pointer.
+ * breakpoint.c (ALL_BP_LOCATIONS, ALL_BP_LOCATIONS_SAFE): New
+ macros.
+ (bp_location_chain): New variable.
+ (allocate_bp_location): New function.
+ (set_raw_breakpoint): Use it.
+ (delete_breakpoint): Remove ->loc from the bp_location_chain.
+
2003-11-06 Daniel Jacobowitz <drow@mvista.com>
* breakpoint.h (enum bp_loc_type, struct bp_location): New.
B ? (TMP=B->next, 1): 0; \
B = TMP)
+/* Similar iterators for the low-level breakpoints. */
+
+#define ALL_BP_LOCATIONS(B) for (B = bp_location_chain; B; B = B->next)
+
+#define ALL_BP_LOCATIONS_SAFE(B,TMP) \
+ for (B = bp_location_chain; \
+ B ? (TMP=B->next, 1): 0; \
+ B = TMP)
+
/* True if SHIFT_INST_REGS defined, false otherwise. */
int must_shift_inst_regs =
int show_breakpoint_hit_counts = 1;
-/* Chain of all breakpoints defined. */
+/* Chains of all breakpoints defined. */
struct breakpoint *breakpoint_chain;
+struct bp_location *bp_location_chain;
+
/* Number of last breakpoint made. */
int breakpoint_count;
}
}
+/* Allocate a struct bp_location. */
+
+struct bp_location *
+allocate_bp_location (void)
+{
+ struct bp_location *loc, *loc_p;
+
+ loc = xmalloc (sizeof (struct bp_location));
+ memset (loc, 0, sizeof (*loc));
+
+ /* Add this breakpoint to the end of the chain. */
+
+ loc_p = bp_location_chain;
+ if (loc_p == 0)
+ bp_location_chain = loc;
+ else
+ {
+ while (loc_p->next)
+ loc_p = loc_p->next;
+ loc_p->next = loc;
+ }
+
+ return loc;
+}
+
/* set_raw_breakpoint() is a low level routine for allocating and
partially initializing a breakpoint of type BPTYPE. The newly
created breakpoint's address, section, source file name, and line
b = (struct breakpoint *) xmalloc (sizeof (struct breakpoint));
memset (b, 0, sizeof (*b));
- b->loc = (struct bp_location *) xmalloc (sizeof (struct bp_location));
- memset (b->loc, 0, sizeof (*b->loc));
+ b->loc = allocate_bp_location ();
b->loc->requested_address = sal.pc;
b->loc->address = adjust_breakpoint_address (b->loc->requested_address);
if (sal.symtab == NULL)
{
struct breakpoint *b;
bpstat bs;
+ struct bp_location *loc;
if (bpt == NULL)
error ("Internal error (attempted to delete a NULL breakpoint)");
if (breakpoint_chain == bpt)
breakpoint_chain = bpt->next;
+ if (bp_location_chain == bpt->loc)
+ bp_location_chain = bpt->loc->next;
+
/* If we have callback-style exception catchpoints, don't go through
the adjustments to the C++ runtime library etc. if the inferior
isn't actually running. target_enable_exception_callback for a
break;
}
+ ALL_BP_LOCATIONS (loc)
+ if (loc->next == bpt->loc)
+ {
+ loc->next = bpt->loc->next;
+ break;
+ }
+
check_duplicates (bpt);
/* If this breakpoint was inserted, and there is another breakpoint
at the same address, we need to insert the other breakpoint. */