* configure.host: Add x86_64-*-freebsd*.
[deliverable/binutils-gdb.git] / gdb / remote-mips.c
index 0f6d9957275326eafe31f6e22b365e35c17e3d19..96f39728f5414228f1129ec097dfb7900bb190e2 100644 (file)
@@ -1,6 +1,8 @@
 /* Remote debugging interface for MIPS remote debugging protocol.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation, Inc.
+
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+   2002 Free Software Foundation, Inc.
+
    Contributed by Cygnus Support.  Written by Ian Lance Taylor
    <ian@cygnus.com>.
 
@@ -495,7 +497,7 @@ mips_error (char *string,...)
   printf_unfiltered ("Ending remote MIPS debugging.\n");
   target_mourn_inferior ();
 
-  return_to_top_level (RETURN_ERROR);
+  throw_exception (RETURN_ERROR);
 }
 
 /* putc_readable - print a character, displaying non-printable chars in
@@ -534,7 +536,7 @@ fputs_readable (const char *string, struct ui_file *file)
    timed out.  TIMEOUT specifies timeout value in seconds.
  */
 
-int
+static int
 mips_expect_timeout (const char *string, int timeout)
 {
   const char *p = string;
@@ -590,7 +592,7 @@ mips_expect_timeout (const char *string, int timeout)
    mips_expect_timeout if a different timeout value is needed.
  */
 
-int
+static int
 mips_expect (const char *string)
 {
   return mips_expect_timeout (string, remote_timeout);
@@ -598,7 +600,7 @@ mips_expect (const char *string)
 
 /* Read the required number of characters into the given buffer (which
    is assumed to be large enough). The only failure is a timeout. */
-int
+static int
 mips_getstring (char *string, int n)
 {
   char *p = string;
@@ -1281,13 +1283,13 @@ mips_request (int cmd,
 }
 
 static void
-mips_initialize_cleanups (PTR arg)
+mips_initialize_cleanups (void *arg)
 {
   mips_initializing = 0;
 }
 
 static void
-mips_exit_cleanups (PTR arg)
+mips_exit_cleanups (void *arg)
 {
   mips_exiting = 0;
 }
@@ -1492,8 +1494,10 @@ mips_initialize (void)
      the request itself succeeds or fails.  */
 
   mips_request ('r', 0, 0, &err, mips_receive_wait, NULL);
-  set_current_frame (create_new_frame (read_fp (), read_pc ()));
-  select_frame (get_current_frame (), 0);
+  /* FIXME: cagney/2002-11-29: Force the update of selected frame.
+     This shouldn't be necessary, only many many places still refer to
+     selected_frame directly (instead of using get_selected_frame().  */
+  get_selected_frame (); /* Hack!!!  */
 }
 
 /* Open a connection to the remote board.  */
@@ -1610,17 +1614,15 @@ device is attached to the target board (e.g., /dev/ttya).\n"
   if (ptype)
     mips_set_processor_type_command (xstrdup (ptype), 0);
 
-/* This is really the job of start_remote however, that makes an assumption
-   that the target is about to print out a status message of some sort.  That
-   doesn't happen here (in fact, it may not be possible to get the monitor to
-   send the appropriate packet).  */
+  /* This is really the job of start_remote however, that makes an
+     assumption that the target is about to print out a status message
+     of some sort.  That doesn't happen here (in fact, it may not be
+     possible to get the monitor to send the appropriate packet).  */
 
   flush_cached_frames ();
   registers_changed ();
   stop_pc = read_pc ();
-  set_current_frame (create_new_frame (read_fp (), stop_pc));
-  select_frame (get_current_frame (), 0);
-  print_stack_frame (selected_frame, -1, 1);
+  print_stack_frame (get_selected_frame (), -1, 1);
   xfree (serial_port_name);
 }
 
@@ -1719,7 +1721,7 @@ mips_resume (ptid_t ptid, int step, enum target_signal siggnal)
 
 /* Return the signal corresponding to SIG, where SIG is the number which
    the MIPS protocol uses for the signal.  */
-enum target_signal
+static enum target_signal
 mips_signal_from_protocol (int sig)
 {
   /* We allow a few more signals than the IDT board actually returns, on
@@ -1789,7 +1791,7 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status)
                    &rpc, &rfp, &rsp, flags);
   if (nfields >= 3)
     {
-      char buf[MAX_REGISTER_RAW_SIZE];
+      char buf[MAX_REGISTER_SIZE];
 
       store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc);
       supply_register (PC_REGNUM, buf);
@@ -1800,8 +1802,8 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status)
       store_unsigned_integer (buf, REGISTER_RAW_SIZE (SP_REGNUM), rsp);
       supply_register (SP_REGNUM, buf);
 
-      store_unsigned_integer (buf, REGISTER_RAW_SIZE (FP_REGNUM), 0);
-      supply_register (FP_REGNUM, buf);
+      store_unsigned_integer (buf, REGISTER_RAW_SIZE (DEPRECATED_FP_REGNUM), 0);
+      supply_register (DEPRECATED_FP_REGNUM, buf);
 
       if (nfields == 9)
        {
@@ -1941,9 +1943,9 @@ mips_fetch_registers (int regno)
       return;
     }
 
-  if (regno == FP_REGNUM || regno == ZERO_REGNUM)
-    /* FP_REGNUM on the mips is a hack which is just supposed to read
-       zero (see also mips-nat.c).  */
+  if (regno == DEPRECATED_FP_REGNUM || regno == ZERO_REGNUM)
+    /* DEPRECATED_FP_REGNUM on the mips is a hack which is just
+       supposed to read zero (see also mips-nat.c).  */
     val = 0;
   else
     {
@@ -1970,7 +1972,7 @@ mips_fetch_registers (int regno)
     }
 
   {
-    char buf[MAX_REGISTER_RAW_SIZE];
+    char buf[MAX_REGISTER_SIZE];
 
     /* We got the number the register holds, but gdb expects to see a
        value in the target byte ordering.  */
@@ -2066,8 +2068,7 @@ static int mask_address_p = 1;
 
 static int
 mips_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
-                 struct mem_attrib *attrib ATTRIBUTE_UNUSED,
-                 struct target_ops *target ATTRIBUTE_UNUSED)
+                 struct mem_attrib *attrib, struct target_ops *target)
 {
   int i;
   CORE_ADDR addr;
@@ -2185,7 +2186,7 @@ Give up (and stop debugging it)? "))
          printf_unfiltered ("Ending remote MIPS debugging.\n");
          target_mourn_inferior ();
 
-         return_to_top_level (RETURN_QUIT);
+         throw_exception (RETURN_QUIT);
        }
 
       target_terminal_inferior ();
@@ -2250,13 +2251,13 @@ mips_mourn_inferior (void)
 /* We can write a breakpoint and read the shadow contents in one
    operation.  */
 
-/* Insert a breakpoint.  On targets that don't have built-in breakpoint
-   support, we read the contents of the target location and stash it,
-   then overwrite it with a breakpoint instruction.  ADDR is the target
-   location in the target machine.  CONTENTS_CACHE is a pointer to 
-   memory allocated for saving the target contents.  It is guaranteed
-   by the caller to be long enough to save sizeof BREAKPOINT bytes (this
-   is accomplished via BREAKPOINT_MAX).  */
+/* Insert a breakpoint.  On targets that don't have built-in
+   breakpoint support, we read the contents of the target location and
+   stash it, then overwrite it with a breakpoint instruction.  ADDR is
+   the target location in the target machine.  CONTENTS_CACHE is a
+   pointer to memory allocated for saving the target contents.  It is
+   guaranteed by the caller to be long enough to save the breakpoint
+   length returned by BREAKPOINT_FROM_PC.  */
 
 static int
 mips_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
@@ -2436,7 +2437,7 @@ calculate_mask (CORE_ADDR addr, int len)
 /* Insert a hardware breakpoint.  This works only on LSI targets, which
    implement ordinary breakpoints using hardware facilities.  */
 
-int
+static int
 remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (strcmp (target_shortname, "lsi") == 0)
@@ -2449,7 +2450,7 @@ remote_mips_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
 /* Remove a hardware breakpoint.  This works only on LSI targets, which
    implement ordinary breakpoints using hardware facilities.  */
 
-int
+static int
 remote_mips_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
 {
   if (strcmp (target_shortname, "lsi") == 0)
@@ -2845,6 +2846,9 @@ mips_load_srec (char *args)
              reclen = mips_make_srec (srec, '3', s->vma + i, buffer, numbytes);
              send_srec (srec, reclen, s->vma + i);
 
+             if (ui_load_progress_hook)
+               ui_load_progress_hook (s->name, i);
+
              if (hashmark)
                {
                  putchar_unfiltered ('#');
@@ -3366,6 +3370,9 @@ pmon_load_fast (char *file)
                            break;
                          }
 
+                       if (ui_load_progress_hook)
+                         ui_load_progress_hook (s->name, i);
+
                        if (hashmark)
                          {
                            putchar_unfiltered ('#');
@@ -3436,7 +3443,7 @@ mips_load (char *file, int from_tty)
       /* Work around problem where PMON monitor updates the PC after a load
          to a different value than GDB thinks it has. The following ensures
          that the write_pc() WILL update the PC value: */
-      register_valid[PC_REGNUM] = 0;
+      deprecated_register_valid[PC_REGNUM] = 0;
     }
   if (exec_bfd)
     write_pc (bfd_get_start_address (exec_bfd));
@@ -3470,6 +3477,8 @@ pmon_command (char *args, int from_tty)
   printf_filtered ("Received packet: %s\n", buf);
 }
 \f
+extern initialize_file_ftype _initialize_remote_mips; /* -Wmissing-prototypes */
+
 void
 _initialize_remote_mips (void)
 {
This page took 0.029818 seconds and 4 git commands to generate.