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]

[RFA] fix minor bug in malformed packet error message


This patch fixes a minor bug in malformed packet error messages.
The error message tries to print the start of where things go bad,
but due to the `*p++ != mumble' test the ++ causes the first character
character to be missed.

ok to check in?

2008-06-09  Doug Evans  <dje@google.com>

	* remote.c (remote_wait): Include beginning of malformed packet
	in error output.

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.295
diff -u -p -u -p -r1.295 remote.c
--- remote.c	5 Jun 2008 21:35:00 -0000	1.295
+++ remote.c	9 Jun 2008 18:28:16 -0000
@@ -3487,10 +3487,11 @@ Packet: '%s'\n"),
 		    struct packet_reg *reg = packet_reg_from_pnum (rsa, pnum);
 		    p = p1;
 
-		    if (*p++ != ':')
+		    if (*p != ':')
 		      error (_("Malformed packet(b) (missing colon): %s\n\
 Packet: '%s'\n"),
 			     p, buf);
+                    ++p;
 
 		    if (reg == NULL)
 		      error (_("Remote sent bad register number %s: %s\n\
@@ -3508,9 +3509,10 @@ Packet: '%s'\n"),
 					 reg->regnum, regs);
 		  }
 
-		if (*p++ != ';')
+		if (*p != ';')
 		  error (_("Remote register badly formatted: %s\nhere: %s"),
 			 buf, p);
+                ++p;
 	      }
 	  }
 	  /* fall through */


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