From: Jeff Johnston Date: Fri, 12 Dec 2003 19:04:46 +0000 (+0000) Subject: 2003-12-12 Jeff Johnston X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=468d015dea6635332057dbbd56d4b2ddd32c991d;p=binutils-gdb.git 2003-12-12 Jeff Johnston * breakpoint.c (breakpoint_enabled): New function to test whether breakpoint is active and enabled. (insert_bp_location, insert_breakpoints): Call new function to test for enabled breakpoint. (remove_breakpoint, breakpoint_here_p, breakpoint_thread_match) (bpstat_should_step, bpstat_have_active_hw_watchpoints) (disable_breakpoints_in_shlibs, hw_watchpoint_used_count) (disable_watchpoints_before_interactive_call_start) (breakpoint_re_set_one): Ditto. (bpstat_stop_status): Use new function and simplify test. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cf4fd34559b..862c048c54b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2003-12-12 Jeff Johnston + + * breakpoint.c (breakpoint_enabled): New function to test whether + breakpoint is active and enabled. + (insert_bp_location, insert_breakpoints): Call new function to test + for enabled breakpoint. + (remove_breakpoint, breakpoint_here_p, breakpoint_thread_match) + (bpstat_should_step, bpstat_have_active_hw_watchpoints) + (disable_breakpoints_in_shlibs, hw_watchpoint_used_count) + (disable_watchpoints_before_interactive_call_start) + (breakpoint_re_set_one): Ditto. + (bpstat_stop_status): Use new function and simplify test. + 2003-12-11 Mark Kettenis * observer.c (observer_test_first_observer) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 02874bcf290..ddf51b7145c 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -332,6 +332,13 @@ int exception_support_initialized = 0; error ("catch of library unloads not yet implemented on this platform") #endif +/* Return whether a breakpoint is an active enabled breakpoint. */ +static int +breakpoint_enabled (struct breakpoint *b) +{ + return b->enable_state == bp_enabled; +} + /* Set breakpoint count to NUM. */ void @@ -757,7 +764,7 @@ insert_bp_location (struct bp_location *bpt, /* Permanent breakpoints cannot be inserted or removed. Disabled breakpoints should not be inserted. */ - if (bpt->owner->enable_state != bp_enabled) + if (!breakpoint_enabled (bpt->owner)) return 0; if (bpt->inserted || bpt->duplicate) @@ -1107,7 +1114,7 @@ insert_breakpoints (void) { /* Permanent breakpoints cannot be inserted or removed. Disabled breakpoints should not be inserted. */ - if (b->owner->enable_state != bp_enabled) + if (!breakpoint_enabled (b->owner)) continue; /* FIXME drow/2003-10-07: This code should be pushed elsewhere when @@ -1457,7 +1464,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) b->inserted = (is == mark_inserted); } else if (b->loc_type == bp_loc_hardware_watchpoint - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { struct value *v; @@ -1513,7 +1520,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) else if ((b->owner->type == bp_catch_fork || b->owner->type == bp_catch_vfork || b->owner->type == bp_catch_exec) - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { val = -1; @@ -1538,7 +1545,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) } else if ((b->owner->type == bp_catch_catch || b->owner->type == bp_catch_throw) - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { @@ -1549,7 +1556,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) } else if (ep_is_exception_catchpoint (b->owner) && b->inserted /* sometimes previous insert doesn't happen */ - && b->owner->enable_state == bp_enabled + && breakpoint_enabled (b->owner) && !b->duplicate) { @@ -1675,7 +1682,7 @@ breakpoint_here_p (CORE_ADDR pc) && bpt->loc_type != bp_loc_hardware_breakpoint) continue; - if ((bpt->owner->enable_state == bp_enabled + if ((breakpoint_enabled (bpt->owner) || bpt->owner->enable_state == bp_permanent) && bpt->address == pc) /* bp is enabled and matches pc */ { @@ -1772,7 +1779,7 @@ breakpoint_thread_match (CORE_ADDR pc, ptid_t ptid) && bpt->loc_type != bp_loc_hardware_breakpoint) continue; - if ((bpt->owner->enable_state == bp_enabled + if ((breakpoint_enabled (bpt->owner) || bpt->owner->enable_state == bp_permanent) && bpt->address == pc && (bpt->owner->thread == -1 || bpt->owner->thread == thread)) @@ -2574,9 +2581,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) ALL_BREAKPOINTS_SAFE (b, temp) { - if (b->enable_state == bp_disabled - || b->enable_state == bp_shlib_disabled - || b->enable_state == bp_call_disabled) + if (!breakpoint_enabled (b) && b->enable_state != bp_permanent) continue; if (b->type != bp_watchpoint @@ -3179,7 +3184,7 @@ bpstat_should_step (void) { struct breakpoint *b; ALL_BREAKPOINTS (b) - if (b->enable_state == bp_enabled && b->type == bp_watchpoint) + if (breakpoint_enabled (b) && b->type == bp_watchpoint) return 1; return 0; } @@ -3190,7 +3195,7 @@ bpstat_have_active_hw_watchpoints (void) { struct bp_location *bpt; ALL_BP_LOCATIONS (bpt) - if ((bpt->owner->enable_state == bp_enabled) + if (breakpoint_enabled (bpt->owner) && bpt->inserted && bpt->loc_type == bp_loc_hardware_watchpoint) return 1; @@ -4268,7 +4273,7 @@ disable_breakpoints_in_shlibs (int silent) #if defined (PC_SOLIB) if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint)) && - b->enable_state == bp_enabled && + breakpoint_enabled (b) && !b->loc->duplicate && PC_SOLIB (b->loc->address)) { @@ -4491,14 +4496,13 @@ hw_watchpoint_used_count (enum bptype type, int *other_type_used) *other_type_used = 0; ALL_BREAKPOINTS (b) { - if (b->enable_state == bp_enabled) + if (breakpoint_enabled (b)) { if (b->type == type) i++; else if ((b->type == bp_hardware_watchpoint || b->type == bp_read_watchpoint || - b->type == bp_access_watchpoint) - && b->enable_state == bp_enabled) + b->type == bp_access_watchpoint)) *other_type_used = 1; } } @@ -4540,7 +4544,7 @@ disable_watchpoints_before_interactive_call_start (void) || (b->type == bp_read_watchpoint) || (b->type == bp_access_watchpoint) || ep_is_exception_catchpoint (b)) - && (b->enable_state == bp_enabled)) + && breakpoint_enabled (b)) { b->enable_state = bp_call_disabled; check_duplicates (b); @@ -7063,7 +7067,7 @@ breakpoint_re_set_one (void *bint) value_free (b->val); b->val = evaluate_expression (b->exp); release_value (b->val); - if (VALUE_LAZY (b->val) && b->enable_state == bp_enabled) + if (VALUE_LAZY (b->val) && breakpoint_enabled (b)) value_fetch_lazy (b->val); if (b->cond_string != NULL) @@ -7073,7 +7077,7 @@ breakpoint_re_set_one (void *bint) xfree (b->cond); b->cond = parse_exp_1 (&s, (struct block *) 0, 0); } - if (b->enable_state == bp_enabled) + if (breakpoint_enabled (b)) mention (b); value_free_to_mark (mark); break;