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]

Re: [rfc] Fix qC handling in gdbserver


Hi Pedro,

Pedro Alves wrote:
All the other tests in the function seem to check for an
extra '\0', ',' or ':' after the query name.  Shouldn't you do the
same here?  Otherwise you are answering
to all future queries starting with qC (Think or a gdbserver
installed in rom in a board in the field, and connecting
to it with gdb-cvs2020 :) )

yes, your're right. I changed the patch to use strcmp now. I just
wanted to save the overhead of a function call for two characters. But I would have missed qC<whatever> :-)


Thanks for review!


-- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com

diff -urN src/gdb/gdbserver/server.c dev/gdb/gdbserver/server.c
--- src/gdb/gdbserver/server.c	2007-03-29 05:37:17.000000000 +0200
+++ dev/gdb/gdbserver/server.c	2007-04-27 12:31:45.000000000 +0200
@@ -259,6 +259,14 @@
 {
   static struct inferior_list_entry *thread_ptr;
 
+  /* Reply the current thread id.  */
+  if (strcmp ("qC", own_buf) == 0)
+    {
+      sprintf (own_buf, "QC %lx", 
+        ((struct inferior_list_entry *) current_inferior)->id);
+      return;
+    }
+
   if (strcmp ("qSymbol::", own_buf) == 0)
     {
       if (the_target->look_up_symbols != NULL)
diff -urN src/gdb/remote.c dev/gdb/remote.c
--- src/gdb/remote.c	2007-03-28 05:42:54.000000000 +0200
+++ dev/gdb/remote.c	2007-04-27 12:29:21.000000000 +0200
@@ -2096,9 +2096,7 @@
   /* Ack any packet which the remote side has already sent.  */
   serial_write (remote_desc, "+", 1);
 
-  /* Let the stub know that we want it to return the thread.  */
-  set_thread (-1, 0);
-
+  /* Get the pid of the first thread.  */
   inferior_ptid = remote_current_thread (inferior_ptid);
 
   get_offsets ();		/* Get text, data & bss offsets.  */

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