From patchwork Thu Sep 10 11:35:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 8618 Received: (qmail 54704 invoked by alias); 10 Sep 2015 11:35:26 -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 54689 invoked by uid 89); 10 Sep 2015 11:35:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f50.google.com Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 10 Sep 2015 11:35:20 +0000 Received: by padhy16 with SMTP id hy16so41126927pad.1 for ; Thu, 10 Sep 2015 04:35:18 -0700 (PDT) X-Received: by 10.68.197.65 with SMTP id is1mr82296770pbc.109.1441884918576; Thu, 10 Sep 2015 04:35:18 -0700 (PDT) Received: from E107787-LIN (power-aix.osuosl.org. [140.211.15.154]) by smtp.gmail.com with ESMTPSA id df1sm1843361pbb.21.2015.09.10.04.35.16 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Sep 2015 04:35:17 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Call target_can_download_tracepoint if there are tracepoints to download In-Reply-To: <55F00C91.2000602@redhat.com> (Pedro Alves's message of "Wed, 09 Sep 2015 11:40:17 +0100") References: <1441721612-15314-1-git-send-email-yao.qi@linaro.org> <55F00C91.2000602@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Date: Thu, 10 Sep 2015 12:35:12 +0100 Message-ID: <86a8su7bin.fsf@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes Pedro Alves writes: > I'd suggest moving tribool in common/common-types.h. It's just > be a matter of time before we want to use this in gdbserver too.. Yes, of course. Patch below is what I pushed in. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 85d8bc2..ba521c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2015-09-10 Yao Qi + + * breakpoint.c (download_tracepoint_locations): New local + can_download_tracepoint. Check the result of + target_can_download_tracepoint and save it in + can_download_tracepoint if there are tracepoints to download. + * linux-nat.h (enum tribool): Move it to ... + * common/common-types.h: ... here. + 2015-09-09 Pedro Alves * inf-loop.c (inferior_event_handler): Delete INF_TIMER case. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 4709de7..520793a 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12146,9 +12146,7 @@ download_tracepoint_locations (void) { struct breakpoint *b; struct cleanup *old_chain; - - if (!target_can_download_tracepoint ()) - return; + enum tribool can_download_tracepoint = TRIBOOL_UNKNOWN; old_chain = save_current_space_and_thread (); @@ -12163,6 +12161,17 @@ download_tracepoint_locations (void) : !may_insert_tracepoints)) continue; + if (can_download_tracepoint == TRIBOOL_UNKNOWN) + { + if (target_can_download_tracepoint ()) + can_download_tracepoint = TRIBOOL_TRUE; + else + can_download_tracepoint = TRIBOOL_FALSE; + } + + if (can_download_tracepoint == TRIBOOL_FALSE) + break; + for (bl = b->loc; bl; bl = bl->next) { /* In tracepoint, locations are _never_ duplicated, so diff --git a/gdb/common/common-types.h b/gdb/common/common-types.h index 55b41ab..3f60a9a 100644 --- a/gdb/common/common-types.h +++ b/gdb/common/common-types.h @@ -58,4 +58,6 @@ typedef unsigned long long ULONGEST; /* * The largest CORE_ADDR value. */ #define CORE_ADDR_MAX (~ (CORE_ADDR) 0) +enum tribool { TRIBOOL_UNKNOWN = -1, TRIBOOL_FALSE = 0, TRIBOOL_TRUE = 1 }; + #endif /* COMMON_TYPES_H */ diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h index 81b3ded..f7b45f7 100644 --- a/gdb/linux-nat.h +++ b/gdb/linux-nat.h @@ -116,7 +116,6 @@ struct lwp_info extern struct lwp_info *lwp_list; /* Does the current host support PTRACE_GETREGSET? */ -enum tribool { TRIBOOL_UNKNOWN = -1, TRIBOOL_FALSE = 0, TRIBOOL_TRUE = 1 }; extern enum tribool have_ptrace_getregset; /* Iterate over each active thread (light-weight process). */