]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Eliminate enum bpstat_signal_value, simplify random signal checks further.
authorPedro Alves <palves@redhat.com>
Thu, 14 Nov 2013 19:43:27 +0000 (19:43 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 14 Nov 2013 19:51:15 +0000 (19:51 +0000)
After the previous patch, there's actually no breakpoint type that
returns BPSTAT_SIGNAL_HIDE, so we can go back to having
bpstat_explains_signal return a boolean.  The signal hiding actually
disappears.

gdb/
2013-11-14  Pedro Alves  <palves@redhat.com>

* break-catch-sig.c (signal_catchpoint_explains_signal): Adjust to
return a boolean.
* breakpoint.c (bpstat_explains_signal): Adjust to return a
boolean.
(explains_signal_watchpoint, base_breakpoint_explains_signal):
Adjust to return a boolean.
* breakpoint.h (enum bpstat_signal_value): Delete.
(struct breakpoint_ops) <explains_signal>: New returns a boolean.
(bpstat_explains_signal): Likewise.
* infrun.c (handle_inferior_event) <random signal checks>:
bpstat_explains_signal now returns a boolean - adjust.  No longer
consider hiding signals.

gdb/ChangeLog
gdb/break-catch-sig.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/infrun.c

index bb09ebe90d1904637c1cd6fb2b6714df1dd143ee..58e7f2e48d6353f20166aae22fc2628c645b65db 100644 (file)
@@ -1,3 +1,18 @@
+2013-11-14  Pedro Alves  <palves@redhat.com>
+
+       * break-catch-sig.c (signal_catchpoint_explains_signal): Adjust to
+       return a boolean.
+       * breakpoint.c (bpstat_explains_signal): Adjust to return a
+       boolean.
+       (explains_signal_watchpoint, base_breakpoint_explains_signal):
+       Adjust to return a boolean.
+       * breakpoint.h (enum bpstat_signal_value): Delete.
+       (struct breakpoint_ops) <explains_signal>: New returns a boolean.
+       (bpstat_explains_signal): Likewise.
+       * infrun.c (handle_inferior_event) <random signal checks>:
+       bpstat_explains_signal now returns a boolean - adjust.  No longer
+       consider hiding signals.
+
 2013-11-14  Pedro Alves  <palves@redhat.com>
 
        * breakpoint.c (bpstat_explains_signal) <Moribund locations>:
index 02d8b4ab6f9959be0509ecc9f747bec4a6257163..c82984afb98ad2281343c94c75dd8548ce6eb7be 100644 (file)
@@ -350,10 +350,10 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp)
 /* Implement the "explains_signal" breakpoint_ops method for signal
    catchpoints.  */
 
-static enum bpstat_signal_value
+static int
 signal_catchpoint_explains_signal (struct breakpoint *b, enum gdb_signal sig)
 {
-  return BPSTAT_SIGNAL_PASS;
+  return 1;
 }
 
 /* Create a new signal catchpoint.  TEMPFLAG is true if this should be
index e8ea0c30a0d9d80f339a73210a0ee8ee43781bec..260021ebab5563e77d71d6fd904ed521e4df3789 100644 (file)
@@ -4222,35 +4222,27 @@ bpstat_find_breakpoint (bpstat bsp, struct breakpoint *breakpoint)
 
 /* See breakpoint.h.  */
 
-enum bpstat_signal_value
+int
 bpstat_explains_signal (bpstat bsp, enum gdb_signal sig)
 {
-  enum bpstat_signal_value result = BPSTAT_SIGNAL_NO;
-
   for (; bsp != NULL; bsp = bsp->next)
     {
-      /* Ensure that, if we ever entered this loop, then we at least
-        return BPSTAT_SIGNAL_HIDE.  */
-      enum bpstat_signal_value newval;
-
       if (bsp->breakpoint_at == NULL)
        {
          /* A moribund location can never explain a signal other than
             GDB_SIGNAL_TRAP.  */
          if (sig == GDB_SIGNAL_TRAP)
-           newval = BPSTAT_SIGNAL_PASS;
-         else
-           newval = BPSTAT_SIGNAL_NO;
+           return 1;
        }
       else
-       newval = bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at,
-                                                          sig);
-
-      if (newval > result)
-       result = newval;
+       {
+         if (bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at,
+                                                       sig))
+           return 1;
+       }
     }
 
-  return result;
+  return 0;
 }
 
 /* Put in *NUM the breakpoint number of the first breakpoint we are
@@ -10771,15 +10763,15 @@ print_recreate_watchpoint (struct breakpoint *b, struct ui_file *fp)
 /* Implement the "explains_signal" breakpoint_ops method for
    watchpoints.  */
 
-static enum bpstat_signal_value
+static int
 explains_signal_watchpoint (struct breakpoint *b, enum gdb_signal sig)
 {
   /* A software watchpoint cannot cause a signal other than
      GDB_SIGNAL_TRAP.  */
   if (b->type == bp_watchpoint && sig != GDB_SIGNAL_TRAP)
-    return BPSTAT_SIGNAL_NO;
+    return 0;
 
-  return BPSTAT_SIGNAL_PASS;
+  return 1;
 }
 
 /* The breakpoint_ops structure to be used in hardware watchpoints.  */
