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]

Fix parsing of qL reply


GDB has two ways to ask remote target for a list
of threads -- qThreadInfo and qL, the latter is
being used if the former is not supported. However,
if qL is not supported either, gdb will not notice,
offset 2 bytes into empty string, and start to
parse the resulting random data.

This patch fixes the problem. Approved off-list by
Dan and checked in.

- Volodya

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.9172
diff -u -p -r1.9172 ChangeLog
--- gdb/ChangeLog	23 Feb 2008 20:04:19 -0000	1.9172
+++ gdb/ChangeLog	25 Feb 2008 09:58:05 -0000
@@ -1,3 +1,9 @@
+2008-02-25  Vladimir Prus  <vladimir@codesourcery.com>
+
+       * remote.c (remote_get_threadlist): If the response
+       is empty, don't try to parse it.
+
 2008-02-23  Vladimir Prus  <vladimir@codesourcery.com>
 
 	Unbreak 'target async'.
Index: gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.279
diff -u -p -r1.279 remote.c
--- gdb/remote.c	21 Feb 2008 17:26:16 -0000	1.279
+++ gdb/remote.c	25 Feb 2008 09:58:07 -0000
@@ -1740,9 +1740,12 @@ remote_get_threadlist (int startflag, th
   putpkt (rs->buf);
   getpkt (&rs->buf, &rs->buf_size, 0);
 
-  *result_count =
-    parse_threadlist_response (rs->buf + 2, result_limit, &echo_nextthread,
-			       threadlist, done);
+  if (*rs->buf == '\0')
+    *result_count = 0;
+  else
+    *result_count =
+      parse_threadlist_response (rs->buf + 2, result_limit, &echo_nextthread,
+                                 threadlist, done);
 
   if (!threadmatch (&echo_nextthread, nextthread))
     {

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