From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16169 invoked by alias); 14 Jan 2014 12:37:49 -0000 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 Received: (qmail 16153 invoked by uid 89); 14 Jan 2014 12:37:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 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 ESMTP; Tue, 14 Jan 2014 12:37:48 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0ECbksd000957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 14 Jan 2014 07:37:46 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0ECbjx5028245; Tue, 14 Jan 2014 07:37:45 -0500 Message-ID: <52D52F98.1030403@redhat.com> Date: Tue, 14 Jan 2014 12:37:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Tom Tromey CC: gdb-patches@sourceware.org Subject: Re: [RFC 06/32] convert to_supports_btrace References: <1389640367-5571-1-git-send-email-tromey@redhat.com> <1389640367-5571-7-git-send-email-tromey@redhat.com> In-Reply-To: <1389640367-5571-7-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-01/txt/msg00426.txt.bz2 (Looks like the patch merge script lost the commit log of this one.) Looks good to me though. On 01/13/2014 07:12 PM, Tom Tromey wrote: > --- > gdb/common/linux-btrace.c | 4 ++-- > gdb/common/linux-btrace.h | 2 +- > gdb/gdbserver/target.h | 7 ++++--- > gdb/remote.c | 2 +- > gdb/target-delegates.c | 16 ++++++++++++++++ > gdb/target.c | 14 -------------- > gdb/target.h | 6 ++++-- > 7 files changed, 28 insertions(+), 23 deletions(-) > > diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c > index 7e20745..b3d1aaa 100644 > --- a/gdb/common/linux-btrace.c > +++ b/gdb/common/linux-btrace.c > @@ -400,7 +400,7 @@ cpu_supports_btrace (void) > /* See linux-btrace.h. */ > > int > -linux_supports_btrace (void) > +linux_supports_btrace (struct target_ops *ops) > { > static int cached; > > @@ -554,7 +554,7 @@ linux_read_btrace (struct btrace_target_info *tinfo, > /* See linux-btrace.h. */ > > int > -linux_supports_btrace (void) > +linux_supports_btrace (struct target_ops *ops) > { > return 0; > } > diff --git a/gdb/common/linux-btrace.h b/gdb/common/linux-btrace.h > index d4e8402..16c4bb1 100644 > --- a/gdb/common/linux-btrace.h > +++ b/gdb/common/linux-btrace.h > @@ -62,7 +62,7 @@ struct btrace_target_info > }; > > /* Check whether branch tracing is supported. */ > -extern int linux_supports_btrace (void); > +extern int linux_supports_btrace (struct target_ops *); > > /* Enable branch tracing for @ptid. */ > extern struct btrace_target_info *linux_enable_btrace (ptid_t ptid); > diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h > index c5e6fee..277838d 100644 > --- a/gdb/gdbserver/target.h > +++ b/gdb/gdbserver/target.h > @@ -350,7 +350,7 @@ struct target_ops > int (*supports_agent) (void); > > /* Check whether the target supports branch tracing. */ > - int (*supports_btrace) (void); > + int (*supports_btrace) (struct target_ops *); > > /* Enable branch tracing for @ptid and allocate a branch trace target > information struct for reading and for disabling branch trace. */ > @@ -488,8 +488,9 @@ int kill_inferior (int); > (the_target->supports_agent ? \ > (*the_target->supports_agent) () : 0) > > -#define target_supports_btrace() \ > - (the_target->supports_btrace ? (*the_target->supports_btrace) () : 0) > +#define target_supports_btrace() \ > + (the_target->supports_btrace \ > + ? (*the_target->supports_btrace) (the_target) : 0) > > #define target_enable_btrace(ptid) \ > (*the_target->enable_btrace) (ptid) > diff --git a/gdb/remote.c b/gdb/remote.c > index a91e6aa..6f3fc91 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -11340,7 +11340,7 @@ struct btrace_target_info > /* Check whether the target supports branch tracing. */ > > static int > -remote_supports_btrace (void) > +remote_supports_btrace (struct target_ops *self) > { > if (remote_protocol_packets[PACKET_Qbtrace_off].support != PACKET_ENABLE) > return 0; > diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c > index 484945f..77f3113 100644 > --- a/gdb/target-delegates.c > +++ b/gdb/target-delegates.c > @@ -122,6 +122,19 @@ tdefault_xfer_partial (struct target_ops *self, enum target_object arg1, const > return -1; > } > > +static int > +delegate_supports_btrace (struct target_ops *self) > +{ > + self = self->beneath; > + return self->to_supports_btrace (self); > +} > + > +static int > +tdefault_supports_btrace (struct target_ops *self) > +{ > + return 0; > +} > + > static void > install_delegators (struct target_ops *ops) > { > @@ -147,6 +160,8 @@ install_delegators (struct target_ops *ops) > ops->to_async = delegate_async; > if (ops->to_xfer_partial == NULL) > ops->to_xfer_partial = delegate_xfer_partial; > + if (ops->to_supports_btrace == NULL) > + ops->to_supports_btrace = delegate_supports_btrace; > } > > static void > @@ -163,4 +178,5 @@ install_dummy_methods (struct target_ops *ops) > ops->to_is_async_p = find_default_is_async_p; > ops->to_async = tdefault_async; > ops->to_xfer_partial = tdefault_xfer_partial; > + ops->to_supports_btrace = tdefault_supports_btrace; > } > diff --git a/gdb/target.c b/gdb/target.c > index 0f614bf..6fc95fc 100644 > --- a/gdb/target.c > +++ b/gdb/target.c > @@ -4090,20 +4090,6 @@ target_ranged_break_num_registers (void) > > /* See target.h. */ > > -int > -target_supports_btrace (void) > -{ > - struct target_ops *t; > - > - for (t = current_target.beneath; t != NULL; t = t->beneath) > - if (t->to_supports_btrace != NULL) > - return t->to_supports_btrace (); > - > - return 0; > -} > - > -/* See target.h. */ > - > struct btrace_target_info * > target_enable_btrace (ptid_t ptid) > { > diff --git a/gdb/target.h b/gdb/target.h > index 538bdf4..d1fa12f 100644 > --- a/gdb/target.h > +++ b/gdb/target.h > @@ -854,7 +854,8 @@ struct target_ops > int (*to_can_use_agent) (void); > > /* Check whether the target supports branch tracing. */ > - int (*to_supports_btrace) (void); > + int (*to_supports_btrace) (struct target_ops *) > + TARGET_DEFAULT_RETURN (0); > > /* Enable branch tracing for PTID and allocate a branch trace target > information struct for reading and for disabling branch trace. */ > @@ -1988,7 +1989,8 @@ extern void update_target_permissions (void); > void target_ignore (void); > > /* See to_supports_btrace in struct target_ops. */ > -extern int target_supports_btrace (void); > +#define target_supports_btrace() \ > + (current_target.to_supports_btrace (¤t_target)) > > /* See to_enable_btrace in struct target_ops. */ > extern struct btrace_target_info *target_enable_btrace (ptid_t ptid); > -- Pedro Alves