@@ -12887,10 +12879,10 @@ base_breakpoint_decode_linespec (struct breakpoint *b, char **s,
 
 /* The default 'explains_signal' method.  */
 
-static enum bpstat_signal_value
+static int
 base_breakpoint_explains_signal (struct breakpoint *b, enum gdb_signal sig)
 {
-  return BPSTAT_SIGNAL_PASS;
+  return 1;
 }
 
 /* The default "after_condition_true" method.  */
index 4a25fb7b80d8ced0ba3c862967e79e736d745244..b2ff02ce46428ec188a34af8f153a27446f1e4dc 100644 (file)
@@ -470,22 +470,6 @@ struct bp_location
   struct symtab *symtab;
 };
 
-/* Return values for bpstat_explains_signal.  Note that the order of
-   the constants is important here; they are compared directly in
-   bpstat_explains_signal.  */
-
-enum bpstat_signal_value
-  {
-    /* bpstat does not explain this signal.  */
-    BPSTAT_SIGNAL_NO = 0,
-
-    /* bpstat explains this signal; signal should not be delivered.  */
-    BPSTAT_SIGNAL_HIDE,
-
-    /* bpstat explains this signal; signal should be delivered.  */
-    BPSTAT_SIGNAL_PASS
-  };
-
 /* This structure is a collection of function pointers that, if available,
    will be called instead of the performing the default action for this
    bptype.  */
@@ -600,12 +584,9 @@ struct breakpoint_ops
   void (*decode_linespec) (struct breakpoint *, char **,
                           struct symtabs_and_lines *);
 
-  /* Return true if this breakpoint explains a signal, but the signal
-     should still be delivered to the inferior.  This is used to make
-     'catch signal' interact properly with 'handle'; see
+  /* Return true if this breakpoint explains a signal.  See
      bpstat_explains_signal.  */
-  enum bpstat_signal_value (*explains_signal) (struct breakpoint *,
-                                              enum gdb_signal);
+  int (*explains_signal) (struct breakpoint *, enum gdb_signal);
 
   /* Called after evaluating the breakpoint's condition,
      and only if it evaluated true.  */
@@ -1002,11 +983,10 @@ struct bpstat_what bpstat_what (bpstat);
 /* Find the bpstat associated with a breakpoint.  NULL otherwise.  */
 bpstat bpstat_find_breakpoint (bpstat, struct breakpoint *);
 
-/* Nonzero if a signal that we got in wait() was due to circumstances
-   explained by the bpstat; and the signal should therefore not be
-   delivered.  */
-extern enum bpstat_signal_value bpstat_explains_signal (bpstat,
-                                                       enum gdb_signal);
+/* Nonzero if a signal that we got in target_wait() was due to
+   circumstances explained by the bpstat; the signal is therefore not
+   random.  */
+extern int bpstat_explains_signal (bpstat, enum gdb_signal);
 
 /* Nonzero is this bpstat causes a stop.  */
 extern int bpstat_causes_stop (bpstat);
index 8eb2ddd525101fb2b8907fba975a439504dd145b..4d26e376841f4e6286d7c84f96f2f835238b72cf 100644 (file)
@@ -3154,7 +3154,6 @@ handle_inferior_event (struct execution_control_state *ecs)
   int stepped_after_stopped_by_watchpoint = 0;
   enum stop_kind stop_soon;
   int random_signal;
-  enum bpstat_signal_value sval;
 
   if (ecs->ws.kind == TARGET_WAITKIND_IGNORE)
     {
@@ -4226,9 +4225,8 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
 
   if (debug_infrun
       && ecs->event_thread->suspend.stop_signal == GDB_SIGNAL_TRAP
-      && (bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
+      && !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
                                  GDB_SIGNAL_TRAP)
-         == BPSTAT_SIGNAL_NO)
       && stopped_by_watchpoint)
     fprintf_unfiltered (gdb_stdlog,
                        "infrun: no user watchpoint explains "
@@ -4255,9 +4253,9 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
      SPARC.  */
 
   /* See if the breakpoints module can explain the signal.  */
-  sval = bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
-                                ecs->event_thread->suspend.stop_signal);
-  random_signal = (sval == BPSTAT_SIGNAL_NO);
+  random_signal
+    = !bpstat_explains_signal (ecs->event_thread->control.stop_bpstat,
+                              ecs->event_thread->suspend.stop_signal);
 
   /* If not, perhaps stepping/nexting can.  */
   if (random_signal)
@@ -4268,9 +4266,6 @@ Cannot fill $_exitsignal with the correct signal number.\n"));
   if (random_signal)
     random_signal = !stopped_by_watchpoint;
 
-  if (sval == BPSTAT_SIGNAL_HIDE)
-    ecs->event_thread->suspend.stop_signal = GDB_SIGNAL_0;
-
   /* For the program's own signals, act according to
      the signal handling tables.  */