diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-02-03 21:13:29 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-02-03 21:13:29 +0000 |
commit | 41d5c6ad6b8530d4f2df97ccb4bad485260d06cf (patch) | |
tree | 34510bd322dce4f40b5d2306571aeef12af2a077 | |
parent | f4f0e87853e67c845fec3c681e61cfa881834a3d (diff) | |
download | gdb-41d5c6ad6b8530d4f2df97ccb4bad485260d06cf.tar.gz |
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.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/Makefile.in | 2 | ||||
-rw-r--r-- | gdb/main.c | 57 | ||||
-rw-r--r-- | gdb/testsuite/lib/mi-support.exp | 20 | ||||
-rw-r--r-- | gdb/top.c | 27 |
5 files changed, 74 insertions, 40 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index de814f0d895..5a1b7db165f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +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. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 730d6e54686..b15e71f72f7 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1876,7 +1876,7 @@ macrotab.o: macrotab.c $(defs_h) $(gdb_obstack_h) $(splay_tree_h) \ $(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) diff --git a/gdb/main.c b/gdb/main.c index fdc5c1bb5f6..754e836768c 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -37,6 +37,7 @@ #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. */ @@ -234,6 +235,12 @@ captured_main (void *data) #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; @@ -388,6 +395,7 @@ extern int gdbtk_test (char *); } #endif /* GDBTK */ case 'i': + xfree (interpreter_p); interpreter_p = xstrdup (optarg); break; case 'd': @@ -516,7 +524,10 @@ extern int gdbtk_test (char *); 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); @@ -532,7 +543,49 @@ extern int gdbtk_test (char *); 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). */ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp index f7eb2652e4f..b9c9d3c138c 100644 --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -127,22 +127,22 @@ proc mi_gdb_start { } { # 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 $" { diff --git a/gdb/top.c b/gdb/top.c index d93a98db193..e488450808b 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -2126,31 +2126,4 @@ gdb_init (char *argv0) 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); - } - } } |