m68k-stub.c patch, putpacket should wait for ACK.

J.T. Conklin jtc@redbacknetworks.com
Fri Mar 5 19:00:00 GMT 1999


The enclosed patch fixes a problem with m68k-stub.c, putpacket() only
gave GDB one chance to receive the packet --- it did not wait until a
ACK/NACK packet was received.  Granted, the target will "hang" if the
ACK or NACK is lost, but that's a deficiency in the protocol shared by
all targets.  IMO, it's better that the putpacket() implementation of
all the sample stubs be the same.  This change brings them closer
together (the sh stub is the only one that currently implements run
length compression).

1999-03-05  J.T. Conklin  <jtc@redbacknetworks.com>

	* m68k-stub.c (putpacket): Restore code so that packets are sent
 	until an ACK is received.

Index: m68k-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/m68k-stub.c,v
retrieving revision 1.2
diff -c -r1.2 m68k-stub.c
*** m68k-stub.c	1998/12/03 19:55:51	1.2
--- m68k-stub.c	1999/03/06 02:50:29
***************
*** 588,610 ****
    char ch;
    
    /*  $<packet info>#<checksum>. */
!   do {
!   putDebugChar('$');
!   checksum = 0;
!   count    = 0;
!   
!   while (ch=buffer[count]) {
!     putDebugChar(ch);
!     checksum += ch;
!     count += 1;
!   }
!   
!   putDebugChar('#');
!   putDebugChar(hexchars[checksum >> 4]);
!   putDebugChar(hexchars[checksum % 16]);
  
!   } while (1 == 0);  /* (getDebugChar() != '+'); */
!   
  }
  
  char  remcomInBuffer[BUFMAX];
--- 588,612 ----
    char ch;
    
    /*  $<packet info>#<checksum>. */
!   do 
!     {
!       putDebugChar('$');
!       checksum = 0;
!       count = 0;
!     
!       while (ch=buffer[count]) 
! 	{
! 	  putDebugChar(ch);
! 	  checksum += ch;
! 	  count += 1;
! 	}
!     
!       putDebugChar('#');
!       putDebugChar(hexchars[checksum >> 4]);
!       putDebugChar(hexchars[checksum % 16]);
  
!     }
!   while ((getDebugChar() & 0x7f) != '+');
  }
  
  char  remcomInBuffer[BUFMAX];




-- 
J.T. Conklin
RedBack Networks



More information about the Gdb-patches mailing list