X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fbreakpoint.c;h=111660fce1a090fec4a50628f2e83cab4d11adae;hb=2dd4d4224afba558be14b39e2886ba47b2132678;hp=36252ee542302e66f7459acbeece981f8ad07922;hpb=7d4df6a4e13f9f15c26ac132775d7ab570b38456;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 36252ee542..111660fce1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -35,7 +35,7 @@ #include "gdbthread.h" #include "target.h" #include "language.h" -#include "gdb_string.h" +#include #include "gdb-demangle.h" #include "filenames.h" #include "annotate.h" @@ -2096,6 +2096,9 @@ build_target_condition_list (struct bp_location *bl) int modified = bl->needs_update; struct bp_location *loc; + /* Release conditions left over from a previous insert. */ + VEC_free (agent_expr_p, bl->target_info.conditions); + /* This is only meaningful if the target is evaluating conditions and if the user has opted for condition evaluation on the target's @@ -2287,6 +2290,9 @@ build_target_command_list (struct bp_location *bl) int modified = bl->needs_update; struct bp_location *loc; + /* Release commands left over from a previous insert. */ + VEC_free (agent_expr_p, bl->target_info.tcommands); + /* For now, limit to agent-style dprintf breakpoints. */ if (bl->owner->type != bp_dprintf || strcmp (dprintf_style, dprintf_style_agent) != 0) @@ -4222,35 +4228,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_HIDE; - 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 @@ -4649,10 +4647,12 @@ bpstat_print (bpstat bs, int kind) return PRINT_UNKNOWN; } -/* Evaluate the expression EXP and return 1 if value is zero. This is - used inside a catch_errors to evaluate the breakpoint condition. +/* Evaluate the expression EXP and return 1 if value is zero. + This returns the inverse of the condition because it is called + from catch_errors which returns 0 if an exception happened, and if an + exception happens we want execution to stop. The argument is a "struct expression *" that has been cast to a - "char *" to make it pass through catch_errors. */ + "void *" to make it pass through catch_errors. */ static int breakpoint_cond_eval (void *exp) @@ -5132,6 +5132,14 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid) return; } + /* If this is a thread-specific breakpoint, don't waste cpu evaluating the + condition if this isn't the specified thread. */ + if (b->thread != -1 && b->thread != thread_id) + { + bs->stop = 0; + return; + } + /* Evaluate Python breakpoints that have a "stop" method implemented. */ if (b->py_bp_object) bs->stop = gdbpy_should_stop (b->py_bp_object); @@ -5215,10 +5223,6 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid) { bs->stop = 0; } - else if (b->thread != -1 && b->thread != thread_id) - { - bs->stop = 0; - } else if (b->ignore_count > 0) { b->ignore_count--; @@ -10765,15 +10769,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_HIDE; + return 1; } /* The breakpoint_ops structure to be used in hardware watchpoints. */ @@ -12736,6 +12740,9 @@ bp_location_dtor (struct bp_location *self) if (self->cond_bytecode) free_agent_expr (self->cond_bytecode); xfree (self->function_name); + + VEC_free (agent_expr_p, self->target_info.conditions); + VEC_free (agent_expr_p, self->target_info.tcommands); } static const struct bp_location_ops bp_location_ops = @@ -12881,10 +12888,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_HIDE; + return 1; } /* The default "after_condition_true" method. */