From patchwork Wed Sep 17 22:47:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 2896 Received: (qmail 26101 invoked by alias); 17 Sep 2014 22:47:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 25965 invoked by uid 89); 17 Sep 2014 22:47:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 17 Sep 2014 22:47:14 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8HMlD1H027610 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 17 Sep 2014 18:47:13 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8HMl9Wg030382 for ; Wed, 17 Sep 2014 18:47:12 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 2/3] Tell update_global_location_list to insert breakpoints Date: Wed, 17 Sep 2014 23:47:07 +0100 Message-Id: <1410994028-24282-3-git-send-email-palves@redhat.com> In-Reply-To: <1410994028-24282-1-git-send-email-palves@redhat.com> References: <1410994028-24282-1-git-send-email-palves@redhat.com> This adds a new mode for update_global_location_list, that allows callers saying "please insert breakpoints, even if breakpoints_always_inserted_mode() is false". This allows removing a couple breakpoints_always_inserted_mode checks. gdb/ 2014-09-17 Pedro Alves * breakpoint.c (enum ugll_insert_mode): Add UGLL_INSERT. (insert_breakpoints): Don't call insert_breakpoint_locations here. Instead, pass UGLL_INSERT to update_global_location_list. (update_global_location_list): Change parameter type from boolean to enum ugll_insert_mode. All callers adjusted. Adjust to use breakpoints_should_be_inserted_now and handle UGLL_INSERT. (create_solib_event_breakpoint_1): New, factored out from ... (create_solib_event_breakpoint): ... this. (create_and_insert_solib_event_breakpoint): Use create_solib_event_breakpoint_1 instead of calling insert_breakpoint_locations manually. (update_global_location_list): Handle UGLL_INSERT. --- gdb/breakpoint.c | 56 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 46cd079..3f372de 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -260,7 +260,11 @@ enum ugll_insert_mode /* May insert breakpoints if breakpoints_always_inserted_mode is true. */ - UGLL_MAY_INSERT + UGLL_MAY_INSERT, + + /* Insert locations now, even if breakpoints_always_inserted_mode is + false. */ + UGLL_INSERT }; static void update_global_location_list (enum ugll_insert_mode); @@ -2954,13 +2958,10 @@ insert_breakpoints (void) update_watchpoint (w, 0 /* don't reparse. */); } - update_global_location_list (UGLL_MAY_INSERT); - - /* update_global_location_list does not insert breakpoints when - always_inserted_mode is not enabled. Explicitly insert them - now. */ - if (!breakpoints_always_inserted_mode ()) - insert_breakpoint_locations (); + /* Updating watchpoints creates new locations, so update the global + location list. Explicitly tell ugll to insert locations and + ignore breakpoints_always_inserted_mode. */ + update_global_location_list (UGLL_INSERT); } /* Invoke CALLBACK for each of bp_location. */ @@ -7722,17 +7723,28 @@ remove_solib_event_breakpoints_at_next_stop (void) b->disposition = disp_del_at_next_stop; } -struct breakpoint * -create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) +/* Helper for create_solib_event_breakpoint / + create_and_insert_solib_event_breakpoint. Allows specifying which + INSERT_MODE to pass through to update_global_location_list. */ + +static struct breakpoint * +create_solib_event_breakpoint_1 (struct gdbarch *gdbarch, CORE_ADDR address, + enum ugll_insert_mode insert_mode) { struct breakpoint *b; b = create_internal_breakpoint (gdbarch, address, bp_shlib_event, &internal_breakpoint_ops); - update_global_location_list_nothrow (UGLL_MAY_INSERT); + update_global_location_list_nothrow (insert_mode); return b; } +struct breakpoint * +create_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR address) +{ + return create_solib_event_breakpoint_1 (gdbarch, address, UGLL_MAY_INSERT); +} + /* See breakpoint.h. */ struct breakpoint * @@ -7740,9 +7752,9 @@ create_and_insert_solib_event_breakpoint (struct gdbarch *gdbarch, CORE_ADDR add { struct breakpoint *b; - b = create_solib_event_breakpoint (gdbarch, address); - if (!breakpoints_always_inserted_mode ()) - insert_breakpoint_locations (); + /* Explicitly tell update_global_location_list to insert + locations. */ + b = create_solib_event_breakpoint_1 (gdbarch, address, UGLL_INSERT); if (!b->loc->inserted) { delete_breakpoint (b); @@ -12578,8 +12590,9 @@ force_breakpoint_reinsertion (struct bp_location *bl) deleted, to update the global location list and recompute which locations are duplicate of which. - The INSERT_MODE flag determines whether locations may or may not be - inserted now. See 'enum ugll_insert_mode' for more info. */ + The INSERT_MODE flag determines whether locations may not, may, or + shall be inserted now. See 'enum ugll_insert_mode' for more + info. */ static void update_global_location_list (enum ugll_insert_mode insert_mode) @@ -12917,11 +12930,12 @@ update_global_location_list (enum ugll_insert_mode insert_mode) "a permanent breakpoint")); } - if (breakpoints_always_inserted_mode () - && (have_live_inferiors () - || (gdbarch_has_global_breakpoints (target_gdbarch ())))) + if (insert_mode == UGLL_INSERT + || (breakpoints_always_inserted_mode () + && (have_live_inferiors () + || (gdbarch_has_global_breakpoints (target_gdbarch ()))))) { - if (insert_mode == UGLL_MAY_INSERT) + if (insert_mode != UGLL_DONT_INSERT) insert_breakpoint_locations (); else { @@ -12935,7 +12949,7 @@ update_global_location_list (enum ugll_insert_mode insert_mode) } } - if (insert_mode == UGLL_MAY_INSERT) + if (insert_mode != UGLL_DONT_INSERT) download_tracepoint_locations (); do_cleanups (cleanups);