From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20624 invoked by alias); 26 Jan 2012 01:53:51 -0000 Received: (qmail 20615 invoked by uid 22791); 26 Jan 2012 01:53:50 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,TW_AQ,TW_QN 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; Thu, 26 Jan 2012 01:53:30 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1RqEWm-0002tD-Uj from Yao_Qi@mentor.com ; Wed, 25 Jan 2012 17:53:28 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 25 Jan 2012 17:53:28 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Wed, 25 Jan 2012 17:53:28 -0800 Message-ID: <4F20B216.9020104@codesourcery.com> Date: Thu, 26 Jan 2012 02:17: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: Eli Zaretskii CC: Subject: Re: [patch 4/8] `use_agent' for remote and QAgent References: <4F1D55D7.7030506@codesourcery.com> <4F1D666E.4010204@codesourcery.com> <838vky2vdf.fsf@gnu.org> In-Reply-To: <838vky2vdf.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------080107030601060900030305" 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/msg00882.txt.bz2 --------------080107030601060900030305 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Content-length: 287 On 01/24/2012 01:15 AM, Eli Zaretskii wrote: > Same here: it's not clear what does "helper" mean. At the very least, > there should be a cross-reference to where this is described in the > manual. I add some words here, and a cross-reference to node "Control Agent". -- Yao (齐尧) --------------080107030601060900030305 Content-Type: text/x-patch; name="0004-impl-of-to_use_agent-for-remote.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0004-impl-of-to_use_agent-for-remote.patch" Content-length: 3825 gdb: 2012-01-25 Yao Qi * remote.c (remote_use_agent): New. (init_remote_ops): Install `remote_use_agent'. gdb/gdbserver: 2012-01-25 Yao Qi * server.c (handle_general_set): Handle packet 'QAgent'. gdb/doc: 2012-01-25 Yao Qi * gdb.texinfo (General Query Packets): Add packet `QAgent'. --- gdb/doc/gdb.texinfo | 13 +++++++++++++ gdb/gdbserver/server.c | 26 ++++++++++++++++++++++++++ gdb/remote.c | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+), 0 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 49db189..3cd8398 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -34486,6 +34486,11 @@ Here are the currently defined query and set packets: @table @samp +@item QAgent:1 +@item QAgent:0 +Turn on or off the agent as a helper to perform some debugging operations +delegated from @value{GDBN}. (@pxref{Control Agent}) + @item QAllow:@var{op}:@var{val}@dots{} @cindex @samp{QAllow} packet Specify which operations @value{GDBN} expects to request of the @@ -35065,6 +35070,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 +35208,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 --------------080107030601060900030305--