This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
regression in remote.c in remote_threads_info for qfThreadInfo/qsThreadInfowith the introduction of read_ptid
- From: Andrew Sutherland <sombrero at alum dot mit dot edu>
- To: archer at sourceware dot org
- Date: Wed, 09 Sep 2009 22:25:17 -0700
- Subject: regression in remote.c in remote_threads_info for qfThreadInfo/qsThreadInfowith the introduction of read_ptid
The use of read_ptid replaced use of strtoul. strtoul eats leading
whitespace, read_ptid does not.
The protocol documentation explicitly provides for the existence of
whitespace: `m thread-id' and `m thread-id,thread-id...'
I believe the following patch solves the problem without any ill
effects. My fix, however, is localized to remote_threads_info and so
would not deal with any other regressions.
Patch:
====
diff --git a/gdb/remote.c b/gdb/remote.c
index 4c58abb..310c8f7 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2239,6 +2239,9 @@ remote_threads_info (struct target_ops *ops)
{
while (*bufp++ == 'm') /* reply contains one or more
TID */
{
+ if (*bufp == ' ')
+ bufp++;
+
do
{
new_thread = read_ptid (bufp, &bufp);
===
Origin of the problem:
Offending commit: b34f362bd3708bb786d64dc819ad2b4b1f84f55f
gitweb:
http://sourceware.org/git/gitweb.cgi?p=archer.git;a=commit;h=b34f362bd3708bb786d64dc819ad2b4b1f84f55f
hunk before the patch:
http://sourceware.org/git/gitweb.cgi?p=archer.git;a=blob;f=gdb/remote.c;h=3433e9d2ffed5f77b0035722b76e77c234df376e;hb=3433e9d2ffed5f77b0035722b76e77c234df376e#l1971
hunk after the patch:
http://sourceware.org/git/gitweb.cgi?p=archer.git;a=blob;f=gdb/remote.c;h=dfae2f68386662a52e3c26b424596010ea229d52;hb=dfae2f68386662a52e3c26b424596010ea229d52#l2056
Andrew