RFA: Patch to remote.c - Fix to recovery from lost ACK

Fernando Nasser fnasser@cygnus.com
Fri Sep 15 13:59:00 GMT 2000


Andrew and me were looking at this code and we saw something that did not looked
right.  I created this patch that I think straights things up.

2000-09-15  Fernando Nasser  <fnasser@totem.to.cygnus.com>

	* remote.c (putpkt_binary): Call read_frame, not getpkt. Log message.
	(read_frame): Do not call error() on communication error when
	reading checksum, but return failure instead and log message.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@cygnus.com



Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.23
diff -c -p -r1.23 remote.c
*** remote.c    2000/09/01 00:12:10     1.23
--- remote.c    2000/09/15 20:48:13
*************** putpkt_binary (char *buf, int cnt)
*** 3796,3804 ****
              break;            /* Retransmit buffer */
            case '$':
              {
                /* It's probably an old response, and we're out of sync.
                   Just gobble up the packet and ignore it.  */
!               getpkt (junkbuf, sizeof_junkbuf, 0);
                continue;       /* Now, go look for + */
              }
            default:
--- 3796,3806 ----
              break;            /* Retransmit buffer */
            case '$':
              {
+               if (remote_debug)
+                 fprintf_unfiltered (gdb_stdlog, "Packet instead of Ack, ignoring it\n");
                /* It's probably an old response, and we're out of sync.
                   Just gobble up the packet and ignore it.  */
!               read_frame (junkbuf, sizeof_junkbuf);
                continue;       /* Now, go look for + */
              }
            default:
*************** read_frame (char *buf,
*** 3887,3893 ****
                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)
--- 3889,3899 ----
                return -1;
              }
            else if (check_0 < 0 || check_1 < 0)
!             {
!               if (remote_debug)
!                 fputs_filtered ("Communication error in checksum\n", gdb_stdlog);
!               return -1;
!             }
  
            pktcsum = (fromhex (check_0) << 4) | fromhex (check_1);
            if (csum == pktcsum)


More information about the Gdb-patches mailing list