This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
handle hardware breakpoints in overlays
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: handle hardware breakpoints in overlays
- From: jtc at redback dot com (J.T. Conklin)
- Date: 05 Oct 1999 15:22:44 -0700
- Reply-To: jtc at redback dot com
The enclosed patch fixes an anomoly that I uncovered a month or so
ago, but only now got around to submitting my patch. It changes
insert_breakpoints() and remove_breakpoints() to handle hardware
breakpoints in overlay regions by checking b->type just before
inserting (or removing) the breakpoint and calling the appropriate
routines.
However, I did not change the code that inserts/removes the break-
point at the LMA address, since no hardware breakpoint was reserved
for that. In fact, it is unclear to me why such a breakpoint is ever
inserted, since the execution should never reach the LMA address.
--jtc
1999-10-05 J.T. Conklin <jtc@redback.com>
* breakpoint.c (insert_breakpoints, remove_breakpoint): Handle
hardware breakpoints in overlay sections.
Index: breakpoint.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/breakpoint.c,v
retrieving revision 1.8
diff -c -r1.8 breakpoint.c
*** breakpoint.c 1999/10/05 21:25:50 1.8
--- breakpoint.c 1999/10/05 21:26:06
***************
*** 689,721 ****
&& !b->inserted
&& !b->duplicate)
{
! if (b->type == bp_hardware_breakpoint)
! val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
! else
! {
! /* Check to see if breakpoint is in an overlay section;
! if so, we should set the breakpoint at the LMA address.
! Only if the section is currently mapped should we ALSO
! set a break at the VMA address. */
! if (overlay_debugging && b->section &&
! section_is_overlay (b->section))
! {
! CORE_ADDR addr;
!
! addr = overlay_unmapped_address (b->address, b->section);
! val = target_insert_breakpoint (addr, b->shadow_contents);
! /* This would be the time to check val, to see if the
! breakpoint write to the load address succeeded.
! However, this might be an ordinary occurrance, eg. if
! the unmapped overlay is in ROM. */
! val = 0; /* in case unmapped address failed */
! if (section_is_mapped (b->section))
val = target_insert_breakpoint (b->address,
b->shadow_contents);
}
! else /* ordinary (non-overlay) address */
val = target_insert_breakpoint (b->address, b->shadow_contents);
}
if (val)
{
/* Can't set the breakpoint. */
--- 689,729 ----
&& !b->inserted
&& !b->duplicate)
{
! /* Check to see if breakpoint is in an overlay section;
! if so, we should set the breakpoint at the LMA address.
! Only if the section is currently mapped should we ALSO
! set a break at the VMA address. */
! if (overlay_debugging && b->section &&
! section_is_overlay (b->section))
! {
! CORE_ADDR addr;
!
! addr = overlay_unmapped_address (b->address, b->section);
! val = target_insert_breakpoint (addr, b->shadow_contents);
! /* This would be the time to check val, to see if the
! breakpoint write to the load address succeeded.
! However, this might be an ordinary occurrance, eg. if
! the unmapped overlay is in ROM. */
! val = 0; /* in case unmapped address failed */
! if (section_is_mapped (b->section))
! {
! if (b->type == bp_hardware_breakpoint)
! val = target_insert_hw_breakpoint (b->address,
! b->shadow_contents);
! else
val = target_insert_breakpoint (b->address,
b->shadow_contents);
}
! }
! else
! { /* ordinary (non-overlay) address */
! if (b->type == bp_hardware_breakpoint)
! val = target_insert_hw_breakpoint (b->address,
! b->shadow_contents);
! else
val = target_insert_breakpoint (b->address, b->shadow_contents);
}
+
if (val)
{
/* Can't set the breakpoint. */
***************
*** 1152,1184 ****
&& b->type != bp_catch_catch
&& b->type != bp_catch_throw)
{
! if (b->type == bp_hardware_breakpoint)
! val = target_remove_hw_breakpoint (b->address, b->shadow_contents);
! else
{
! /* Check to see if breakpoint is in an overlay section;
! if so, we should remove the breakpoint at the LMA address.
! If that is not equal to the raw address, then we should
! presumable remove the breakpoint there as well. */
! if (overlay_debugging && b->section &&
! section_is_overlay (b->section))
! {
! CORE_ADDR addr;
!
! addr = overlay_unmapped_address (b->address, b->section);
! val = target_remove_breakpoint (addr, b->shadow_contents);
! /* This would be the time to check val, to see if the
! shadow breakpoint write to the load address succeeded.
! However, this might be an ordinary occurrance, eg. if
! the unmapped overlay is in ROM. */
! val = 0; /* in case unmapped address failed */
! if (section_is_mapped (b->section))
val = target_remove_breakpoint (b->address,
b->shadow_contents);
}
! else /* ordinary (non-overlay) address */
val = target_remove_breakpoint (b->address, b->shadow_contents);
}
if (val)
return val;
b->inserted = (is == mark_inserted);
--- 1160,1199 ----
&& b->type != bp_catch_catch
&& b->type != bp_catch_throw)
{
! /* Check to see if breakpoint is in an overlay section;
! if so, we should remove the breakpoint at the LMA address.
! If that is not equal to the raw address, then we should
! presumable remove the breakpoint there as well. */
! if (overlay_debugging && b->section &&
! section_is_overlay (b->section))
{
! CORE_ADDR addr;
!
! addr = overlay_unmapped_address (b->address, b->section);
! val = target_remove_breakpoint (addr, b->shadow_contents);
! /* This would be the time to check val, to see if the
! shadow breakpoint write to the load address succeeded.
! However, this might be an ordinary occurrance, eg. if
! the unmapped overlay is in ROM. */
! val = 0; /* in case unmapped address failed */
! if (section_is_mapped (b->section))
! {
! if (b->type == bp_hardware_breakpoint)
! val = target_remove_hw_breakpoint (b->address,
! b->shadow_contents);
! else
val = target_remove_breakpoint (b->address,
b->shadow_contents);
}
! }
! else
! { /* ordinary (non-overlay) address */
! if (b->type == bp_hardware_breakpoint)
! val = target_remove_hw_breakpoint (b->address, b->shadow_contents);
! else
val = target_remove_breakpoint (b->address, b->shadow_contents);
}
+
if (val)
return val;
b->inserted = (is == mark_inserted);
--
J.T. Conklin
RedBack Networks