* tm-rs6000.h (AIX_BUGGY_PTRACE_CALL): Zap, we think we fixed it.
[deliverable/binutils-gdb.git] / gdb / remote.c
index f8372db58b9dd7f52be4d4ca03466b939b0dc3d8..03d4deeb093d29653b412ae4165f6273ad7d85a6 100644 (file)
@@ -416,11 +416,12 @@ remote_wait (status)
   void (*ofunc)();
   unsigned char *p;
   int i;
-  char regs[REGISTER_RAW_SIZE (PC_REGNUM) + REGISTER_RAW_SIZE (FP_REGNUM)];
+  int regno;
+  unsigned char regs[8];       /* Better be big enough for largest reg */
 
   WSETEXIT ((*status), 0);
 
-  ofunc = (void (*)) signal (SIGINT, remote_interrupt);
+  ofunc = (void (*)()) signal (SIGINT, remote_interrupt);
   getpkt ((char *) buf);
   signal (SIGINT, ofunc);
 
@@ -428,17 +429,27 @@ remote_wait (status)
     error ("Remote failure reply: %s", buf);
   if (buf[0] == 'T')
     {
-      /* Expedited reply, containing Signal, PC, and FP.  */
+      /* Expedited reply, containing Signal, {regno, reg} repeat */
       p = &buf[3];             /* after Txx */
-      for (i = 0; i < sizeof (regs); i++)
+
+      while (*p)
        {
-         if (p[0] == 0 || p[1] == 0)
-           error ("Remote reply is too short: %s", buf);
-         regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]);
+         regno = fromhex (p[0]) * 16 + fromhex (p[1]);
          p += 2;
+         if (regno >= NUM_REGS)
+           error ("Remote sent illegal register number %d (0x%x)", regno,
+                  regno);
+
+         for (i = 0; i < REGISTER_RAW_SIZE (regno); i++)
+           {
+             if (p[0] == 0 || p[1] == 0)
+               error ("Remote reply is too short: %s", buf);
+             regs[i] = fromhex (p[0]) * 16 + fromhex (p[1]);
+             p += 2;
+           }
+
+         supply_register (regno, regs);
        }
-      supply_register (PC_REGNUM, &regs[0]);
-      supply_register (FP_REGNUM, &regs[REGISTER_RAW_SIZE (PC_REGNUM)]);
     }
   else if (buf[0] != 'S')
     error ("Invalid remote reply: %s", buf);
@@ -793,6 +804,8 @@ getpkt (buf)
   unsigned char csum;
   int c;
   unsigned char c1, c2;
+  int retries = 0;
+#define MAX_RETRIES    10
 
 #if 0
   /* Sorry, this will cause all hell to break loose, i.e. we'll end
@@ -839,9 +852,18 @@ getpkt (buf)
        break;
       printf_filtered ("Bad checksum, sentsum=0x%x, csum=0x%x, buf=%s\n",
              (c1 << 4) + c2, csum & 0xff, buf);
+
       /* Try the whole thing again.  */
 whole:
-      write (remote_desc, "-", 1);
+      if (++retries < MAX_RETRIES)
+       {
+         write (remote_desc, "-", 1);
+       }
+      else
+       {
+         printf ("Ignoring packet error, continuing...\n");
+         break;
+       }
     }
 
 #if 0
This page took 0.024904 seconds and 4 git commands to generate.