* inftarg.c (child_thread_alive): New function to see if a
[deliverable/binutils-gdb.git] / gdb / remote-utils.c
index 21acc2c9ec1ecdf4b51fda32b4d70ba2d749c798..ddd5239014a0b2db7d3a2ad89493512d42ac19cd 100644 (file)
@@ -1,6 +1,6 @@
 /* Generic support for remote debugging interfaces.
 
-   Copyright 1993 Free Software Foundation, Inc.
+   Copyright 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
@@ -42,6 +42,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <ctype.h>
 
 #include "defs.h"
+#include <string.h>
 #include "gdbcmd.h"
 #include "target.h"
 #include "serial.h"
@@ -101,8 +102,6 @@ sr_scan_args(proto, args)
   int n;
   char *p, *q;
 
-  extern int strtol();
-
   /* if no args, then nothing to do. */
   if (args == NULL || *args == '\0')
     return;
@@ -122,7 +121,7 @@ sr_scan_args(proto, args)
 
   /* check for missing or empty baud rate.  */
   CHECKDONE(p, q);
-  sr_set_baud_rate(n);
+  baud_rate = n;
 
   /* look for debug value.  */
   n = strtol(p, &q, 10);
@@ -176,10 +175,13 @@ gr_open(args, from_tty, gr)
   if (!sr_get_desc())
     perror_with_name((char *) sr_get_device());
 
-  if (SERIAL_SETBAUDRATE(sr_get_desc(), sr_get_baud_rate()) != 0)
+  if (baud_rate != -1)
     {
-      SERIAL_CLOSE(sr_get_desc());
-      perror_with_name(sr_get_device());
+      if (SERIAL_SETBAUDRATE(sr_get_desc(), baud_rate) != 0)
+       {
+         SERIAL_CLOSE(sr_get_desc());
+         perror_with_name(sr_get_device());
+       }
     }
 
   SERIAL_RAW (sr_get_desc());
@@ -197,8 +199,13 @@ gr_open(args, from_tty, gr)
     gr_settings->clear_all_breakpoints = remove_breakpoints;
 
   if (from_tty)
-      printf_filtered ("Remote debugging using `%s' at baud rate of %d\n",
-                      sr_get_device(), sr_get_baud_rate());
+    {
+      printf_filtered ("Remote debugging using `%s'", sr_get_device ());
+      if (baud_rate != -1)
+       printf_filtered (" at baud rate of %d",
+                        baud_rate);
+      printf_filtered ("\n");
+    }
 
   push_target(gr->ops);
   gr_checkin();
@@ -387,6 +394,7 @@ sr_com (args, fromtty)
 
   sr_write_cr (args);
   sr_write ("\030", 1);
+  registers_changed ();
   gr_expect_prompt ();
 }
 
@@ -438,8 +446,10 @@ gr_files_info (ops)
 #ifdef __GO32__
   printf_filtered ("\tAttached to DOS asynctsr\n");
 #else
-  printf_filtered ("\tAttached to %s at %d baud\n",
-                  sr_get_device(), sr_get_baud_rate());
+  printf_filtered ("\tAttached to %s", sr_get_device());
+  if (baud_rate != -1)
+    printf_filtered ("at %d baud", baud_rate);
+  printf_filtered ("\n");
 #endif
 
   if (exec_bfd)
@@ -637,8 +647,13 @@ gr_load_image (args, fromtty)
   abfd = bfd_openr (args, (char *) 0);
 
   if (!abfd)
+    /* FIXME: should be using bfd_errmsg, not assuming it was
+       bfd_error_system_call.  */
     perror_with_name (args);
 
+  /* FIXME: should be checking for errors from bfd_close (for one thing,
+     on error it does not free all the storage associated with the
+     bfd).  */
   old_cleanups = make_cleanup (bfd_close, abfd);
 
   QUIT;
@@ -671,7 +686,9 @@ gr_load_image (args, fromtty)
 
   free (buffer);
   write_pc (bfd_get_start_address (abfd));
-  bfd_close (abfd);
+  if (!bfd_close (abfd))
+    warning ("cannot close \"%s\": %s",
+            args, bfd_errmsg (bfd_get_error ()));
   discard_cleanups (old_cleanups);
 }
 
This page took 0.024271 seconds and 4 git commands to generate.