Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "J.T. Conklin" <jtc@redbacknetworks.com>
To: gdb-patches@cygnus.com
Subject: Fix for DECR_PC_AFTER_BREAK != DECR_PC_AFTER_HW_BREAK
Date: Tue, 15 Dec 1998 15:09:00 -0000	[thread overview]
Message-ID: <199812152308.PAA27367@jtc.redbacknetworks.com> (raw)

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.  */
+ 	    }
  	}
      }
  


             reply	other threads:[~1998-12-15 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-15 15:09 J.T. Conklin [this message]
     [not found] <199812152308.PAA27367.cygnus.patches.gdb@jtc.redbacknetworks.com>
1999-04-01  0:00 ` Stan Shebs
1999-01-21 19:12   ` Stan Shebs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199812152308.PAA27367@jtc.redbacknetworks.com \
    --to=jtc@redbacknetworks.com \
    --cc=gdb-patches@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox