/* 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.
#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"
#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
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. */
void (*pre_init_ui_hook) (void);
#ifdef __MSDOS__
-void
+static void
do_chdir_cleanup (void *old_dir)
{
chdir (old_dir);
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;
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)
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);
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)
/* 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);
/* 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
/* 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)
/* 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. */
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
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);
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"), _("\
initialize_inferiors ();
initialize_current_architecture ();
init_cli_cmds();
+ initialize_event_loop ();
init_main (); /* But that omits this file! Do it now. */
initialize_stdin_serial ();