Extract string-printing out of ada_val_print_array
[deliverable/binutils-gdb.git] / gdb / remote-mips.c
index 1619622b992eadd777eb3f646ea731b4e7550ab2..04c4a40f4e0e57fb0b251af48acb109b1e4d0075 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote debugging interface for MIPS remote debugging protocol.
 
-   Copyright (C) 1993-2013 Free Software Foundation, Inc.
+   Copyright (C) 1993-2014 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.  Written by Ian Lance Taylor
    <ian@cygnus.com>.
@@ -29,8 +29,8 @@
 #include "serial.h"
 #include "target.h"
 #include "exceptions.h"
-#include "gdb_string.h"
-#include "gdb_stat.h"
+#include <string.h>
+#include <sys/stat.h>
 #include "gdb_usleep.h"
 #include "regcache.h"
 #include <ctype.h>
@@ -86,8 +86,6 @@ static void lsi_open (char *name, int from_tty);
 
 static void mips_close (void);
 
-static void mips_detach (struct target_ops *ops, char *args, int from_tty);
-
 static int mips_map_regno (struct gdbarch *, int);
 
 static void mips_set_register (int regno, ULONGEST value);
@@ -488,17 +486,11 @@ static void ATTRIBUTE_NORETURN
 mips_error (char *string,...)
 {
   va_list args;
-
-  va_start (args, string);
+  char *fmt;
 
   target_terminal_ours ();
   wrap_here ("");              /* Force out any buffered output.  */
   gdb_flush (gdb_stdout);
-  if (error_pre_print)
-    fputs_filtered (error_pre_print, gdb_stderr);
-  vfprintf_filtered (gdb_stderr, string, args);
-  fprintf_filtered (gdb_stderr, "\n");
-  va_end (args);
   gdb_flush (gdb_stderr);
 
   /* Clean up in such a way that mips_close won't try to talk to the
@@ -506,11 +498,16 @@ mips_error (char *string,...)
      it).  */
   close_ports ();
 
-  printf_unfiltered ("Ending remote MIPS debugging.\n");
   if (!ptid_equal (inferior_ptid, null_ptid))
     target_mourn_inferior ();
 
-  deprecated_throw_reason (RETURN_ERROR);
+  fmt = concat (_("Ending remote MIPS debugging: "),
+               string, (char *) NULL);
+  make_cleanup (xfree, fmt);
+
+  va_start (args, string);
+  throw_verror (TARGET_CLOSE_ERROR, fmt, args);
+  va_end (args);
 }
 
 /* putc_readable - print a character, displaying non-printable chars in
@@ -1662,7 +1659,7 @@ seen from the board via TFTP, specify that name as the third parameter.\n"));
   reinit_frame_cache ();
   registers_changed ();
   stop_pc = regcache_read_pc (get_current_regcache ());
-  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 0, SRC_AND_LOC, 1);
   xfree (serial_port_name);
 
   do_cleanups (cleanup);
@@ -1750,14 +1747,12 @@ mips_close (void)
 /* Detach from the remote board.  */
 
 static void
-mips_detach (struct target_ops *ops, char *args, int from_tty)
+mips_detach (struct target_ops *ops, const char *args, int from_tty)
 {
   if (args)
     error (_("Argument given to \"detach\" when remotely debugging."));
 
-  pop_target ();
-
-  mips_close ();
+  unpush_target (ops);
 
   if (from_tty)
     printf_unfiltered ("Ending remote MIPS debugging.\n");
@@ -2293,8 +2288,7 @@ Give up (and stop debugging it)? ")))
 
          printf_unfiltered ("Ending remote MIPS debugging.\n");
          target_mourn_inferior ();
-
-         deprecated_throw_reason (RETURN_QUIT);
+         quit ();
        }
 
       target_terminal_inferior ();
This page took 0.02492 seconds and 4 git commands to generate.