From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28600 invoked by alias); 23 Jan 2012 14:07:36 -0000 Received: (qmail 28592 invoked by uid 22791); 23 Jan 2012 14:07:34 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL,BAYES_50,FROM_12LTRDOM,TW_QT 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; Mon, 23 Jan 2012 14:07:22 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RpKYL-00076E-LS from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 23 Jan 2012 06:07:21 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 23 Jan 2012 06:07:21 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Mon, 23 Jan 2012 06:07:20 -0800 Message-ID: <4F1D6994.1080902@codesourcery.com> Date: Mon, 23 Jan 2012 14:29:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111220 Thunderbird/9.0 MIME-Version: 1.0 To: Subject: [patch 7/8] Agent capability for static tracepoint References: <4F1D55D7.7030506@codesourcery.com> In-Reply-To: <4F1D55D7.7030506@codesourcery.com> Content-Type: multipart/mixed; boundary="------------090402070600070907050307" 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-01/txt/msg00771.txt.bz2 --------------090402070600070907050307 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 256 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. -- Yao (齐尧) --------------090402070600070907050307 Content-Type: text/x-patch; name="0007-gdb-agent-for-static-tracepoint.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0007-gdb-agent-for-static-tracepoint.patch" Content-length: 3419 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 --------------090402070600070907050307--