Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Restore leading zeros in remote_thread_alive
@ 2008-10-22  1:07 Michael Snyder
  2008-10-22  1:10 ` Michael Snyder
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Michael Snyder @ 2008-10-22  1:07 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

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

Hi Pedro,

VMware has a remote target for which "info threads" stopped
working after you added your remote multi-process patch in
September.  I've finally got around to figuring out why.

The docs don't actually say whether this message should have
leading zeros, but it always used to (you can check out the
old sprintf spec).

If there's no compelling reason for removing them,
do you mind if we put them back?   ;-)


[-- Attachment #2: remote_thread_alive.txt --]
[-- Type: text/plain, Size: 1356 bytes --]

2008-10-21  Michael Snyder  <msnyder@vmware.com>

	* remote.c (write_ptid): Emit leading zeros to preserve 
	remote protocol behavior of remote_thread_alive.

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.321
diff -u -p -r1.321 remote.c
--- remote.c	17 Oct 2008 19:43:47 -0000	1.321
+++ remote.c	22 Oct 2008 01:00:16 -0000
@@ -1433,15 +1433,15 @@ write_ptid (char *buf, const char *endbu
     {
       pid = ptid_get_pid (ptid);
       if (pid < 0)
-	buf += xsnprintf (buf, endbuf - buf, "p-%x.", -pid);
+	buf += xsnprintf (buf, endbuf - buf, "p-%08x.", -pid);
       else
-	buf += xsnprintf (buf, endbuf - buf, "p%x.", pid);
+	buf += xsnprintf (buf, endbuf - buf, "p%08x.", pid);
     }
   tid = ptid_get_tid (ptid);
   if (tid < 0)
-    buf += xsnprintf (buf, endbuf - buf, "-%x", -tid);
+    buf += xsnprintf (buf, endbuf - buf, "-%x08", -tid);
   else
-    buf += xsnprintf (buf, endbuf - buf, "%x", tid);
+    buf += xsnprintf (buf, endbuf - buf, "%x08", tid);
 
   return buf;
 }
@@ -2097,6 +2097,10 @@ remote_threads_info (void)
 	    {
 	      do
 		{
+		  /* Skip spaces.  */
+		  while (*bufp == ' ')
+		    bufp++;
+
 		  new_thread = read_ptid (bufp, &bufp);
 		  if (!ptid_equal (new_thread, null_ptid)
 		      && (!in_thread_list (new_thread)

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

end of thread, other threads:[~2008-10-23 19:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-22  1:07 [RFA] Restore leading zeros in remote_thread_alive Michael Snyder
2008-10-22  1:10 ` Michael Snyder
2008-10-22  1:14 ` Pedro Alves
2008-10-22  2:53 ` Daniel Jacobowitz
2008-10-22 17:43   ` Michael Snyder
2008-10-22 13:19 ` Pedro Alves
2008-10-22 14:17   ` Pedro Alves
2008-10-22 18:10     ` Michael Snyder
2008-10-23 15:39       ` Pedro Alves
2008-10-23 19:56         ` Michael Snyder

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