Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] Fix qC handling in gdbserver
@ 2007-04-27 10:27 Markus Deuling
  2007-04-27 10:37 ` Pedro Alves
  2007-04-27 13:27 ` Daniel Jacobowitz
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Deuling @ 2007-04-27 10:27 UTC (permalink / raw)
  To: GDB Patches

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Hi,

I had some regressions when running the testsuite on x86 via gdbserver 
and began to look at it. Some FAILs occur because the testcases cannot 
be run via gdbserver (eg. follow fork because we dont have that in 
gdbserver). I'll come up with a patch for the testcases.

When looking at gdb.base/info-proc.exp I found a bug in remote target.

GDB tries to get the initial pid after "target remote :<port>". It does
that by set_thread (-1, 0), which results in a "Hc-1" packet. On 
gdbserver side each Hc packet with '0' or '1' results in E01 packet as 
reply.

Later on remote_current_thread (inferior_ptid); is called which always 
comes back with MAGIC_NULL_PID. The reason for that is the missing 
support for 'qC' packets in gdbserver. Manual says the reply for qC
is 'QC pid'. If no pid returns MAGIC_NULL_PID is taken.

Because of that 'info proc' is broken directly after connecting to
gdbserver (it tries to access /proc/42000), thats why the testcase failes.

This patch adds handling for qC packets in gdbserver and removes the
unnecessary set_thread() call.

Is this ok to commit?

ChangeLog:

	* gdbserver/server.c (handle_query): Add handling for qC
	  packets.
	* remote.c (remote_start_remote): Remove useless set_thread.




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


[-- Attachment #2: diff_gdbserver_fix --]
[-- Type: text/plain, Size: 1127 bytes --]

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 09:36:47.000000000 +0200
@@ -259,6 +259,14 @@
 {
   static struct inferior_list_entry *thread_ptr;
 
+  /* Reply the current thread id.  */
+  if (own_buf[0] == 'q' && own_buf[1] == 'C')
+    {
+      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 09:40:33.000000000 +0200
@@ -2096,9 +2100,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.  */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-15 13:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-27 10:27 [rfc] Fix qC handling in gdbserver Markus Deuling
2007-04-27 10:37 ` Pedro Alves
2007-04-27 11:05   ` Markus Deuling
2007-04-27 13:27 ` Daniel Jacobowitz
2007-05-02 16:18   ` Markus Deuling
2007-05-14 17:41     ` Daniel Jacobowitz
2007-05-15 13:18     ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox