Eliminate exceptions.c:print_any_exception.
[deliverable/binutils-gdb.git] / gdb / infcmd.c
index 6511d642cb7e0b25ba0c0bbae589e974fd5ec5e8..021a587ecc2a0853fc55347c35f565cb3e603228 100644 (file)
@@ -497,11 +497,9 @@ Start it from the beginning? ")))
     }
 }
 
-/* Prepare for execution command.  TARGET is the target that will run
-   the command.  BACKGROUND determines whether this is a foreground
-   (synchronous) or background (asynchronous) command.  */
+/* See inferior.h.  */
 
-static void
+void
 prepare_execution_command (struct target_ops *target, int background)
 {
   /* If we get a request for running in the bg but the target
@@ -1575,8 +1573,7 @@ finish_backward (struct symbol *function)
   pc = get_frame_pc (get_current_frame ());
 
   if (find_pc_partial_function (pc, NULL, &func_addr, NULL) == 0)
-    internal_error (__FILE__, __LINE__,
-                   _("Finish: couldn't find function."));
+    error (_("Cannot find bounds of current function"));
 
   sal = find_pc_line (func_addr, 0);
 
@@ -2383,9 +2380,6 @@ attach_command_post_wait (char *args, int from_tty, int async_exec)
 
   post_create_inferior (&current_target, from_tty);
 
-  /* Install inferior's terminal modes.  */
-  target_terminal_inferior ();
-
   if (async_exec)
     {
       /* The user requested an `attach&', so be sure to leave threads
@@ -2501,6 +2495,22 @@ attach_command (char *args, int from_tty)
      based on what modes we are starting it with.  */
   target_terminal_init ();
 
+  /* Install inferior's terminal modes.  This may look like a no-op,
+     as we've just saved them above, however, this does more than
+     restore terminal settings:
+
+     - installs a SIGINT handler that forwards SIGINT to the inferior.
+       Otherwise a Ctrl-C pressed just while waiting for the initial
+       stop would end up as a spurious Quit.
+
+     - removes stdin from the event loop, which we need if attaching
+       in the foreground, otherwise on targets that report an initial
+       stop on attach (which are most) we'd process input/commands
+       while we're in the event loop waiting for that stop.  That is,
+       before the attach continuation runs and the command is really
+       finished.  */
+  target_terminal_inferior ();
+
   /* Set up execution context to know that we should return from
      wait_for_inferior as soon as the target reports a stop.  */
   init_wait_for_inferior ();
@@ -2771,7 +2781,7 @@ unset_command (char *args, int from_tty)
 {
   printf_filtered (_("\"unset\" must be followed by the "
                     "name of an unset subcommand.\n"));
-  help_list (unsetlist, "unset ", -1, gdb_stdout);
+  help_list (unsetlist, "unset ", all_commands, gdb_stdout);
 }
 
 /* Implement `info proc' family of commands.  */
This page took 0.025198 seconds and 4 git commands to generate.