[gnu.gdb.bug] gdb hangs forever when a remote system is not responding

glenne%hplsla@HP-SDE.SDE.HP.COM (Glenn Engel) (03/17/89)

When using gdb3.1.2 to attach to a remote system, it can hang forever waiting
for a response from the remote system.  Control-C does not interrupt.

The patch below fixes this problem.  These patches were applied on top
of previous patches I sent in for remote.c.  The changes are in the
getpkt() function.

--
 |  Glenn R. Engel
 |  Hewlett-Packard 
 |  (206) 335-2066
 |  glenne%hplsla@hplabs.hp.com


*** remote.c.orig	Thu Mar 16 08:03:47 1989
--- remote.c	Thu Mar 16 08:30:09 1989
***************
*** 498,503
    int c;
    unsigned char c1, c2;
    extern kiodebug;
  
    while (1)
      {

--- 498,505 -----
    int c;
    unsigned char c1, c2;
    extern kiodebug;
+   /* allow immediate quit while reading from device,  it could be hung */
+   immediate_quit++;
  
    while (1)
      {
***************
*** 527,532
        write (remote_desc, "-", 1);
      }
  
    write (remote_desc, "+", 1);
  
    if (kiodebug)

--- 529,536 -----
        write (remote_desc, "-", 1);
      }
  
+   immediate_quit--;
+   
    write (remote_desc, "+", 1);
  
    if (kiodebug)