From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7465 invoked by alias); 9 Feb 2012 20:13:30 -0000 Received: (qmail 7452 invoked by uid 22791); 9 Feb 2012 20:13:27 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_QT,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 20:13:13 +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 q19KD9eX004984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 Feb 2012 15:13:09 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q19KD8JO025487; Thu, 9 Feb 2012 15:13:08 -0500 Message-ID: <4F3428D4.5060202@redhat.com> Date: Thu, 09 Feb 2012 20:13:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [patch 7/8] Agent capability for static tracepoint References: <4F1D55D7.7030506@codesourcery.com> <4F1D6994.1080902@codesourcery.com> In-Reply-To: <4F1D6994.1080902@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-02/txt/msg00162.txt.bz2 On 01/23/2012 02:07 PM, Yao Qi wrote: > Current libinproctrace.so agent is able to do operations on static > tracepoint, which can be treated as one capability. This patch is to > teach gdbserver to check agent's capability when performing operations > related to static tracepoint. > Hmm, not sure. Why aren't these being hooked at the same places where we already check/call maybe_write_ipa_ust_not_loaded and in_process_agent_loaded_ust? > -- Yao (齐尧) > > > 0007-gdb-agent-for-static-tracepoint.patch > > > 2012-01-23 Yao Qi > > * tracepoint.c (gdb_agent_capability): New global. > (clear_installed_tracepoints): Check whether agent has capability > for static tracepoint. > (install_tracepoint): Likewise. > (cmd_qtstart): Likewise. > (handle_tracepoint_query): Likewise. > --- > gdb/gdbserver/tracepoint.c | 68 +++++++++++++++++++++++++++++-------------- > 1 files changed, 46 insertions(+), 22 deletions(-) > > diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c > index 7f462bc..9527d74 100644 > --- a/gdb/gdbserver/tracepoint.c > +++ b/gdb/gdbserver/tracepoint.c > @@ -2314,7 +2314,11 @@ clear_installed_tracepoints (void) > ; > else > { > - unprobe_marker_at (tpoint->address); > + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0) > + warning ("Agent does not have capability" > + "for static tracepoint."); > + else > + unprobe_marker_at (tpoint->address); > prev_stpoint = tpoint; > } > break; > @@ -2989,8 +2993,8 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf) > } > else > { > - if (tp) > - tpoint->handle = (void *) -1; > + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0) > + warning ("Agent does not have capability for static tracepoint."); > else > { > if (probe_marker_at (tpoint->address, own_buf) == 0) > @@ -3094,13 +3098,19 @@ cmd_qtstart (char *packet) > } > else > { > - if (probe_marker_at (tpoint->address, packet) == 0) > + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0) > + warning ("Agent does not have capability" > + "for static tracepoint."); > + else > { > - tpoint->handle = (void *) -1; > - > - /* So that we can handle multiple static tracepoints > - at the same address easily. */ > - prev_stpoint = tpoint; > + if (probe_marker_at (tpoint->address, packet) == 0) > + { > + tpoint->handle = (void *) -1; > + > + /* So that we can handle multiple static tracepoints > + at the same address easily. */ > + prev_stpoint = tpoint; > + } > } > } > } > @@ -3968,20 +3978,32 @@ handle_tracepoint_query (char *packet) > cmd_qtbuffer (packet); > return 1; > } > - else if (strcmp ("qTfSTM", packet) == 0) > - { > - cmd_qtfstm (packet); > - return 1; > - } > - else if (strcmp ("qTsSTM", packet) == 0) > + else if (strcmp ("qTfSTM", packet) == 0 || strcmp ("qTsSTM", packet) == 0 > + || strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0) > { > - cmd_qtsstm (packet); > - return 1; > - } > - else if (strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0) > - { > - cmd_qtstmat (packet); > - return 1; > + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0) > + { > + warning ("Agent does not have capability for static tracepoint."); > + return 0; > + } > + else > + { > + if (strcmp ("qTfSTM", packet) == 0) > + { > + cmd_qtfstm (packet); > + return 1; > + } > + else if (strcmp ("qTsSTM", packet) == 0) > + { > + cmd_qtsstm (packet); > + return 1; > + } > + else if (strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0) > + { > + cmd_qtstmat (packet); > + return 1; > + } > + } > } > else if (strcmp ("qTMinFTPILen", packet) == 0) > { > @@ -7986,6 +8008,8 @@ gdb_ust_thread (void *arg) > > #include > > +IP_AGENT_EXPORT int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE; > + > static void > gdb_ust_init (void) > { > -- 1.7.0.4 -- Pedro Alves