Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix for DECR_PC_AFTER_BREAK != DECR_PC_AFTER_HW_BREAK
@ 1998-12-15 15:09 J.T. Conklin
  0 siblings, 0 replies; 3+ messages in thread
From: J.T. Conklin @ 1998-12-15 15:09 UTC (permalink / raw)
  To: gdb-patches

After hitting a hardware breakpoint on a X86 target, GDB resumes
control but is unable to identify what breakpoint was hit.  Thus
breakpoint counters are not updated and associated command scripts
are not executed.

bpstat_stop_status() correctly compares addresses of non-hardware
breakpoints with ($PC - DECR_PC_AFTER_BREAK); but it compares the
address of hardware breakpoints with ($PC - DECR_PC_AFTER_BREAK -
DECR_PC_AFTER_HW_BREAK).  The latter expression is only correct 
when both values are 0.  

After that was fixed, GDB erroneously tried to decrement the PC on
hardware breakpoints even though DECR_PC_AFTER_HW_BREAK == 0.  The
enclosed change makes the distinction between hard and soft breaks
and decrements the PC by the appropriate amount if required.

	--jtc


1998-12-15  J.T. Conklin  <jtc@redbacknetworks.com>

	* breakpoint.c (bpstat_stop_status): Handle systems where
	DECR_PC_AFTER_BREAK != DECR_PC_AFTER_HW_BREAK.

Index: breakpoint.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/breakpoint.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 breakpoint.c
*** breakpoint.c	1998/12/03 00:05:07	1.1.1.1
--- breakpoint.c	1998/12/15 22:40:15
***************
*** 1369,1375 ****
  	  continue;
  
        if (b->type == bp_hardware_breakpoint
! 	  && b->address != (bp_addr - DECR_PC_AFTER_HW_BREAK))
  	continue;
  
        if (b->type != bp_watchpoint
--- 1369,1375 ----
  	  continue;
  
        if (b->type == bp_hardware_breakpoint
! 	  && b->address != (*pc - DECR_PC_AFTER_HW_BREAK))
  	continue;
  
        if (b->type != bp_watchpoint
***************
*** 1470,1477 ****
                    break;
  	      }
          }
!       else if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs)
! 	real_breakpoint = 1;
  
        if (b->frame && b->frame != (get_current_frame ())->frame &&
            (b->type == bp_step_resume && 
--- 1470,1479 ----
                    break;
  	      }
          }
!       else
! 	{
! 	  real_breakpoint = 1;
! 	}
  
        if (b->frame && b->frame != (get_current_frame ())->frame &&
            (b->type == bp_step_resume && 
***************
*** 1527,1542 ****
    bs->next = NULL;		/* Terminate the chain */
    bs = root_bs->next;		/* Re-grab the head of the chain */
  
!   if ((DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs) && bs)
      {
!       if (real_breakpoint)
  	{
! 	  *pc = bp_addr;
  #if defined (SHIFT_INST_REGS)
! 	  SHIFT_INST_REGS();
  #else /* No SHIFT_INST_REGS.  */
! 	  write_pc (bp_addr);
  #endif /* No SHIFT_INST_REGS.  */
  	}
      }
  
--- 1529,1555 ----
    bs->next = NULL;		/* Terminate the chain */
    bs = root_bs->next;		/* Re-grab the head of the chain */
  
!   if (real_breakpoint && bs)
      {
!       if (bs->breakpoint_at->type == bp_hardware_breakpoint) 
! 	{
! 	  if (DECR_PC_AFTER_HW_BREAK != 0) 
! 	    {
! 	      *pc = *pc - DECR_PC_AFTER_HW_BREAK;
! 	      write_pc (*pc);
! 	    }
! 	}
!       else
  	{
! 	  if (DECR_PC_AFTER_BREAK != 0 || must_shift_inst_regs)
! 	    {
! 	      *pc = bp_addr;
  #if defined (SHIFT_INST_REGS)
! 	      SHIFT_INST_REGS();
  #else /* No SHIFT_INST_REGS.  */
! 	      write_pc (bp_addr);
  #endif /* No SHIFT_INST_REGS.  */
+ 	    }
  	}
      }
  


^ permalink raw reply	[flat|nested] 3+ messages in thread
[parent not found: <199812152308.PAA27367.cygnus.patches.gdb@jtc.redbacknetworks.com>]

end of thread, other threads:[~1999-04-01  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-15 15:09 Fix for DECR_PC_AFTER_BREAK != DECR_PC_AFTER_HW_BREAK J.T. Conklin
     [not found] <199812152308.PAA27367.cygnus.patches.gdb@jtc.redbacknetworks.com>
1999-04-01  0:00 ` Stan Shebs
1999-01-21 19:12   ` Stan Shebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox