+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>:
/* 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
/* 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
/* 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. */
/* 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. */
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. */
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. */
/* 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);
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)
{
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 "
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)
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. */