From patchwork Thu Aug 20 17:32:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wei-cheng, Wang" X-Patchwork-Id: 8392 Received: (qmail 33159 invoked by alias); 23 Aug 2015 16:17:06 -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 33150 invoked by uid 89); 23 Aug 2015 16:17:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f46.google.com Received: from mail-pa0-f46.google.com (HELO mail-pa0-f46.google.com) (209.85.220.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 23 Aug 2015 16:17:05 +0000 Received: by padfa11 with SMTP id fa11so6495228pad.1 for ; Sun, 23 Aug 2015 09:17:03 -0700 (PDT) X-Received: by 10.68.206.103 with SMTP id ln7mr36413270pbc.37.1440346623248; Sun, 23 Aug 2015 09:17:03 -0700 (PDT) Received: from localhost.localdomain (114-32-204-230.HINET-IP.hinet.net. [114.32.204.230]) by smtp.gmail.com with ESMTPSA id pj3sm14417936pdb.6.2015.08.23.09.17.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 23 Aug 2015 09:17:02 -0700 (PDT) From: Wei-cheng Wang To: uweigand@de.ibm.com, gdb-patches@sourceware.org, cole945@gmail.com Subject: [PATCH 1/2] Re-check fastpoint after reloading symbols. Date: Fri, 21 Aug 2015 01:32:17 +0800 Message-Id: <1440091938-42453-1-git-send-email-cole945@gmail.com> Hi Ulrich, This is a separate patch and should go before "Tracepoint for ppc64" patch. Is this ok? Thanks, Wei-cheng --- Check fast tracepoints after symbols have been re-loaded. For example, a pending tracepoint just becomes available after a new shared object being loaded. We didn't check it before, because we have no idea where it is. If the target rejects the tracepoint, an error is throw in check_fast_tracepoint_sals, and we will disable the breakpoint. The checking is deliberately put after the loop for adding location to breakpoint, so users can check the address for the tracepoint with `info trace'. Otherwise, it will simply show instead of the address. (gdb) info trace Num Type Disp Enb Address What 1 fast tracepoint keep n 0x00003fffb7f507dc ^^^^^^^^^^^^^^^^^^ -- gdb/ChangeLog 2015-08-23 Wei-cheng Wang * breakpoint.c (update_breakpoint_locations): Check fast tracepoints after reloading symbols. --- gdb/breakpoint.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 052aeb9..703b03a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14056,15 +14056,6 @@ update_breakpoint_locations (struct breakpoint *b, return; } - /* If there's no new locations, and all existing locations are - pending, don't do anything. This optimizes the common case where - all locations are in the same shared library, that was unloaded. - We'd like to retain the location, so that when the library is - loaded again, we don't loose the enabled/disabled status of the - individual locations. */ - if (all_locations_are_pending (existing_locations) && sals.nelts == 0) - return; - b->loc = NULL; for (i = 0; i < sals.nelts; ++i) @@ -14106,6 +14097,29 @@ update_breakpoint_locations (struct breakpoint *b, } } + /* If there's no new locations, and all existing locations are + pending, don't do anything. This optimizes the common case where + all locations are in the same shared library, that was unloaded. + We'd like to retain the location, so that when the library is + loaded again, we don't loose the enabled/disabled status of the + individual locations. */ + if (all_locations_are_pending (existing_locations) && sals.nelts == 0) + return; + + if (b->type == bp_fast_tracepoint) + { + TRY + { + check_fast_tracepoint_sals (get_current_arch(), &sals); + } + CATCH (e, RETURN_MASK_ERROR) + { + b->enable_state = bp_disabled; + throw_exception (e); + } + END_CATCH + } + /* If possible, carry over 'disable' status from existing breakpoints. */ {