This is the mail archive of the
gdb@sourceware.cygnus.com
mailing list for the GDB project.
Confusing breakpoint deletion code
- To: gdb@sourceware.cygnus.com
- Subject: Confusing breakpoint deletion code
- From: Eli Zaretskii <eliz@gnu.org>
- Date: Sun, 8 Aug 1999 08:21:42 -0400
- CC: DJ Delorie <dj@delorie.com>, Pierre Muller <muller@cerbere.u-strasbg.fr>
The fragment below is taken from delete_breakpoint.
There's something about this that I don't get. First, this assumes
that if a breakpoint is not of one of the types enumerated in the if
clause, it must be a normal breakpoint. What about hardware
breakpoints? They should be inserted with target_insert_hw_breakpoint,
not with target_insert_breakpoint, right?
Also, watchpoints can have duplicates as well, can't they? If so,
shouldn't this code look for another watchpoint that points to the
same address and insert it?
Finally, unless I'm missing something, this code seems to never run,
because several lines before it we have this snippet:
if (bpt->inserted)
remove_breakpoint (bpt, mark_uninserted);
which resets the bpt->inserted member.
Can someone please redeem me from my confusion, so I could actually
submit a patch, if needed? Thanks.
Here's the fragment I was talking about:
check_duplicates (bpt->address, bpt->section);
/* If this breakpoint was inserted, and there is another breakpoint
at the same address, we need to insert the other breakpoint. */
if (bpt->inserted
&& bpt->type != bp_hardware_watchpoint
&& bpt->type != bp_read_watchpoint
&& bpt->type != bp_access_watchpoint
&& bpt->type != bp_catch_fork
&& bpt->type != bp_catch_vfork
&& bpt->type != bp_catch_exec)
{
ALL_BREAKPOINTS (b)
if (b->address == bpt->address
&& b->section == bpt->section
&& !b->duplicate
&& b->enable != disabled
&& b->enable != shlib_disabled
&& b->enable != call_disabled)
{
int val;
val = target_insert_breakpoint (b->address, b->shadow_contents);
if (val != 0)
{
target_terminal_ours_for_output ();
fprintf_unfiltered (gdb_stderr, "Cannot insert breakpoint %d:\n", b->number);
memory_error (val, b->address); /* which bombs us out */
}
else
b->inserted = 1;
}
}