* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,
[deliverable/binutils-gdb.git] / gdb / remote-mips.c
index 8e926c283194a3d0130e75f8951d2375ef80b7fd..0123dbd3d716836d7013b4c6fc4a8102da78465f 100644 (file)
@@ -103,9 +103,6 @@ mips_xfer_memory PARAMS ((CORE_ADDR memaddr, char *myaddr, int len,
 static void
 mips_files_info PARAMS ((struct target_ops *ignore));
 
-static void
-mips_load PARAMS ((char *args, int from_tty));
-
 static void
 mips_create_inferior PARAMS ((char *execfile, char *args, char **env));
 
@@ -286,7 +283,7 @@ static serial_t mips_desc;
    all hell to break loose--the rest of GDB will tend to get left in an
    inconsistent state.  */
 
-static void NORETURN
+static NORETURN void
 mips_error (va_alist)
      va_dcl
 {
@@ -338,6 +335,8 @@ mips_readchar (timeout)
   static int state = 0;
   static char nextstate[5] = { '<', 'I', 'D', 'T', '>' };
 
+  if (state == 5) 
+    timeout = 1;
   ch = SERIAL_READCHAR (mips_desc, timeout);
   if (ch == SERIAL_EOF)
     mips_error ("End of file from remote");
@@ -366,7 +365,7 @@ mips_readchar (timeout)
        /* Don't use _filtered; we can't deal with a QUIT out of
           target_wait, and I think this might be called from there.  */
        printf_unfiltered ("Reinitializing MIPS debugging mode\n");
-      SERIAL_WRITE (mips_desc, "\rdb tty0\r", sizeof "\rdb tty0\r" - 1);
+      SERIAL_WRITE (mips_desc, "\015db tty0\015", sizeof "\015db tty0\015" - 1);
       sleep (1);
 
       mips_need_reply = 0;
@@ -418,7 +417,13 @@ mips_receive_header (hdr, pgarbage, ch, timeout)
                 we can't deal with a QUIT out of target_wait.  */
              if (! mips_initializing || sr_get_debug () > 0)
                {
-                 putchar_unfiltered (ch);
+                 if (ch < 0x20 && ch != '\n')
+                   {
+                     putchar_unfiltered ('^');
+                     putchar_unfiltered (ch + 0x40);
+                   }
+                 else
+                   putchar_unfiltered (ch);
                  gdb_flush (gdb_stdout);
                }
 
@@ -947,7 +952,8 @@ mips_initialize ()
   /* The board seems to want to send us a packet.  I don't know what
      it means.  The packet seems to be triggered by a carriage return
      character, although perhaps any character would do.  */
-  cr = '\r';
+  cr = '\015';
+  /* FIXME check the result from this */
   SERIAL_WRITE (mips_desc, &cr, 1);
 
   if (mips_receive_packet (buff, 0, 3) < 0)
@@ -960,9 +966,9 @@ mips_initialize ()
       cc = '\003';
       SERIAL_WRITE (mips_desc, &cc, 1);
       sleep (2);
-      SERIAL_WRITE (mips_desc, "\rdb tty0\r", sizeof "\rdb tty0\r" - 1);
+      SERIAL_WRITE (mips_desc, "\015db tty0\015", sizeof "\015db tty0\015" - 1);
       sleep (1);
-      cr = '\r';
+      cr = '\015';
       SERIAL_WRITE (mips_desc, &cr, 1);
     }
   mips_receive_packet (buff, 1, 3);
@@ -996,6 +1002,15 @@ device is attached to the target board (e.g., /dev/ttya).");
   if (mips_desc == (serial_t) NULL)
     perror_with_name (name);
 
+  if (baud_rate != -1)
+    {
+      if (SERIAL_SETBAUDRATE (mips_desc, baud_rate))
+        {
+          SERIAL_CLOSE (mips_desc);
+          perror_with_name (name);
+        }
+    }
+
   SERIAL_RAW (mips_desc);
 
   mips_is_open = 1;
@@ -1339,6 +1354,12 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore)
          status = mips_store_word (addr,
                                    extract_unsigned_integer (&buffer[i*4], 4),
                                    NULL);
+         /* Report each kilobyte (we download 32-bit words at a time) */
+         if (i % 256 == 255) 
+           {
+             printf_unfiltered ("*");
+             fflush (stdout);
+           }
          if (status)
            {
              errno = status;
@@ -1346,6 +1367,8 @@ mips_xfer_memory (memaddr, myaddr, len, write, ignore)
            }
          /* FIXME: Do we want a QUIT here?  */
        }
+      if (count >= 256)
+       printf_unfiltered ("\n");
     }
   else
     {
@@ -1438,11 +1461,8 @@ mips_mourn_inferior ()
 /* The IDT board uses an unusual breakpoint value, and sometimes gets
    confused when it sees the usual MIPS breakpoint instruction.  */
 
-#if TARGET_BYTE_ORDER == BIG_ENDIAN
-static unsigned char break_insn[] = {0, 0, 0x0a, 0x0d};
-#else
-static unsigned char break_insn[] = {0x0d, 0x0a, 0, 0};
-#endif
+#define BREAK_INSN (0x00000a0d)
+#define BREAK_INSN_SIZE (4)
 
 /* Insert a breakpoint on targets that don't have any better breakpoint
    support.  We read the contents of the target location and stash it,
@@ -1459,10 +1479,7 @@ mips_insert_breakpoint (addr, contents_cache)
 {
   int status;
 
-  return
-    mips_store_word (addr,
-                    extract_unsigned_integer (break_insn, sizeof break_insn),
-                    contents_cache);
+  return mips_store_word (addr, BREAK_INSN, contents_cache);
 }
 
 static int
@@ -1470,7 +1487,7 @@ mips_remove_breakpoint (addr, contents_cache)
      CORE_ADDR addr;
      char *contents_cache;
 {
-  return target_write_memory (addr, contents_cache, sizeof break_insn);
+  return target_write_memory (addr, contents_cache, BREAK_INSN_SIZE);
 }
 \f
 /* The target vector.  */
@@ -1508,6 +1525,7 @@ HOST:PORT to access a board over a network",  /* to_doc */
   mips_mourn_inferior,         /* to_mourn_inferior */
   NULL,                                /* to_can_run */
   NULL,                                /* to_notice_signals */
+  0,                           /* to_stop */
   process_stratum,             /* to_stratum */
   NULL,                                /* to_next */
   1,                           /* to_has_all_memory */
This page took 0.024871 seconds and 4 git commands to generate.