/* 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 "gdbthread.h"
#include "python/python.h"
#include "interps.h"
+#include "observer.h"
/* readline include files. */
#include "readline/readline.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);
/* 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
/* 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
"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)
{
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"), _("\
_("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);
}
initialize_inferiors ();
initialize_current_architecture ();
init_cli_cmds();
+ initialize_event_loop ();
init_main (); /* But that omits this file! Do it now. */
initialize_stdin_serial ();