From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [patch 4/8] `use_agent' for remote and QAgent
Date: Mon, 23 Jan 2012 13:58:00 -0000 [thread overview]
Message-ID: <4F1D666E.4010204@codesourcery.com> (raw)
In-Reply-To: <4F1D55D7.7030506@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 164 bytes --]
This patch is to implement the to_use_agent in target_ops in remote
target. A new packet `QAgent' is added to set the flag in remote stub.
--
Yao (é½å°§)
[-- Attachment #2: 0004-impl-of-to_use_agent-for-remote.patch --]
[-- Type: text/x-patch, Size: 3729 bytes --]
gdb:
2012-01-23 Yao Qi <yao@codesourcery.com>
* remote.c (remote_use_agent): New.
(init_remote_ops): Install `remote_use_agent'.
gdb/gdbserver:
2012-01-23 Yao Qi <yao@codesourcery.com>
* server.c (handle_general_set): Handle packet 'QAgent'.
gdb/doc:
2012-01-23 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (General Query Packets): Add packet `QAgent'.
---
gdb/doc/gdb.texinfo | 12 ++++++++++++
gdb/gdbserver/server.c | 26 ++++++++++++++++++++++++++
gdb/remote.c | 18 ++++++++++++++++++
3 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 49db189..c4763d4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -34486,6 +34486,10 @@ Here are the currently defined query and set packets:
@table @samp
+@item QAgent:1
+@item QAgent:0
+Turn on or off agent as a helper.
+
@item QAllow:@var{op}:@var{val}@dots{}
@cindex @samp{QAllow} packet
Specify which operations @value{GDBN} expects to request of the
@@ -35065,6 +35069,11 @@ These are the currently defined stub features and their properties:
@tab @samp{-}
@tab No
+@item @samp{QAgent}
+@tab No
+@tab @samp{-}
+@tab No
+
@item @samp{QAllow}
@tab No
@tab @samp{-}
@@ -35198,6 +35207,9 @@ The remote stub accepts and implements the reverse step packet
The remote stub understands the @samp{QTDPsrc} packet that supplies
the source form of tracepoint definitions.
+@item QAgent
+The remote stub understaqnds the @samp{QAgent} packet.
+
@item QAllow
The remote stub understands the @samp{QAllow} packet.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index bebccf5..a5e5bbb 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -424,6 +424,8 @@ write_qxfer_response (char *buf, const void *data, int len, int is_more)
PBUFSIZ - 2) + 1;
}
+extern int use_agent;
+
/* Handle all of the extended 'Q' packets. */
static void
@@ -529,6 +531,30 @@ handle_general_set (char *own_buf)
&& handle_tracepoint_general_set (own_buf))
return;
+ if (strncmp ("QAgent:", own_buf, strlen ("QAgent:")) == 0)
+ {
+ char *mode = own_buf + strlen ("QAgent:");
+ int req = 0;
+
+ if (strcmp (mode, "0") == 0)
+ req = 0;
+ else if (strcmp (mode, "1") == 0)
+ req = 1;
+ else
+ {
+ /* We don't know what this value is, so complain to GDB. */
+ fprintf (stderr, "Unknown QAgent value requested: %s\n", own_buf);
+ write_enn (own_buf);
+ return;
+ }
+
+ /* Update the flag. */
+ use_agent = req;
+ if (remote_debug)
+ fprintf (stderr, "[%s agent]\n", req ? "Enable" : "Disable");
+ write_ok (own_buf);
+ }
+
/* Otherwise we didn't know what packet it was. Say we didn't
understand it. */
own_buf[0] = 0;
diff --git a/gdb/remote.c b/gdb/remote.c
index 60d7ecd..50bb90a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10581,6 +10581,23 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
return 1;
}
+extern int use_agent;
+
+static int
+remote_use_agent (int use)
+{
+ struct remote_state *rs = get_remote_state ();
+
+ sprintf (rs->buf, "QAgent:%d", use);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+
+ if (strcmp (rs->buf, "OK") == 0)
+ use_agent = use;
+
+ return use_agent;
+}
+
static void
init_remote_ops (void)
{
@@ -10684,6 +10701,7 @@ Specify the serial device it is connected to\n\
remote_ops.to_static_tracepoint_markers_by_strid
= remote_static_tracepoint_markers_by_strid;
remote_ops.to_traceframe_info = remote_traceframe_info;
+ remote_ops.to_use_agent = remote_use_agent;
}
/* Set up the extended remote vector by making a copy of the standard
--
1.7.0.4
next prev parent reply other threads:[~2012-01-23 13:54 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 ` Yao Qi [this message]
2012-01-23 17:17 ` [patch 4/8] `use_agent' for remote and QAgent 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 ` [patch 7/8] Agent capability for static tracepoint Yao Qi
2012-02-09 20:13 ` 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=4F1D666E.4010204@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