* gas/nios2/nios2.exp: Add copyright.
[deliverable/binutils-gdb.git] / gdb / top.c
index a138480e5e43d10a4e3df463601dab087fe40f6d..e9a40fc0ccf53a060414fd2fb3f366165b0da689 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1,6 +1,6 @@
 /* Top level stuff for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2012 Free Software Foundation, Inc.
+   Copyright (C) 1986-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,7 +19,6 @@
 
 #include "defs.h"
 #include "gdbcmd.h"
-#include "call-cmds.h"
 #include "cli/cli-cmds.h"
 #include "cli/cli-script.h"
 #include "cli/cli-setshow.h"
@@ -47,6 +46,7 @@
 #include "gdbthread.h"
 #include "python/python.h"
 #include "interps.h"
+#include "observer.h"
 
 /* readline include files.  */
 #include "readline/readline.h"
@@ -64,6 +64,8 @@
 #include "ui-out.h"
 #include "cli-out.h"
 
+extern void initialize_all_files (void);
+
 #define PROMPT(X) the_prompts.prompt_stack[the_prompts.top + X].prompt
 #define PREFIX(X) the_prompts.prompt_stack[the_prompts.top + X].prefix
 #define SUFFIX(X) the_prompts.prompt_stack[the_prompts.top + X].suffix
@@ -136,9 +138,6 @@ char gdb_dirbuf[1024];
 
 void (*window_hook) (FILE *, char *);
 
-int epoch_interface;
-int xgdb_verbose;
-
 /* Buffer used for reading command lines, and the size
    allocated for it so far.  */
 
@@ -335,7 +334,7 @@ read_command_file (FILE *stream)
 void (*pre_init_ui_hook) (void);
 
 #ifdef __MSDOS__
-void
+static void
 do_chdir_cleanup (void *old_dir)
 {
   chdir (old_dir);
@@ -473,8 +472,10 @@ execute_command (char *p, int from_tty)
       /* c->user_commands would be NULL in the case of a python command.  */
       if (c->class == class_user && c->user_commands)
        execute_user_command (c, arg);
-      else if (c->type == set_cmd || c->type == show_cmd)
-       do_setshow_command (arg, from_tty, c);
+      else if (c->type == set_cmd)
+       do_set_command (arg, from_tty, c);
+      else if (c->type == show_cmd)
+       do_show_command (arg, from_tty, c);
       else if (!cmd_func_p (c))
        error (_("That is not a command, just a help topic."));
       else if (deprecated_call_command_hook)
@@ -566,7 +567,7 @@ command_loop (void)
       if (window_hook && instream == stdin)
        (*window_hook) (instream, get_prompt ());
 
-      quit_flag = 0;
+      clear_quit_flag ();
       if (instream == stdin && stdin_is_tty)
        reinitialize_more_filter ();
       old_chain = make_cleanup (null_cleanup, 0);
@@ -707,7 +708,7 @@ show_write_history_p (struct ui_file *file, int from_tty,
                    value);
 }
 
-static int history_size;
+static unsigned int history_size;
 static void
 show_history_size (struct ui_file *file, int from_tty,
                   struct cmd_list_element *c, const char *value)
@@ -941,6 +942,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix)
   /* Control-C quits instantly if typed while in this loop
      since it should not wait until the user types a newline.  */
   immediate_quit++;
+  QUIT;
 #ifdef STOP_SIGNAL
   if (job_control)
     signal (STOP_SIGNAL, handle_stop_sig);
@@ -1119,7 +1121,7 @@ print_gdb_version (struct ui_file *stream)
   /* Second line is a copyright notice.  */
 
   fprintf_filtered (stream,
-                   "Copyright (C) 2012 Free Software Foundation, Inc.\n");
+                   "Copyright (C) 2013 Free Software Foundation, Inc.\n");
 
   /* Following the copyright is a brief statement that the program is
      free software, that users are free to copy and change it on
@@ -1376,7 +1378,7 @@ show_commands (char *args, int from_tty)
 
   /* The first command in the history which doesn't exist (i.e. one more
      than the number of the last command).  Relative to history_base.  */
-  int hist_len;
+  unsigned int hist_len;
 
   /* Print out some of the commands from the command history.  */
   /* First determine the length of the history list.  */
@@ -1441,15 +1443,16 @@ show_commands (char *args, int from_tty)
 static void
 set_history_size_command (char *args, int from_tty, struct cmd_list_element *c)
 {
-  if (history_size == INT_MAX)
-    unstifle_history ();
-  else if (history_size >= 0)
-    stifle_history (history_size);
-  else
+  /* The type of parameter in stifle_history is int, so values from INT_MAX up
+     mean 'unlimited'.  */
+  if (history_size >= INT_MAX)
     {
-      history_size = INT_MAX;
-      error (_("History size must be non-negative"));
+      /* Ensure that 'show history size' prints 'unlimited'.  */
+      history_size = UINT_MAX;
+      unstifle_history ();
     }
+  else
+    stifle_history (history_size);
 }
 
 void
@@ -1559,6 +1562,15 @@ show_exec_done_display_p (struct ui_file *file, int from_tty,
                            "asynchronous execution commands is %s.\n"),
                    value);
 }
+
+/* "set" command for the gdb_datadir configuration variable.  */
+
+static void
+set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
+{
+  observer_notify_gdb_datadir_changed ();
+}
+
 static void
 init_main (void)
 {
@@ -1620,13 +1632,13 @@ Without an argument, saving is enabled."),
                           show_write_history_p,
                           &sethistlist, &showhistlist);
 
-  add_setshow_integer_cmd ("size", no_class, &history_size, _("\
+  add_setshow_uinteger_cmd ("size", no_class, &history_size, _("\
 Set the size of the command history,"), _("\
 Show the size of the command history,"), _("\
 ie. the number of previous commands to keep a record of."),
-                          set_history_size_command,
-                          show_history_size,
-                          &sethistlist, &showhistlist);
+                           set_history_size_command,
+                           show_history_size,
+                           &sethistlist, &showhistlist);
 
   add_setshow_filename_cmd ("filename", no_class, &history_filename, _("\
 Set the filename in which to record the command history"), _("\
@@ -1666,7 +1678,7 @@ Use \"on\" to enable the notification, and \"off\" to disable it."),
                            _("Show GDB's data directory."),
                            _("\
 When set, GDB uses the specified path to search for data files."),
-                           NULL, NULL,
+                           set_gdb_datadir, NULL,
                            &setlist,
                            &showlist);
 }
@@ -1701,6 +1713,7 @@ gdb_init (char *argv0)
   initialize_inferiors ();
   initialize_current_architecture ();
   init_cli_cmds();
+  initialize_event_loop ();
   init_main ();                        /* But that omits this file!  Do it now.  */
 
   initialize_stdin_serial ();
This page took 0.034534 seconds and 4 git commands to generate.