Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [patch 7/8] Agent capability for static tracepoint
Date: Mon, 23 Jan 2012 14:29:00 -0000	[thread overview]
Message-ID: <4F1D6994.1080902@codesourcery.com> (raw)
In-Reply-To: <4F1D55D7.7030506@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

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 (齐尧)

[-- Attachment #2: 0007-gdb-agent-for-static-tracepoint.patch --]
[-- Type: text/x-patch, Size: 3419 bytes --]


2012-01-23  Yao Qi  <yao@codesourcery.com>

	* 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 <signal.h>
 
+IP_AGENT_EXPORT int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE;
+
 static void
 gdb_ust_init (void)
 {
-- 
1.7.0.4


  parent reply	other threads:[~2012-01-23 14:07 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 13:37 [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-01-23 13:48 ` [patch 1/8] Generalize interaction with agent in gdb/gdbserver Yao Qi
2012-01-30 11:25   ` Yao Qi
2012-02-09 19:21   ` Pedro Alves
2012-02-14  2:41     ` Yao Qi
2012-02-14 10:16       ` Pedro Alves
2012-01-23 13:50 ` [patch 2/8] Add to_use_agent in target_ops Yao Qi
2012-02-09 19:36   ` Pedro Alves
2012-01-23 13:54 ` [patch 3/8] Command `set agent on|off' Yao Qi
2012-01-23 17:14   ` Eli Zaretskii
2012-01-24  0:28     ` Yao Qi
2012-01-24  5:54       ` Eli Zaretskii
2012-01-26  1:32         ` Yao Qi
2012-02-09 20:19   ` Pedro Alves
2012-01-23 13:58 ` [patch 4/8] `use_agent' for remote and QAgent Yao Qi
2012-01-23 17:17   ` Eli Zaretskii
2012-01-26  2:17     ` Yao Qi
2012-01-26 17:43       ` Eli Zaretskii
2012-02-09 19:55   ` Pedro Alves
2012-01-23 14:03 ` [patch 5/8] Doc for agent Yao Qi
2012-01-23 18:12   ` Eli Zaretskii
2012-01-24  0:51     ` Yao Qi
2012-01-24  8:04       ` Eli Zaretskii
2012-01-26  1:53         ` Yao Qi
2012-01-26 17:15           ` Eli Zaretskii
2012-02-09 19:55   ` Pedro Alves
2012-02-10 13:30     ` Yao Qi
2012-02-10 15:01       ` Pedro Alves
2012-02-10 16:18         ` Yao Qi
2012-02-10 16:28           ` Pedro Alves
2012-02-23  7:51             ` Yao Qi
2012-02-23 19:50               ` Pedro Alves
2012-01-23 14:07 ` [patch 6/8] Agent's capability Yao Qi
2012-01-24  3:49   ` Yao Qi
2012-02-09 20:09   ` Pedro Alves
2012-02-10 12:25     ` Yao Qi
2012-02-10 12:37       ` Pedro Alves
2012-02-10 13:07         ` Yao Qi
2012-01-23 14:29 ` Yao Qi [this message]
2012-02-09 20:13   ` [patch 7/8] Agent capability for static tracepoint Pedro Alves
2012-02-10 14:29     ` Yao Qi
2012-02-10 14:56       ` Pedro Alves
2012-01-23 16:03 ` [patch 8/8] Control agent in testsuite Yao Qi
2012-02-09 20:16   ` Pedro Alves
2012-02-05  4:32 ` [ping] [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-02-09 19:02 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F1D6994.1080902@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox