From: Markus Deuling <deuling@de.ibm.com>
To: GDB Patches <gdb-patches@sourceware.org>
Subject: [rfc] Fix qC handling in gdbserver
Date: Fri, 27 Apr 2007 10:27:00 -0000 [thread overview]
Message-ID: <4631ADC8.6000603@de.ibm.com> (raw)
[-- 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. */
next reply other threads:[~2007-04-27 8:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-27 10:27 Markus Deuling [this message]
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
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=4631ADC8.6000603@de.ibm.com \
--to=deuling@de.ibm.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