/* Top level stuff for GDB, the GNU debugger.
- Copyright (C) 1986-2015 Free Software Foundation, Inc.
+ Copyright (C) 1986-2016 Free Software Foundation, Inc.
This file is part of GDB.
do_setshow_command will free it. */
char *interpreter_p;
-/* Whether xdb commands will be handled. */
-int xdb_commands = 0;
-
/* Whether dbx commands will be handled. */
int dbx_commands = 0;
the possibly relocated path to python's lib directory. */
char *python_libdir = 0;
-struct ui_file *gdb_stdout;
-struct ui_file *gdb_stderr;
-struct ui_file *gdb_stdlog;
-struct ui_file *gdb_stdin;
/* Target IO streams. */
struct ui_file *gdb_stdtargin;
struct ui_file *gdb_stdtarg;
for (p = tmp_sys_gdbinit; IS_DIR_SEPARATOR (*p); ++p)
continue;
relocated_sysgdbinit = concat (gdb_datadir, SLASH_STRING, p,
- NULL);
+ (char *) NULL);
xfree (tmp_sys_gdbinit);
}
else
#ifdef HAVE_SIGALTSTACK
stack_t ss;
- ss.ss_sp = xmalloc (SIGSTKSZ);
+ /* FreeBSD versions older than 11.0 use char * for ss_sp instead of
+ void *. This cast works with both types. */
+ ss.ss_sp = (char *) xmalloc (SIGSTKSZ);
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
static int
captured_command_loop (void *data)
{
+ struct ui *ui = current_ui;
+
/* Top-level execution commands can be run in the background from
here on. */
- interpreter_async = 1;
+ current_ui->async = 1;
current_interp_command_loop ();
/* FIXME: cagney/1999-11-05: A correct command_loop() implementaton
error) we try to quit. If the quit is aborted, catch_errors()
which called this catch the signal and restart the command
loop. */
- quit_command (NULL, instream == stdin);
+ quit_command (NULL, ui->instream == stdin);
return 1;
}
static int
captured_main (void *data)
{
- struct captured_main_args *context = data;
+ struct ui *ui = current_ui;
+ struct captured_main_args *context = (struct captured_main_args *) data;
int argc = context->argc;
char **argv = context->argv;
static int quiet = 0;
dirarg = (char **) xmalloc (dirsize * sizeof (*dirarg));
ndir = 0;
- clear_quit_flag ();
- saved_command_line = (char *) xmalloc (saved_command_line_size);
- saved_command_line[0] = '\0';
- instream = stdin;
+ saved_command_line = (char *) xstrdup ("");
+ ui->instream = stdin;
#ifdef __MINGW32__
/* Ensure stderr is unbuffered. A Cygwin pty or pipe is implemented
#ifdef WITH_PYTHON_PATH
{
/* For later use in helping Python find itself. */
- char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", NULL);
+ char *tmp = concat (WITH_PYTHON_PATH, SLASH_STRING, "lib", (char *) NULL);
python_libdir = relocate_gdb_directory (tmp, PYTHON_PATH_RELOCATABLE);
xfree (tmp);
static struct option long_options[] =
{
{"tui", no_argument, 0, OPT_TUI},
- {"xdb", no_argument, &xdb_commands, 1},
{"dbx", no_argument, &dbx_commands, 1},
{"readnow", no_argument, &readnow_symbol_files, 1},
{"r", no_argument, &readnow_symbol_files, 1},
/* Try to set up an alternate signal stack for SIGSEGV handlers. */
setup_alternate_signal_stack ();
- /* Initialize all files. Give the interpreter a chance to take
- control of the console via the deprecated_init_ui_hook (). */
+ /* Initialize all files. */
gdb_init (gdb_program_name);
/* Now that gdb_init has created the initial inferior, we're in
{
/* Find it. */
- struct interp *interp = interp_lookup (interpreter_p);
+ struct interp *interp = interp_lookup (current_ui, interpreter_p);
if (interp == NULL)
error (_("Interpreter `%s' unrecognized"), interpreter_p);
#endif
fputs_unfiltered (_("\
--dbx DBX compatibility mode.\n\
- --xdb XDB compatibility mode.\n\
-q, --quiet, --silent\n\
Do not print version number on startup.\n\n\
"), stream);