Rephrase error message in infcall.c:call_function_by_hand
[deliverable/binutils-gdb.git] / gdb / top.c
index bba1a2ddf5fb3a3e39fdbbb0dc67bce3702f14ae..b69f7d694c908e410febef38ce116ad115741058 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -294,7 +294,7 @@ quit_cover (void *s)
 }
 #endif /* defined SIGHUP */
 \f
-/* Line number we are currently in in a file which is being sourced.  */
+/* Line number we are currently in, in a file which is being sourced.  */
 /* NOTE 1999-04-29: This variable will be static again, once we modify
    gdb to use the event loop as the default command loop and we merge
    event-top.c into this file, top.c.  */
@@ -339,10 +339,14 @@ do_chdir_cleanup (void *old_dir)
 }
 #endif
 
-void
+struct cleanup *
 prepare_execute_command (void)
 {
-  free_all_values ();
+  struct value *mark;
+  struct cleanup *cleanup;
+
+  mark = value_mark ();
+  cleanup = make_cleanup_value_free_to_mark (mark);
 
   /* With multiple threads running while the one we're examining is
      stopped, the dcache can get stale without us being able to detect
@@ -350,6 +354,8 @@ prepare_execute_command (void)
      help things like backtrace.  */
   if (non_stop)
     target_dcache_invalidate ();
+
+  return cleanup;
 }
 
 /* Execute the line P as a command, in the current user context.
@@ -358,12 +364,13 @@ prepare_execute_command (void)
 void
 execute_command (char *p, int from_tty)
 {
+  struct cleanup *cleanup;
   struct cmd_list_element *c;
   enum language flang;
   static int warned = 0;
   char *line;
 
-  prepare_execute_command ();
+  cleanup = prepare_execute_command ();
 
   /* Force cleanup of any alloca areas if using C alloca instead of
      a builtin alloca.  */
@@ -462,6 +469,8 @@ execute_command (char *p, int from_tty)
          warned = 1;
        }
     }
+
+    do_cleanups (cleanup);
 }
 
 /* Run execute_command for P and FROM_TTY.  Capture its output into the
@@ -546,12 +555,17 @@ command_loop (void)
     }
 }
 \f
+/* When nonzero, cause dont_repeat to do nothing.  This should only be
+   set via prevent_dont_repeat.  */
+
+static int suppress_dont_repeat = 0;
+
 /* Commands call this if they do not want to be repeated by null lines.  */
 
 void
 dont_repeat (void)
 {
-  if (server_command)
+  if (suppress_dont_repeat || server_command)
     return;
 
   /* If we aren't reading from standard input, we are saving the last
@@ -560,6 +574,19 @@ dont_repeat (void)
   if (instream == stdin)
     *line = 0;
 }
+
+/* Prevent dont_repeat from working, and return a cleanup that
+   restores the previous state.  */
+
+struct cleanup *
+prevent_dont_repeat (void)
+{
+  struct cleanup *result = make_cleanup_restore_integer (&suppress_dont_repeat);
+
+  suppress_dont_repeat = 1;
+  return result;
+}
+
 \f
 /* Read a line from the stream "instream" without command line editing.
 
@@ -1263,38 +1290,12 @@ quit_force (char *args, int from_tty)
   exit (exit_code);
 }
 
-/* If OFF, the debugger will run in non-interactive mode, which means
-   that it will automatically select the default answer to all the
-   queries made to the user.  If ON, gdb will wait for the user to
-   answer all queries.  If AUTO, gdb will determine whether to run
-   in interactive mode or not depending on whether stdin is a terminal
-   or not.  */
-static enum auto_boolean interactive_mode = AUTO_BOOLEAN_AUTO;
-
-/* Implement the "show interactive-mode" option.  */
-
-static void
-show_interactive_mode (struct ui_file *file, int from_tty,
-                       struct cmd_list_element *c,
-                       const char *value)
-{
-  if (interactive_mode == AUTO_BOOLEAN_AUTO)
-    fprintf_filtered (file, "Debugger's interactive mode "
-                     "is %s (currently %s).\n",
-                      value, input_from_terminal_p () ? "on" : "off");
-  else
-    fprintf_filtered (file, "Debugger's interactive mode is %s.\n", value);
-}
-
 /* Returns whether GDB is running on a terminal and input is
    currently coming from that terminal.  */
 
 int
 input_from_terminal_p (void)
 {
-  if (interactive_mode != AUTO_BOOLEAN_AUTO && instream == stdin)
-    return interactive_mode == AUTO_BOOLEAN_TRUE;
-
   if (batch_flag)
     return 0;
 
@@ -1433,6 +1434,7 @@ set_verbose (char *args, int from_tty, struct cmd_list_element *c)
   struct cmd_list_element *showcmd;
 
   showcmd = lookup_cmd_1 (&cmdname, showlist, NULL, 1);
+  gdb_assert (showcmd != NULL && showcmd != CMD_LIST_AMBIGUOUS);
 
   if (info_verbose)
     {
@@ -1627,18 +1629,6 @@ Use \"on\" to enable the notification, and \"off\" to disable it."),
                           show_exec_done_display_p,
                           &setlist, &showlist);
 
-  add_setshow_auto_boolean_cmd ("interactive-mode", class_support,
-                                &interactive_mode, _("\
-Set whether GDB should run in interactive mode or not"), _("\
-Show whether GDB runs in interactive mode"), _("\
-If on, run in interactive mode and wait for the user to answer\n\
-all queries.  If off, run in non-interactive mode and automatically\n\
-assume the default answer to all queries.  If auto (the default),\n\
-determine which mode to use based on the standard input settings"),
-                        NULL,
-                        show_interactive_mode,
-                        &setlist, &showlist);
-
   add_setshow_filename_cmd ("data-directory", class_maintenance,
                            &gdb_datadir, _("Set GDB's data directory."),
                            _("Show GDB's data directory."),
This page took 0.037222 seconds and 4 git commands to generate.