2000-08-20 Michael Chastain <chastain@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Thu, 24 Aug 2000 10:48:22 +0000 (10:48 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 24 Aug 2000 10:48:22 +0000 (10:48 +0000)
      * remote.c (read_frame): Handle SERIAL_TIMEOUT while reading
      checksum.

gdb/ChangeLog
gdb/remote.c

index 8ec20e07db4af1ed6cd67da2a5a5c6c3513502f0..1cc9633e2f5e48d61e82dff90848b147d34d2cf3 100644 (file)
@@ -1,3 +1,8 @@
+2000-08-20  Michael Chastain  <chastain@redhat.com>
+
+        * remote.c (read_frame): Handle SERIAL_TIMEOUT while reading
+       checksum.
+
 2000-08-23  Kevin Buettner  <kevinb@redhat.com>
 
        * dstread.c (dst_symfile_offsets): Protoize.
index 66a14fa3de081ec76c6f52600186a0c364ca2704..9a6e2f93c052676be7c910fa2a4fb3ef609f98f1 100644 (file)
@@ -3871,12 +3871,25 @@ read_frame (char *buf,
        case '#':
          {
            unsigned char pktcsum;
+           int check_0 = 0;
+           int check_1 = 0;
 
            buf[bc] = '\0';
 
-           pktcsum = fromhex (readchar (remote_timeout)) << 4;
-           pktcsum |= fromhex (readchar (remote_timeout));
+           check_0 = readchar (remote_timeout);
+           if (check_0 >= 0)
+             check_1 = readchar (remote_timeout);
+           
+           if (check_0 == SERIAL_TIMEOUT || check_1 == SERIAL_TIMEOUT)
+             {
+               if (remote_debug)
+                 fputs_filtered ("Timeout in checksum, retrying\n", gdb_stdlog);
+               return -1;
+             }
+           else if (check_0 < 0 || check_1 < 0)
+             error ("Communication error in checksum");
 
+           pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
            if (csum == pktcsum)
               return bc;