From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH,gdbserver] Put 'multiprocess+' in to qSupported reply if GDB supports multiprocess
Date: Tue, 15 Jan 2013 09:02:00 -0000 [thread overview]
Message-ID: <1358240468-11484-1-git-send-email-yao@codesourcery.com> (raw)
GDBserver put 'multiprocess+' in to qSupported reply regardless of
whether GDB supports multiprocess. It doesn't cause any problems
because if GDB doesn't support multiprocess, GDB doesn't understand
'multiprocess+'. However, I feel it is better not to send
'multiprocess+' to GDB if GDB doesn't support multiprocess.
In this patch, GDBserver only sends 'multiprocess+' back to GDB if
both GDB and the target of GDBserver supports multiprocess. Beside
this change, this patch also add a new struct 'gdb_supports' to
represent various features GDB supports. (it paves the way for my
patches on querying supported notifications.)
Regression tested with board file native-gdbserver,
native-extended-gdbserver and unix on x86_64-linux. Is it OK to
apply?
gdb/gdbserver:
2013-01-15 Yao Qi <yao@codesourcery.com>
* server.c (handle_query): New 'struct gdb_supports'.
Update. Set 'gdb_supports.multi_process' if GDB supports
multiprocess.
Add 'multiprocess+' to the reply if both GDBserver target
and GDB support multiprocess.
---
gdb/gdbserver/server.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 4af9436..b149a1b 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1527,7 +1527,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
&& (own_buf[10] == ':' || own_buf[10] == '\0'))
{
char *p = &own_buf[10];
- int gdb_supports_qRelocInsn = 0;
+ /* Features that GDB support. */
+ struct gdb_supports
+ {
+ int qRelocInsn;
+ int multi_process;
+ } gdb_supports = { 0, 0 };
/* Start processing qSupported packet. */
target_process_qsupported (NULL);
@@ -1559,13 +1564,14 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
{
/* GDB supports and wants multi-process support if
possible. */
+ gdb_supports.multi_process = 1;
if (target_supports_multi_process ())
multi_process = 1;
}
else if (strcmp (p, "qRelocInsn+") == 0)
{
/* GDB supports relocate instruction requests. */
- gdb_supports_qRelocInsn = 1;
+ gdb_supports.qRelocInsn = 1;
}
else
target_process_qsupported (p);
@@ -1613,7 +1619,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
if (the_target->qxfer_osdata != NULL)
strcat (own_buf, ";qXfer:osdata:read+");
- if (target_supports_multi_process ())
+ if (gdb_supports.multi_process
+ && target_supports_multi_process ())
strcat (own_buf, ";multiprocess+");
if (target_supports_non_stop ())
@@ -1630,7 +1637,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcat (own_buf, ";TraceStateVariables+");
strcat (own_buf, ";TracepointSource+");
strcat (own_buf, ";DisconnectedTracing+");
- if (gdb_supports_qRelocInsn && target_supports_fast_tracepoints ())
+ if (gdb_supports.qRelocInsn && target_supports_fast_tracepoints ())
strcat (own_buf, ";FastTracepoints+");
strcat (own_buf, ";StaticTracepoints+");
strcat (own_buf, ";InstallInTrace+");
--
1.7.7.6
next reply other threads:[~2013-01-15 9:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 9:02 Yao Qi [this message]
2013-01-15 19:55 ` Pedro Alves
2013-01-16 8:31 ` Yao Qi
2013-01-16 18:18 ` 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=1358240468-11484-1-git-send-email-yao@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