/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2013 Free Software Foundation, Inc.
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include "cli/cli-decode.h"
#include "symtab.h"
#include "inferior.h"
+#include "infrun.h"
#include "exceptions.h"
#include <signal.h>
#include "target.h"
+#include "target-dcache.h"
#include "breakpoint.h"
#include "gdbtypes.h"
#include "expression.h"
#include "version.h"
#include "serial.h"
#include "doublest.h"
-#include "gdb_assert.h"
#include "main.h"
#include "event-loop.h"
#include "gdbthread.h"
-#include "python/python.h"
+#include "extension.h"
#include "interps.h"
#include "observer.h"
#include "maint.h"
#include <sys/types.h>
#include "event-top.h"
-#include <string.h>
#include <sys/stat.h>
#include <ctype.h>
#include "ui-out.h"
#include "cli-out.h"
#include "tracepoint.h"
+#include "inf-loop.h"
extern void initialize_all_files (void);
int inhibit_gdbinit = 0;
-/* If nonzero, and GDB has been configured to be able to use windows,
- attempt to open them upon startup. */
-
-int use_windows = 0;
-
extern char lang_frame_mismatch_warn[]; /* language.c */
/* Flag for whether we want to confirm potentially dangerous
void (*deprecated_call_command_hook) (struct cmd_list_element * c,
char *cmd, int from_tty);
-/* Called after a `set' command has finished. Is only run if the
- `set' command succeeded. */
-
-void (*deprecated_set_hook) (struct cmd_list_element * c);
-
/* Called when the current thread changes. Argument is thread id. */
void (*deprecated_context_hook) (int id);
{
const char *cmd = p;
char *arg;
+ int was_sync = sync_execution;
+
line = p;
/* If trace-commands is set then this will print this command. */
/* If this command has been pre-hooked, run the hook first. */
execute_cmd_pre_hook (c);
- if (c->flags & DEPRECATED_WARN_USER)
+ if (c->deprecated_warn_user)
deprecated_cmd_warning (line);
/* c->user_commands would be NULL in the case of a python command. */
command's list, running command hooks or similars), and we
just ran a synchronous command that started the target, wait
for that command to end. */
- if (!interpreter_async && sync_execution)
+ if (!interpreter_async && !was_sync && sync_execution)
{
while (gdb_do_one_event () >= 0)
if (!sync_execution)
make_command_stats_cleanup (1);
- execute_command (command, instream == stdin);
-
- /* Do any commands attached to breakpoint we are stopped at. */
- bpstat_do_actions ();
+ /* Do not execute commented lines. */
+ if (command[0] != '#')
+ {
+ execute_command (command, instream == stdin);
+ /* Do any commands attached to breakpoint we are stopped at. */
+ bpstat_do_actions ();
+ }
do_cleanups (old_chain);
}
}
after_char_processing_hook = NULL;
/* Prevent parts of the prompt from being redisplayed if annotations
- are enabled, and readline's state getting out of sync. */
+ are enabled, and readline's state getting out of sync. We'll
+ restore it in gdb_readline_wrapper_cleanup. */
if (async_command_editing_p)
rl_callback_handler_remove ();
}
{
void (*handler_orig) (char *);
int already_prompted_orig;
+
+ /* Whether the target was async. */
+ int target_is_async_orig;
};
static void
gdb_assert (input_handler == gdb_readline_wrapper_line);
input_handler = cleanup->handler_orig;
+
+ /* Reinstall INPUT_HANDLER in readline, without displaying a
+ prompt. */
+ if (async_command_editing_p)
+ rl_callback_handler_install (NULL, input_handler);
+
gdb_readline_wrapper_result = NULL;
gdb_readline_wrapper_done = 0;
after_char_processing_hook = saved_after_char_processing_hook;
saved_after_char_processing_hook = NULL;
+ if (cleanup->target_is_async_orig)
+ target_async (inferior_event_handler, 0);
+
xfree (cleanup);
}
cleanup->already_prompted_orig = rl_already_prompted;
+ cleanup->target_is_async_orig = target_is_async_p ();
+
back_to = make_cleanup (gdb_readline_wrapper_cleanup, cleanup);
+ if (cleanup->target_is_async_orig)
+ target_async (NULL, NULL);
+
/* Display our prompt and prevent double prompt display. */
display_gdb_prompt (prompt);
rl_already_prompted = 1;
if (*linebuffer && input_from_terminal_p ())
add_history (linebuffer);
- /* Note: lines consisting solely of comments are added to the command
- history. This is useful when you type a command, and then
- realize you don't want to execute it quite yet. You can comment
- out the command and then later fetch it from the value history
- and remove the '#'. The kill ring is probably better, but some
- people are in the habit of commenting things out. */
- if (*p1 == '#')
- *p1 = '\0'; /* Found a comment. */
-
/* Save into global buffer if appropriate. */
if (repeat)
{
/* Second line is a copyright notice. */
fprintf_filtered (stream,
- "Copyright (C) 2013 Free Software Foundation, Inc.\n");
+ "Copyright (C) 2014 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
--with-python=%s%s\n\
"), WITH_PYTHON_PATH, PYTHON_PATH_RELOCATABLE ? " (relocatable)" : "");
#endif
+#if HAVE_GUILE
+ fprintf_filtered (stream, _("\
+ --with-guile\n\
+"));
+#else
+ fprintf_filtered (stream, _("\
+ --without-guile\n\
+"));
+#endif
#ifdef RELOC_SRCDIR
fprintf_filtered (stream, _("\
--with-relocated-sources=%s\n\
{
printf_unfiltered (_("\"set history\" must be followed "
"by the name of a history subcommand.\n"));
- help_list (sethistlist, "set history ", -1, gdb_stdout);
+ help_list (sethistlist, "set history ", all_commands, gdb_stdout);
}
void
value);
}
+/* New values of the "data-directory" parameter are staged here. */
+static char *staged_gdb_datadir;
+
/* "set" command for the gdb_datadir configuration variable. */
static void
set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
{
+ set_gdb_data_directory (staged_gdb_datadir);
observer_notify_gdb_datadir_changed ();
}
+/* "show" command for the gdb_datadir configuration variable. */
+
+static void
+show_gdb_datadir (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("GDB's data directory is \"%s\".\n"),
+ gdb_datadir);
+}
+
static void
set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
{
&setlist, &showlist);
add_setshow_filename_cmd ("data-directory", class_maintenance,
- &gdb_datadir, _("Set GDB's data directory."),
+ &staged_gdb_datadir, _("Set GDB's data directory."),
_("Show GDB's data directory."),
_("\
When set, GDB uses the specified path to search for data files."),
- set_gdb_datadir, NULL,
+ set_gdb_datadir, show_gdb_datadir,
&setlist,
&showlist);
}
if (deprecated_init_ui_hook)
deprecated_init_ui_hook (argv0);
-#ifdef HAVE_PYTHON
- /* Python initialization can require various commands to be
+ /* Python initialization, for example, can require various commands to be
installed. For example "info pretty-printer" needs the "info"
prefix to be installed. Keep things simple and just do final
- python initialization here. */
- finish_python_initialization ();
-#endif
+ script initialization here. */
+ finish_ext_lang_initialization ();
}