* infrun.c (handle_inferior_event): When handling a fork or vfork
authorPedro Alves <palves@redhat.com>
Sun, 15 Nov 2009 20:10:34 +0000 (20:10 +0000)
committerPedro Alves <palves@redhat.com>
Sun, 15 Nov 2009 20:10:34 +0000 (20:10 +0000)
event, check if the bpstat causes a stop, instead of if it
explains the signal.
* breakpoint.c (bpstat_causes_stop): New.
* breakpoint.h (bpstat_causes_stop): Declare.

gdb/ChangeLog
gdb/breakpoint.c
gdb/breakpoint.h
gdb/infrun.c

index 500eaf826ac8f87477ca2d47326856c29a69f4e8..93fdd8cc68a51814f4b7753d006da9ea336962e8 100644 (file)
@@ -1,3 +1,11 @@
+2009-11-15  Pedro Alves  <pedro@codesourcery.com>
+
+       * infrun.c (handle_inferior_event): When handling a fork or vfork
+       event, check if the bpstat causes a stop, instead of if it
+       explains the signal.
+       * breakpoint.c (bpstat_causes_stop): New.
+       * breakpoint.h (bpstat_causes_stop): Declare.
+
 2009-11-15  Pedro Alves  <pedro@codesourcery.com>
 
        * breakpoint.c (should_be_inserted): Don't insert breakpoints if
index 0034338a0ee261bc1bf0627ac9ea9872ec20d380..c6140b0cfbc37311f777c064d676153bf5e031c3 100644 (file)
@@ -3816,6 +3816,16 @@ bpstat_should_step (void)
   return 0;
 }
 
+int
+bpstat_causes_stop (bpstat bs)
+{
+  for (; bs != NULL; bs = bs->next)
+    if (bs->stop)
+      return 1;
+
+  return 0;
+}
+
 \f
 
 static void print_breakpoint_location (struct breakpoint *b,
index d23a852cb4622e89469500c51aeaab1db81e391a..91e864cd04f6db7ab63fee7a358de6b0d5e69002 100644 (file)
@@ -629,6 +629,9 @@ extern struct breakpoint *bpstat_find_step_resume_breakpoint (bpstat);
    a watchpoint enabled.  */
 #define bpstat_explains_signal(bs) ((bs) != NULL)
 
+/* Nonzero is this bpstat causes a stop.  */
+extern int bpstat_causes_stop (bpstat);
+
 /* Nonzero if we should step constantly (e.g. watchpoints on machines
    without hardware support).  This isn't related to a specific bpstat,
    just to things like whether watchpoints are set.  */
index c28366f5da92128556004c445a12f4760c8b88bd..98e215c7e740ff599b8894f3294ce2e9d7e67d33 100644 (file)
@@ -2946,7 +2946,11 @@ handle_inferior_event (struct execution_control_state *ecs)
        = bpstat_stop_status (get_regcache_aspace (get_current_regcache ()),
                              stop_pc, ecs->ptid);
 
-      ecs->random_signal = !bpstat_explains_signal (ecs->event_thread->stop_bpstat);
+      /* Note that we're interested in knowing the bpstat actually
+        causes a stop, not just if it may explain the signal.
+        Software watchpoints, for example, always appear in the
+        bpstat.  */
+      ecs->random_signal = !bpstat_causes_stop (ecs->event_thread->stop_bpstat);
 
       /* If no catchpoint triggered for this, then keep going.  */
       if (ecs->random_signal)