* serial.h (SERIAL_SET_TTY_STATE): Comment return value.
[deliverable/binutils-gdb.git] / gdb / remote-utils.c
index 95043202bc110cf051bb354299e024b29c00daf6..21acc2c9ec1ecdf4b51fda32b4d70ba2d749c798 100644 (file)
@@ -76,10 +76,8 @@ usage(proto, junk)
   if (junk != NULL)
     fprintf_unfiltered(gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
 
-  /* FIXME-now: service@host? */
-
-  error("Usage: target %s <device <speed <debug>>>\n\
-or target %s <host> <port>\n", proto, proto);
+  error ("Usage: target %s [DEVICE [SPEED [DEBUG]]]\n\
+where DEVICE is the name of a device or HOST:PORT", proto, proto);
 
   return;
 }
@@ -167,6 +165,13 @@ gr_open(args, from_tty, gr)
   if (sr_get_desc() != NULL)
     gr_close (0);
 
+  /* If no args are specified, then we use the device specified by a
+     previous command or "set remotedevice".  But if there is no
+     device, better stop now, not dump core.  */
+
+  if (sr_get_device () == NULL)
+    usage (gr->ops->to_shortname, NULL);
+
   sr_set_desc(SERIAL_OPEN (sr_get_device()));
   if (!sr_get_desc())
     perror_with_name((char *) sr_get_device());
@@ -430,22 +435,18 @@ void
 gr_files_info (ops)
      struct target_ops *ops;
 {
-  char *file = "nothing";
-
-  if (exec_bfd)
-    file = bfd_get_filename (exec_bfd);
-
-  if (exec_bfd)
-    {
 #ifdef __GO32__
-      printf_filtered ("\tAttached to DOS asynctsr\n");
+  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 at %d baud\n",
+                  sr_get_device(), sr_get_baud_rate());
 #endif
-    }
 
-  printf_filtered ("\tand running program %s\n", file);
+  if (exec_bfd)
+    {
+      printf_filtered ("\tand running program %s\n",
+                      bfd_get_filename (exec_bfd));
+    }
   printf_filtered ("\tusing the %s protocol.\n", ops->to_shortname);
 }
 
@@ -641,24 +642,24 @@ gr_load_image (args, fromtty)
   old_cleanups = make_cleanup (bfd_close, abfd);
 
   QUIT;
-  immediate_quit++;
 
   if (!bfd_check_format (abfd, bfd_object))
     error ("It doesn't seem to be an object file.\n");
 
-  for (s = abfd->sections; s; s = s->next)
+  for (s = abfd->sections; s && !quit_flag; s = s->next)
     {
       if (bfd_get_section_flags (abfd, s) & SEC_LOAD)
        {
          int i;
          printf_filtered ("%s\t: 0x%4x .. 0x%4x  ",
                           s->name, s->vma, s->vma + s->_raw_size);
-         for (i = 0; i < s->_raw_size; i += delta)
+         fflush (stdout);
+         for (i = 0; i < s->_raw_size && !quit_flag; i += delta)
            {
              int sub_delta = delta;
              if (sub_delta > s->_raw_size - i)
                sub_delta = s->_raw_size - i;
-
+             QUIT;
              bfd_get_section_contents (abfd, s, buffer, i, sub_delta);
              target_write_memory (s->vma + i, buffer, sub_delta);
              printf_filtered ("*");
@@ -667,7 +668,7 @@ gr_load_image (args, fromtty)
          printf_filtered ("\n");
        }
     }
-  immediate_quit--;
+
   free (buffer);
   write_pc (bfd_get_start_address (abfd));
   bfd_close (abfd);
This page took 0.023797 seconds and 4 git commands to generate.