From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7229 invoked by alias); 8 Nov 2011 06:21:42 -0000 Received: (qmail 7219 invoked by uid 22791); 8 Nov 2011 06:21:39 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM 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, 08 Nov 2011 06:21:26 +0000 Received: from nat-jpt.mentorg.com ([192.94.33.2] helo=PR1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RNf3l-0007Ub-90 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 07 Nov 2011 22:21:25 -0800 Received: from [127.0.0.1] ([172.16.63.104]) by PR1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 8 Nov 2011 15:21:23 +0900 Message-ID: <4EB8CA57.2020108@codesourcery.com> Date: Tue, 08 Nov 2011 06:21:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch 3/8] New target hook `to_can_download_tracepoint_loc' References: <4EB8C551.9090609@codesourcery.com> In-Reply-To: <4EB8C551.9090609@codesourcery.com> Content-Type: multipart/mixed; boundary="------------030703080400090002080203" 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: 2011-11/txt/msg00172.txt.bz2 This is a multi-part message in MIME format. --------------030703080400090002080203 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 365 This patch is to add a new target hook 'to_can_download_tracepoint_loc' to determine whether it is OK for remote target to receive tracepoint locations. Note that, `download_tracepoint_loc' itself can check this in lower level, but it is not efficient, and it leaves managing location's status to lower level. This patch is needed by patch 4/8. -- Yao (齐尧) --------------030703080400090002080203 Content-Type: text/x-patch; name="0003-new-target-hook-can_download_tracepoint_loc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-new-target-hook-can_download_tracepoint_loc.patch" Content-length: 3450 * target.h (struct target): New field `to_can_download_tracepoint_loc'. (target_can_download_tracepoint_loc): New macro. * target.c (update_current_target): Update. * remote.c (remote_can_download_tracepoint_loc): New. --- gdb/remote.c | 19 +++++++++++++++++++ gdb/target.c | 4 ++++ gdb/target.h | 7 +++++++ 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index c34d47b..5ba497a 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -10036,6 +10036,24 @@ remote_download_tracepoint_loc (struct bp_location *loc) } +static int +remote_can_download_tracepoint_loc () +{ + struct trace_status *ts = current_trace_status (); + int status = remote_get_trace_status (ts); + + if (status == -1 || !ts->running_known || !ts->running) + return 0; + + /* If we are in a tracing experiment, but remote stub doesn't support + installing tracepoint in trace, we have to return. */ + if (!remote_supports_install_in_trace ()) + return 0; + + return 1; +} + + static void remote_download_trace_state_variable (struct trace_state_variable *tsv) { @@ -10508,6 +10526,7 @@ Specify the serial device it is connected to\n\ remote_ops.to_supports_string_tracing = remote_supports_string_tracing; remote_ops.to_trace_init = remote_trace_init; remote_ops.to_download_tracepoint_loc = remote_download_tracepoint_loc; + remote_ops.to_can_download_tracepoint_loc = remote_can_download_tracepoint_loc; remote_ops.to_download_trace_state_variable = remote_download_trace_state_variable; remote_ops.to_enable_tracepoint = remote_enable_tracepoint; diff --git a/gdb/target.c b/gdb/target.c index 48cd888..d236530 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -675,6 +675,7 @@ update_current_target (void) INHERIT (to_supports_string_tracing, t); INHERIT (to_trace_init, t); INHERIT (to_download_tracepoint_loc, t); + INHERIT (to_can_download_tracepoint_loc, t); INHERIT (to_download_trace_state_variable, t); INHERIT (to_enable_tracepoint, t); INHERIT (to_disable_tracepoint, t); @@ -850,6 +851,9 @@ update_current_target (void) de_fault (to_download_tracepoint_loc, (int (*) (struct bp_location *)) tcomplain); + de_fault (to_can_download_tracepoint_loc, + (int (*) (void)) + return_zero); de_fault (to_download_trace_state_variable, (void (*) (struct trace_state_variable *)) tcomplain); diff --git a/gdb/target.h b/gdb/target.h index 74e1d8a..69a2a32 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -693,6 +693,10 @@ struct target_ops otherwise return 1. */ int (*to_download_tracepoint_loc) (struct bp_location *location); + /* Can the target be able to download tracepoint locations in current + status? */ + int (*to_can_download_tracepoint_loc) (void); + /* Send full details of a trace state variable to the target. */ void (*to_download_trace_state_variable) (struct trace_state_variable *tsv); @@ -1481,6 +1485,9 @@ extern int target_search_memory (CORE_ADDR start_addr, #define target_download_tracepoint_loc(t) \ (*current_target.to_download_tracepoint_loc) (t) +#define target_can_download_tracepoint_loc() \ + (*current_target.to_can_download_tracepoint_loc) () + #define target_download_trace_state_variable(tsv) \ (*current_target.to_download_trace_state_variable) (tsv) -- 1.7.0.4 --------------030703080400090002080203--