* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / remote-bug.c
index d709cd2bfca22627cfc31610f1b5d5b332bafff7..b3b72d28eca475e1d9928d236804d07aed9e5889 100644 (file)
@@ -66,7 +66,8 @@ static int srec_max_retries = 3;
    record.  I call this download a "frame".  Srec_frame says how many
    bytes will be represented in each frame.  */
 
-static int srec_frame = 160;
+#define SREC_SIZE 160
+static int srec_frame = SREC_SIZE;
 
 /* This variable determines how many bytes will be represented in each
    S3 s-record.  */
@@ -138,6 +139,7 @@ bug_load (args, fromtty)
   s = abfd->sections;
   while (s != (asection *) NULL)
     {
+      srec_frame = SREC_SIZE;
       if (s->flags & SEC_LOAD)
        {
          int i;
@@ -462,7 +464,7 @@ bug_fetch_register(regno)
     {
       /* Float register so we need to parse a strange data format. */
       long p;
-      unsigned char value[10];
+      unsigned char fpreg_buf[10];
 
       sr_write("rs ", 3);
       sr_write(get_reg_name(regno), strlen(get_reg_name(regno)));
@@ -474,31 +476,31 @@ bug_fetch_register(regno)
 
       /* sign */
       p = sr_get_hex_digit(1);
-      value[0] = p << 7;
+      fpreg_buf[0] = p << 7;
 
       /* exponent */
       sr_expect("_");
       p = sr_get_hex_digit(1);
-      value[0] += (p << 4);
-      value[0] += sr_get_hex_digit(1);
+      fpreg_buf[0] += (p << 4);
+      fpreg_buf[0] += sr_get_hex_digit(1);
 
-      value[1] = sr_get_hex_digit(1) << 4;
+      fpreg_buf[1] = sr_get_hex_digit(1) << 4;
 
       /* fraction */
       sr_expect("_");
-      value[1] += sr_get_hex_digit(1);
+      fpreg_buf[1] += sr_get_hex_digit(1);
 
-      value[2] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[3] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[4] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[5] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[6] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[7] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
-      value[8] = 0;
-      value[9] = 0;
+      fpreg_buf[2] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[3] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[4] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[5] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[6] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[7] = (sr_get_hex_digit(1) << 4) + sr_get_hex_digit(1);
+      fpreg_buf[8] = 0;
+      fpreg_buf[9] = 0;
 
       gr_expect_prompt();
-      supply_register(regno, value);
+      supply_register(regno, fpreg_buf);
     }
 
   return;
@@ -534,23 +536,24 @@ bug_store_register (regno)
                read_register(regno));
       else
        {
-         unsigned char *value = &registers[REGISTER_BYTE(regno)];
+         unsigned char *fpreg_buf =
+           (unsigned char *)&registers[REGISTER_BYTE(regno)];
          
          sprintf(buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d",
                  regname,
                  /* sign */
-                 (value[0] >> 7) & 0xf,
+                 (fpreg_buf[0] >> 7) & 0xf,
                  /* exponent */
-                 value[0] & 0x7f,
-                 (value[1] >> 8) & 0xf,
+                 fpreg_buf[0] & 0x7f,
+                 (fpreg_buf[1] >> 8) & 0xf,
                  /* fraction */
-                 value[1] & 0xf,
-                 value[2],
-                 value[3],
-                 value[4],
-                 value[5],
-                 value[6],
-                 value[7]);
+                 fpreg_buf[1] & 0xf,
+                 fpreg_buf[2],
+                 fpreg_buf[3],
+                 fpreg_buf[4],
+                 fpreg_buf[5],
+                 fpreg_buf[6],
+                 fpreg_buf[7]);
        }
 
       sr_write_cr(buffer);
@@ -682,7 +685,7 @@ bug_write_memory (memaddr, myaddr, len)
   int checksum;
   int x;
   int retries;
-  char buffer[(srec_bytes + 8) << 1];
+  char *buffer = alloca ((srec_bytes + 8) << 1);
 
   retries = 0;
 
@@ -960,8 +963,7 @@ bug_clear_breakpoints ()
 struct target_ops bug_ops =
 {
   "bug", "Remote BUG monitor",
-  "Use the mvme187 board running the BUG monitor connected\n\
-by a serial line.",
+  "Use the mvme187 board running the BUG monitor connected by a serial line.",
 
   bug_open, gr_close,
   0, gr_detach, bug_resume, bug_wait,  /* attach */
@@ -1007,6 +1009,9 @@ This affects the communication protocol with the remote target.",
                  &setlist),
      &showlist);
 
+#if 0
+  /* This needs to set SREC_SIZE, not srec_frame which gets changed at the
+     end of a download.  But do we need the option at all?  */
   add_show_from_set
     (add_set_cmd ("srec-frame", class_support, var_uinteger,
                  (char *) &srec_frame,
@@ -1015,6 +1020,7 @@ Set the number of bytes in an S-record frame.\n\
 This affects the communication protocol with the remote target.",
                  &setlist),
      &showlist);
+#endif /* 0 */
 
   add_show_from_set
     (add_set_cmd ("srec-noise", class_support, var_zinteger,
This page took 0.025206 seconds and 4 git commands to generate.