diff options
author | Pedro Alves <palves@redhat.com> | 2013-11-14 19:43:27 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-11-14 19:51:15 +0000 |
commit | 47591c29add16c520c7bc2c7ace227deeb08f4a5 (patch) | |
tree | 2e29df0efaa19bfe74dfb8028c2552304c4e737f | |
parent | bac7d97b66867e7654a1c27b00e7164e24243da0 (diff) | |
download | gdb-47591c29add16c520c7bc2c7ace227deeb08f4a5.zip gdb-47591c29add16c520c7bc2c7ace227deeb08f4a5.tar.gz gdb-47591c29add16c520c7bc2c7ace227deeb08f4a5.tar.bz2 |
Eliminate enum bpstat_signal_value, simplify random signal checks further.
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.
-rw-r--r-- | gdb/ChangeLog | 15 | ||||
-rw-r--r-- | gdb/break-catch-sig.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 34 | ||||
-rw-r--r-- | gdb/breakpoint.h | 32 | ||||
-rw-r--r-- | gdb/infrun.c | 13 |
5 files changed, 40 insertions, 58 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb09ebe..58e7f2e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,20 @@ 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>: Return BPSTAT_SIGNAL_PASS instead of BPSTAT_SIGNAL_HIDE. (explains_signal_watchpoint): Return BPSTAT_SIGNAL_PASS instead of diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index 02d8b4a..c82984a 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -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 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index e8ea0c3..260021e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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. */ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 4a25fb7..b2ff02c 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -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); diff --git a/gdb/infrun.c b/gdb/infrun.c index 8eb2ddd..4d26e37 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -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. */ |