* symfile.c (alloc_section_addr_info): Update header. Don't set
[deliverable/binutils-gdb.git] / gdb / top.c
index 061ad48f41e756cc22032490543f7a77037e8d10..e06c5ee7760fcebe101495a7b0680b2e7a979be9 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"
@@ -65,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
@@ -137,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.  */
 
@@ -336,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);
@@ -434,13 +432,15 @@ execute_command (char *p, int from_tty)
     p++;
   if (*p)
     {
+      const char *cmd = p;
       char *arg;
       line = p;
 
       /* If trace-commands is set then this will print this command.  */
       print_command_trace (p);
 
-      c = lookup_cmd (&p, cmdlist, "", 0, 1);
+      c = lookup_cmd (&cmd, cmdlist, "", 0, 1);
+      p = (char *) cmd;
 
       /* Pass null arg rather than an empty one.  */
       arg = *p ? p : 0;
@@ -469,13 +469,15 @@ execute_command (char *p, int from_tty)
       execute_cmd_pre_hook (c);
 
       if (c->flags & DEPRECATED_WARN_USER)
-       deprecated_cmd_warning (&line);
+       deprecated_cmd_warning (line);
 
       /* 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)
@@ -567,7 +569,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);
@@ -708,7 +710,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)
@@ -942,6 +944,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);
@@ -1120,7 +1123,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
@@ -1292,7 +1295,7 @@ quit_target (void *arg)
 
   /* Give all pushed targets a chance to do minimal cleanup, and pop
      them all out.  */
-  pop_all_targets (1);
+  pop_all_targets ();
 
   /* Save the history information if it is appropriate to do so.  */
   if (write_history_p && history_filename)
@@ -1377,7 +1380,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.  */
@@ -1442,15 +1445,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
@@ -1473,7 +1477,7 @@ int info_verbose = 0;             /* Default verbose msgs off.  */
 void
 set_verbose (char *args, int from_tty, struct cmd_list_element *c)
 {
-  char *cmdname = "verbose";
+  const char *cmdname = "verbose";
   struct cmd_list_element *showcmd;
 
   showcmd = lookup_cmd_1 (&cmdname, showlist, NULL, 1);
@@ -1630,13 +1634,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"), _("\
@@ -1711,6 +1715,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.039457 seconds and 4 git commands to generate.