This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,gdbserver] Put 'multiprocess+' in to qSupported reply if GDB supports multiprocess


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]