From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8643 invoked by alias); 4 Dec 2012 04:45:25 -0000 Received: (qmail 8561 invoked by uid 22791); 4 Dec 2012 04:45:23 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Dec 2012 04:45:16 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TfkNf-0006ra-Il from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 03 Dec 2012 20:45:15 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 3 Dec 2012 20:45:15 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Mon, 3 Dec 2012 20:45:14 -0800 From: Yao Qi To: Subject: [PATCH 2/6] Iterate over ALL_TRACEPOINTS first. Date: Tue, 04 Dec 2012 04:45:00 -0000 Message-ID: <1354596282-32526-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1354596282-32526-1-git-send-email-yao@codesourcery.com> References: <1354596282-32526-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-12/txt/msg00049.txt.bz2 Hi, The 'breakpoint-modified' observer is notified on the breakpoint level, in order to notify observer for a given tracepoint only once, we change to iterate over tracepoint first, and then iterate over locations of each tracepoint. In the inner loop, when we find a tracepoint location is downloaded, we mark a flag, and notify the observer in outer loop (on tracepoints) if flag is true. In short, we change the iteration from: ALL_BP_LOCATIONS (bl, blp_tmp) { if (!is_tracepoint (bl->owner)) continue; } to: ALL_TRACEPOINTS (b) { for (bl = b->loc; bl; bl = bl->next) {} } download_tracepoint_locations is called after breakpoint re-setting, so I think this change has no functional affect. gdb: 2012-12-03 Yao Qi * breakpoint.c (download_tracepoint_locations): Iterate over ALL_TRACEPOINTS first and then iterate over locations of each tracepoint. --- gdb/breakpoint.c | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 40d2edd..3f2f0c9 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12078,7 +12078,7 @@ bp_location_target_extensions_update (void) static void download_tracepoint_locations (void) { - struct bp_location *bl, **blp_tmp; + struct breakpoint *b; struct cleanup *old_chain; if (!target_can_download_tracepoint ()) @@ -12086,31 +12086,32 @@ download_tracepoint_locations (void) old_chain = save_current_space_and_thread (); - ALL_BP_LOCATIONS (bl, blp_tmp) + ALL_TRACEPOINTS (b) { + struct bp_location *bl; struct tracepoint *t; - if (!is_tracepoint (bl->owner)) - continue; - - if ((bl->owner->type == bp_fast_tracepoint + if ((b->type == bp_fast_tracepoint ? !may_insert_fast_tracepoints : !may_insert_tracepoints)) continue; - /* In tracepoint, locations are _never_ duplicated, so - should_be_inserted is equivalent to - unduplicated_should_be_inserted. */ - if (!should_be_inserted (bl) || bl->inserted) - continue; + for (bl = b->loc; bl; bl = bl->next) + { + /* In tracepoint, locations are _never_ duplicated, so + should_be_inserted is equivalent to + unduplicated_should_be_inserted. */ + if (!should_be_inserted (bl) || bl->inserted) + continue; - switch_to_program_space_and_thread (bl->pspace); + switch_to_program_space_and_thread (bl->pspace); - target_download_tracepoint (bl); + target_download_tracepoint (bl); - bl->inserted = 1; - t = (struct tracepoint *) bl->owner; - t->number_on_target = bl->owner->number; + bl->inserted = 1; + } + t = (struct tracepoint *) b; + t->number_on_target = b->number; } do_cleanups (old_chain); -- 1.7.7.6