Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH: Fork event updates, part the tenth
@ 2002-12-15 12:17 Daniel Jacobowitz
  2002-12-16  8:46 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2002-12-15 12:17 UTC (permalink / raw)
  To: gdb-patches

Right now, there are four calls to bpstat_stop_status in infrun.c.  Three of
them are for catchpoints; right now, catchpoints should not be affected by
DECR_PC_AFTER_BREAK, because they aren't breakpoints.  Hopefully
DECR_PC_AFTER_BREAK will be gone from this code if anyone ever has a target
where they _are_ breakpoints.

So, since a catchpoint is not a software breakpoint, we can just pass "1"
for NOT_A_SW_BREAKPOINT.  This prevents an incorrect PC decrement on
i386-linux with the upcoming fork catchpoint patches.  Committed.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2002-12-15  Daniel Jacobowitz  <drow@mvista.com>

	* infrun.c (handle_inferior_event): Assume that catchpoints
	are not affected by DECR_PC_AFTER_BREAK.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.88
diff -u -p -r1.88 infrun.c
--- infrun.c	13 Dec 2002 21:57:40 -0000	1.88
+++ infrun.c	15 Dec 2002 20:03:39 -0000
@@ -1335,17 +1335,15 @@ handle_inferior_event (struct execution_
       stop_pc = read_pc_pid (ecs->ptid);
       ecs->saved_inferior_ptid = inferior_ptid;
       inferior_ptid = ecs->ptid;
-      /* The second argument of bpstat_stop_status is meant to help
-         distinguish between a breakpoint trap and a singlestep trap.
-         This is only important on targets where DECR_PC_AFTER_BREAK
-         is non-zero.  The prev_pc test is meant to distinguish between
-         singlestepping a trap instruction, and singlestepping thru a
-         jump to the instruction following a trap instruction. */
-
-      stop_bpstat = bpstat_stop_status (&stop_pc,
-					currently_stepping (ecs) &&
-					prev_pc !=
-					stop_pc - DECR_PC_AFTER_BREAK);
+
+      /* Assume that catchpoints are not really software breakpoints.  If
+	 some future target implements them using software breakpoints then
+	 that target is responsible for fudging DECR_PC_AFTER_BREAK.  Thus
+	 we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that
+	 bpstat_stop_status will not decrement the PC.  */
+
+      stop_bpstat = bpstat_stop_status (&stop_pc, 1);
+
       ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
       inferior_ptid = ecs->saved_inferior_ptid;
       goto process_event_stop_test;
@@ -1386,17 +1384,15 @@ handle_inferior_event (struct execution_
 	}
 
       stop_pc = read_pc ();
-      /* The second argument of bpstat_stop_status is meant to help
-         distinguish between a breakpoint trap and a singlestep trap.
-         This is only important on targets where DECR_PC_AFTER_BREAK
-         is non-zero.  The prev_pc test is meant to distinguish between
-         singlestepping a trap instruction, and singlestepping thru a
-         jump to the instruction following a trap instruction. */
-
-      stop_bpstat = bpstat_stop_status (&stop_pc,
-					currently_stepping (ecs) &&
-					prev_pc !=
-					stop_pc - DECR_PC_AFTER_BREAK);
+
+      /* Assume that catchpoints are not really software breakpoints.  If
+	 some future target implements them using software breakpoints then
+	 that target is responsible for fudging DECR_PC_AFTER_BREAK.  Thus
+	 we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that
+	 bpstat_stop_status will not decrement the PC.  */
+
+      stop_bpstat = bpstat_stop_status (&stop_pc, 1);
+
       ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
       goto process_event_stop_test;
 
@@ -1435,17 +1431,15 @@ handle_inferior_event (struct execution_
       stop_pc = read_pc_pid (ecs->ptid);
       ecs->saved_inferior_ptid = inferior_ptid;
       inferior_ptid = ecs->ptid;
-      /* The second argument of bpstat_stop_status is meant to help
-         distinguish between a breakpoint trap and a singlestep trap.
-         This is only important on targets where DECR_PC_AFTER_BREAK
-         is non-zero.  The prev_pc test is meant to distinguish between
-         singlestepping a trap instruction, and singlestepping thru a
-         jump to the instruction following a trap instruction. */
-
-      stop_bpstat = bpstat_stop_status (&stop_pc,
-					currently_stepping (ecs) &&
-					prev_pc !=
-					stop_pc - DECR_PC_AFTER_BREAK);
+
+      /* Assume that catchpoints are not really software breakpoints.  If
+	 some future target implements them using software breakpoints then
+	 that target is responsible for fudging DECR_PC_AFTER_BREAK.  Thus
+	 we pass 1 for the NOT_A_SW_BREAKPOINT argument, so that
+	 bpstat_stop_status will not decrement the PC.  */
+
+      stop_bpstat = bpstat_stop_status (&stop_pc, 1);
+
       ecs->random_signal = !bpstat_explains_signal (stop_bpstat);
       inferior_ptid = ecs->saved_inferior_ptid;
       goto process_event_stop_test;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Fork event updates, part the tenth
  2002-12-15 12:17 PATCH: Fork event updates, part the tenth Daniel Jacobowitz
@ 2002-12-16  8:46 ` Andrew Cagney
  2002-12-16  8:57   ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2002-12-16  8:46 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> Right now, there are four calls to bpstat_stop_status in infrun.c.  Three of
> them are for catchpoints; right now, catchpoints should not be affected by
> DECR_PC_AFTER_BREAK, because they aren't breakpoints.  Hopefully
> DECR_PC_AFTER_BREAK will be gone from this code if anyone ever has a target
> where they _are_ breakpoints.
> 
> So, since a catchpoint is not a software breakpoint, we can just pass "1"
> for NOT_A_SW_BREAKPOINT.  This prevents an incorrect PC decrement on
> i386-linux with the upcoming fork catchpoint patches.  Committed.

Er, where is the fire?  Nothing involving decr pc after break is 
obvious.  I think here you should at least be seeking a second opinion.

Andrew



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Fork event updates, part the tenth
  2002-12-16  8:46 ` Andrew Cagney
@ 2002-12-16  8:57   ` Daniel Jacobowitz
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2002-12-16  8:57 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

On Mon, Dec 16, 2002 at 11:44:32AM -0500, Andrew Cagney wrote:
> >Right now, there are four calls to bpstat_stop_status in infrun.c.  Three 
> >of
> >them are for catchpoints; right now, catchpoints should not be affected by
> >DECR_PC_AFTER_BREAK, because they aren't breakpoints.  Hopefully
> >DECR_PC_AFTER_BREAK will be gone from this code if anyone ever has a target
> >where they _are_ breakpoints.
> >
> >So, since a catchpoint is not a software breakpoint, we can just pass "1"
> >for NOT_A_SW_BREAKPOINT.  This prevents an incorrect PC decrement on
> >i386-linux with the upcoming fork catchpoint patches.  Committed.
> 
> Er, where is the fire?  Nothing involving decr pc after break is 
> obvious.  I think here you should at least be seeking a second opinion.

This is in blocks of code conditioned on TARGET_WAITKIND_{FORKED,VFORKED,EXECD}.
There are only two targets that ever return these; HP/UX (which has no
DECR_PC_AFTER_BREAK) and i386-linux (in my working tree, which has
DECR_PC_AFTER_BREAK, but in which catchpoints are unaffected by it).
The argument is labeled NOT_A_SW_BREAKPOINT, and these are known to not
be software breakpoints.  How much simpler can it get?

The fire is apparently that I lack your indefatigable patience.  I have
been submitting this same feature for several months now and it's
blocking me from doing anything else substantial without tripping on my
own feet repeatedly.

You've stated your preference; I'll throttle back and find something
else to do in the mean time.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-16 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-15 12:17 PATCH: Fork event updates, part the tenth Daniel Jacobowitz
2002-12-16  8:46 ` Andrew Cagney
2002-12-16  8:57   ` Daniel Jacobowitz

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