diff options
Diffstat (limited to 'gdb/top.c')
-rw-r--r-- | gdb/top.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/gdb/top.c b/gdb/top.c index dcffb051436..d93a98db193 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -63,6 +63,7 @@ #include <ctype.h> #include "ui-out.h" #include "cli-out.h" +#include "interps.h" /* Default command line prompt. This is overriden in some configs. */ @@ -2126,17 +2127,30 @@ gdb_init (char *argv0) init_ui_hook (argv0); /* Install the default UI */ - if (!init_ui_hook) - { - uiout = cli_out_new (gdb_stdout); + /* All the interpreters should have had a look at things by now. + Initialize the selected interpreter. */ + { - /* All the interpreters should have had a look at things by now. - Initialize the selected interpreter. */ - if (interpreter_p) - { - fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n", - interpreter_p); - exit (1); - } - } + /* There will always be an interpreter. Either the one specified + by the user at start up or the console. */ + + struct gdb_interpreter *interp; + if (interpreter_p == NULL) + interpreter_p = xstrdup (GDB_INTERPRETER_CONSOLE); + + interp = gdb_interpreter_lookup (interpreter_p); + + if (interp == NULL) + { + fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n", + interpreter_p); + exit (1); + } + if (!gdb_interpreter_set (interp)) + { + fprintf_unfiltered (gdb_stderr, "Interpreter `%s' failed to initialize.\n", + interpreter_p); + exit (1); + } + } } |