From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8124 invoked by alias); 27 Apr 2007 08:02:47 -0000 Received: (qmail 8116 invoked by uid 22791); 27 Apr 2007 08:02:45 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate2.de.ibm.com (HELO mtagate2.de.ibm.com) (195.212.29.151) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 27 Apr 2007 09:02:42 +0100 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate2.de.ibm.com (8.13.8/8.13.8) with ESMTP id l3R82coX071072 for ; Fri, 27 Apr 2007 08:02:38 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l3R82c133756064 for ; Fri, 27 Apr 2007 10:02:38 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l3R82b99023298 for ; Fri, 27 Apr 2007 10:02:38 +0200 Received: from [9.152.248.44] (dyn-9-152-248-44.boeblingen.de.ibm.com [9.152.248.44]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l3R82Z7S023244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 Apr 2007 10:02:37 +0200 Message-ID: <4631ADC8.6000603@de.ibm.com> Date: Fri, 27 Apr 2007 10:27:00 -0000 From: Markus Deuling User-Agent: Thunderbird 1.5.0.10 (X11/20070301) MIME-Version: 1.0 To: GDB Patches Subject: [rfc] Fix qC handling in gdbserver Content-Type: multipart/mixed; boundary="------------070003050701070101030005" 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: 2007-04/txt/msg00352.txt.bz2 This is a multi-part message in MIME format. --------------070003050701070101030005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1319 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 :". 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 --------------070003050701070101030005 Content-Type: text/plain; name="diff_gdbserver_fix" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff_gdbserver_fix" Content-length: 1127 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. */ --------------070003050701070101030005--