From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17929 invoked by alias); 11 Dec 2003 01:11:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17917 invoked from network); 11 Dec 2003 01:11:53 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 11 Dec 2003 01:11:53 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id F195980018E for ; Wed, 10 Dec 2003 20:11:52 -0500 (EST) Message-ID: <3FD7C458.2080404@redhat.com> Date: Thu, 11 Dec 2003 01:11:00 -0000 From: Jeff Johnston User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [RFA]: breakpoint.c patch (prelude to pending breakpoint support) Content-Type: multipart/mixed; boundary="------------070200000407090603030401" X-SW-Source: 2003-12/txt/msg00307.txt.bz2 This is a multi-part message in MIME format. --------------070200000407090603030401 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1080 The following is a patch to centralize the test for an active-enabled breakpoint. This patch is in response to Daniel J's comments to split up the pending-breakpoint support patch. With pending breakpoint support, the test will be modified to include a check for a pending breakpoint. This will simplify reviewing the last of the patches required for pending-breakpoint support. Ok to commit? -- Jeff J. 2003-12-10 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): Ditto. (breakpoint_thread_match): Ditto. (bpstat_should_step, bpstat_have_active_hw_watchpoints): Ditto. (disable_breakpoints_in_shlibs): Ditto. (hw_watchpoint_used_count): Ditto. (disable_watchpoints_before_interactive_call_start): Ditto. (breakpoint_re_set_one): Ditto. (bpstat_stop_status): Use new function and simplify test. --------------070200000407090603030401 Content-Type: text/plain; name="breakpoint.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="breakpoint.patch" Content-length: 5843 Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.145 diff -u -p -r1.145 breakpoint.c --- breakpoint.c 17 Nov 2003 00:55:49 -0000 1.145 +++ breakpoint.c 10 Dec 2003 21:53:31 -0000 @@ -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 * /* 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 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 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 } 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 } 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, p && 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 n 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 silen #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 ty *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_c || (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; --------------070200000407090603030401--