* top.c (gdb_init): Move interpreter init code from here ...
* main.c (captured_main): ... to here. Include "interps.h".
(captured_main): Set interpreter_p to a default before parsing the
options.
* Makefile.in (main.o): Update dependencies.
+2003-02-03 Andrew Cagney <ac131313@redhat.com>
+
+ * top.c (gdb_init): Move interpreter init code from here ...
+ * main.c (captured_main): ... to here. Include "interps.h".
+ (captured_main): Set interpreter_p to a default before parsing the
+ options.
+ * Makefile.in (main.o): Update dependencies.
+
2002-11-05 Elena Zannoni <ezannoni@redhat.com>
* defs.h (selected_frame_level_changed_hook): Removed.
$(bcache_h) $(complaints_h)
main.o: main.c $(defs_h) $(top_h) $(target_h) $(inferior_h) $(symfile_h) \
$(gdbcore_h) $(getopt_h) $(gdb_stat_h) $(gdb_string_h) \
- $(event_loop_h) $(ui_out_h) $(main_h)
+ $(event_loop_h) $(ui_out_h) $(main_h) $(interps_h)
maint.o: maint.c $(defs_h) $(command_h) $(gdbcmd_h) $(symtab_h) \
$(gdbtypes_h) $(demangle_h) $(gdbcore_h) $(expression_h) \
$(language_h) $(symfile_h) $(objfiles_h) $(value_h) $(cli_decode_h)
#include "event-loop.h"
#include "ui-out.h"
+#include "interps.h"
#include "main.h"
/* If nonzero, display time usage both at startup and for each command. */
#endif
#endif
+ /* There will always be an interpreter. Either the one passed into
+ this captured main (not yet implemented), or one specified by the
+ user at start up, or the console. Make life easier by always
+ initializing the interpreter to something. */
+ interpreter_p = xstrdup (GDB_INTERPRETER_CONSOLE);
+
/* Parse arguments and options. */
{
int c;
}
#endif /* GDBTK */
case 'i':
+ xfree (interpreter_p);
interpreter_p = xstrdup (optarg);
break;
case 'd':
gdb_init (argv[0]);
/* Do these (and anything which might call wrap_here or *_filtered)
- after initialize_all_files. */
+ after initialize_all_files() but before the interpreter has been
+ installed. Otherwize the help/version messages will be eaten by
+ the interpreter's output handler. */
+
if (print_version)
{
print_gdb_version (gdb_stdout);
exit (0);
}
- if (!quiet)
+ /* FIXME: cagney/2003-02-03: The big hack (part 1 of 2) that lets
+ GDB retain the old MI1 interpreter startup behavior. Output the
+ copyright message before the interpreter is installed. That way
+ it isn't encapsulated in MI output. */
+ if (!quiet && strcmp (interpreter_p, GDB_INTERPRETER_MI1) == 0)
+ {
+ /* Print all the junk at the top, with trailing "..." if we are about
+ to read a symbol file (possibly slowly). */
+ print_gdb_version (gdb_stdout);
+ if (symarg)
+ printf_filtered ("..");
+ wrap_here ("");
+ gdb_flush (gdb_stdout); /* Force to screen during slow operations */
+ }
+
+
+ /* Install the default UI. All the interpreters should have had a
+ look at things by now. Initialize the default interpreter. */
+
+ {
+ /* Find it. */
+ struct gdb_interpreter *interp = gdb_interpreter_lookup (interpreter_p);
+ if (interp == NULL)
+ {
+ fprintf_unfiltered (gdb_stderr, "Interpreter `%s' unrecognized.\n",
+ interpreter_p);
+ exit (1);
+ }
+ /* Install it. */
+ if (!gdb_interpreter_set (interp))
+ {
+ fprintf_unfiltered (gdb_stderr,
+ "Interpreter `%s' failed to initialize.\n",
+ interpreter_p);
+ exit (1);
+ }
+ }
+
+ /* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets
+ GDB retain the old MI1 interpreter startup behavior. Output the
+ copyright message after the interpreter is installed when it is
+ any sane interpreter. */
+ if (!quiet && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
{
/* Print all the junk at the top, with trailing "..." if we are about
to read a symbol file (possibly slowly). */
# We have a new format mi startup prompt. If we are
# running mi1, then this is an error as we should be
# using the old-style prompt.
-# if { $MIFLAGS == "-i=mi1" } {
-# perror "(mi startup) Got unexpected new mi prompt."
-# remote_close host;
-# return -1;
-# }
+ if { $MIFLAGS == "-i=mi1" } {
+ perror "(mi startup) Got unexpected new mi prompt."
+ remote_close host;
+ return -1;
+ }
verbose "GDB initialized."
}
-re "\[^~\].*$mi_gdb_prompt$" {
# We have an old format mi startup prompt. If we are
# not running mi1, then this is an error as we should be
# using the new-style prompt.
-# if { $MIFLAGS != "-i=mi1" } {
-# perror "(mi startup) Got unexpected old mi prompt."
-# remote_close host;
-# return -1;
-# }
+ if { $MIFLAGS != "-i=mi1" } {
+ perror "(mi startup) Got unexpected old mi prompt."
+ remote_close host;
+ return -1;
+ }
verbose "GDB initialized."
}
-re ".*$gdb_prompt $" {
if (init_ui_hook)
init_ui_hook (argv0);
- /* Install the default UI */
- /* All the interpreters should have had a look at things by now.
- Initialize the selected interpreter. */
- {
-
- /* 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);
- }
- }
}