Remove MI version 1

MI version 1 is long since obsolete.  Several years ago, I filed
PR mi/23170 for this.  I think it's finally time to remove this.
Any users of MI 1 can and should upgrade to a newer version.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23170
This commit is contained in:
Tom Tromey
2022-08-10 14:42:22 -06:00
parent d1c34a1b4c
commit 975249ff4e
11 changed files with 11 additions and 126 deletions

View File

@@ -3,6 +3,8 @@
*** Changes since GDB 13 *** Changes since GDB 13
* MI version 1 has been removed.
*** Changes in GDB 13 *** Changes in GDB 13
* MI version 1 is deprecated, and will be removed in GDB 14. * MI version 1 is deprecated, and will be removed in GDB 14.

View File

@@ -29150,10 +29150,6 @@ The @sc{gdb/mi} interface introduced in @value{GDBN} 9.1.
@cindex mi2 interpreter @cindex mi2 interpreter
The @sc{gdb/mi} interface introduced in @value{GDBN} 6.0. The @sc{gdb/mi} interface introduced in @value{GDBN} 6.0.
@item mi1
@cindex mi1 interpreter
The @sc{gdb/mi} interface introduced in @value{GDBN} 5.1.
@end table @end table
@cindex invoke another interpreter @cindex invoke another interpreter

View File

@@ -175,7 +175,6 @@ extern void interpreter_completer (struct cmd_list_element *ignore,
/* well-known interpreters */ /* well-known interpreters */
#define INTERP_CONSOLE "console" #define INTERP_CONSOLE "console"
#define INTERP_MI1 "mi1"
#define INTERP_MI2 "mi2" #define INTERP_MI2 "mi2"
#define INTERP_MI3 "mi3" #define INTERP_MI3 "mi3"
#define INTERP_MI4 "mi4" #define INTERP_MI4 "mi4"

View File

@@ -1124,31 +1124,11 @@ captured_main_1 (struct captured_main_args *context)
exit (0); exit (0);
} }
/* 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 && interpreter_p == INTERP_MI1)
{
/* 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, true);
if (symarg)
gdb_printf ("..");
gdb_printf ("\n");
gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
}
/* Install the default UI. All the interpreters should have had a /* Install the default UI. All the interpreters should have had a
look at things by now. Initialize the default interpreter. */ look at things by now. Initialize the default interpreter. */
set_top_level_interpreter (interpreter_p.c_str ()); set_top_level_interpreter (interpreter_p.c_str ());
/* FIXME: cagney/2003-02-03: The big hack (part 2 of 2) that lets if (!quiet)
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 && !current_interp_named_p (INTERP_MI1))
{ {
/* Print all the junk at the top, with trailing "..." if we are /* Print all the junk at the top, with trailing "..." if we are
about to read a symbol file (possibly slowly). */ about to read a symbol file (possibly slowly). */

View File

@@ -65,14 +65,6 @@ mi_cmd_env_pwd (const char *command, char **argv, int argc)
if (argc > 0) if (argc > 0)
error (_("-environment-pwd: No arguments allowed")); error (_("-environment-pwd: No arguments allowed"));
if (mi_version (uiout) < 2)
{
env_execute_cli_command ("pwd", NULL);
return;
}
/* Otherwise the mi level is 2 or higher. */
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0)); gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
if (cwd == NULL) if (cwd == NULL)
error (_("-environment-pwd: error finding name of working directory: %s"), error (_("-environment-pwd: error finding name of working directory: %s"),
@@ -126,14 +118,6 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
dont_repeat (); dont_repeat ();
if (mi_version (uiout) < 2)
{
for (i = argc - 1; i >= 0; --i)
env_execute_cli_command ("path", argv[i]);
return;
}
/* Otherwise the mi level is 2 or higher. */
while (1) while (1)
{ {
int opt = mi_getopt ("-environment-path", argc, argv, opts, int opt = mi_getopt ("-environment-path", argc, argv, opts,
@@ -199,14 +183,6 @@ mi_cmd_env_dir (const char *command, char **argv, int argc)
dont_repeat (); dont_repeat ();
if (mi_version (uiout) < 2)
{
for (i = argc - 1; i >= 0; --i)
env_execute_cli_command ("dir", argv[i]);
return;
}
/* Otherwise mi level is 2 or higher. */
while (1) while (1)
{ {
int opt = mi_getopt ("-environment-directory", argc, argv, opts, int opt = mi_getopt ("-environment-directory", argc, argv, opts,

View File

@@ -390,15 +390,7 @@ mi_cmd_var_list_children (const char *command, char **argv, int argc)
if (from < to) if (from < to)
{ {
/* For historical reasons this might emit a list or a tuple, so ui_out_emit_list list_emitter (uiout, "children");
we construct one or the other. */
gdb::optional<ui_out_emit_tuple> tuple_emitter;
gdb::optional<ui_out_emit_list> list_emitter;
if (mi_version (uiout) == 1)
tuple_emitter.emplace (uiout, "children");
else
list_emitter.emplace (uiout, "children");
for (int ix = from; ix < to && ix < children.size (); ix++) for (int ix = from; ix < to && ix < children.size (); ix++)
{ {
ui_out_emit_tuple child_emitter (uiout, "child"); ui_out_emit_tuple child_emitter (uiout, "child");
@@ -633,15 +625,7 @@ mi_cmd_var_update (const char *command, char **argv, int argc)
else else
print_values = PRINT_NO_VALUES; print_values = PRINT_NO_VALUES;
/* For historical reasons this might emit a list or a tuple, so we ui_out_emit_list list_emitter (uiout, "changelist");
construct one or the other. */
gdb::optional<ui_out_emit_tuple> tuple_emitter;
gdb::optional<ui_out_emit_list> list_emitter;
if (mi_version (uiout) <= 1)
tuple_emitter.emplace (uiout, "changelist");
else
list_emitter.emplace (uiout, "changelist");
/* Check if the parameter is a "*", which means that we want to /* Check if the parameter is a "*", which means that we want to
update all variables. */ update all variables. */
@@ -680,9 +664,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{ {
int from, to; int from, to;
gdb::optional<ui_out_emit_tuple> tuple_emitter; ui_out_emit_tuple tuple_emitter (uiout, nullptr);
if (mi_version (uiout) > 1)
tuple_emitter.emplace (uiout, nullptr);
uiout->field_string ("name", varobj_get_objname (r.varobj)); uiout->field_string ("name", varobj_get_objname (r.varobj));
switch (r.status) switch (r.status)

View File

@@ -1317,7 +1317,6 @@ void
_initialize_mi_interp () _initialize_mi_interp ()
{ {
/* The various interpreter levels. */ /* The various interpreter levels. */
interp_factory_register (INTERP_MI1, mi_interp_factory);
interp_factory_register (INTERP_MI2, mi_interp_factory); interp_factory_register (INTERP_MI2, mi_interp_factory);
interp_factory_register (INTERP_MI3, mi_interp_factory); interp_factory_register (INTERP_MI3, mi_interp_factory);
interp_factory_register (INTERP_MI4, mi_interp_factory); interp_factory_register (INTERP_MI4, mi_interp_factory);

View File

@@ -1856,7 +1856,6 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
/* If we changed interpreters, DON'T print out anything. */ /* If we changed interpreters, DON'T print out anything. */
if (current_interp_named_p (INTERP_MI) if (current_interp_named_p (INTERP_MI)
|| current_interp_named_p (INTERP_MI1)
|| current_interp_named_p (INTERP_MI2) || current_interp_named_p (INTERP_MI2)
|| current_interp_named_p (INTERP_MI3) || current_interp_named_p (INTERP_MI3)
|| current_interp_named_p (INTERP_MI4)) || current_interp_named_p (INTERP_MI4))

View File

@@ -348,9 +348,6 @@ mi_out_new (const char *mi_version)
if (streq (mi_version, INTERP_MI2)) if (streq (mi_version, INTERP_MI2))
return new mi_ui_out (2); return new mi_ui_out (2);
if (streq (mi_version, INTERP_MI1))
return new mi_ui_out (1);
return nullptr; return nullptr;
} }

View File

@@ -52,15 +52,6 @@ gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" {
} }
} }
gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" { gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " { -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
pass $gdb_test_name pass $gdb_test_name

View File

@@ -264,27 +264,7 @@ proc default_mi_gdb_start { { flags {} } } {
gdb_expect { gdb_expect {
-re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" { -re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" {
# We have a new format mi startup prompt. If we are # We have a new format mi startup prompt.
# 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
unset gdb_spawn_id
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
unset gdb_spawn_id
return -1
}
verbose "GDB initialized." verbose "GDB initialized."
} }
-re ".*unrecognized option.*for a complete list of options." { -re ".*unrecognized option.*for a complete list of options." {
@@ -399,27 +379,11 @@ proc mi_gdb_reinitialize_dir { subdir } {
return "" return ""
} }
if { $MIFLAGS == "-i=mi1" } { send_gdb "104-environment-directory -r\n"
send_gdb "104-environment-directory\n" gdb_expect 60 {
gdb_expect 60 { -re "104\\\^done,source-path=.*\r\n$mi_gdb_prompt$" {}
-re ".*Reinitialize source path to empty.*y or n. " {
warning "Got confirmation prompt for dir reinitialization."
send_gdb "y\n"
gdb_expect 60 {
-re "$mi_gdb_prompt$" {}
timeout {error "Dir reinitialization failed (timeout)"}
}
}
-re "$mi_gdb_prompt$" {} -re "$mi_gdb_prompt$" {}
timeout {error "Dir reinitialization failed (timeout)"} timeout {error "Dir reinitialization failed (timeout)"}
}
} else {
send_gdb "104-environment-directory -r\n"
gdb_expect 60 {
-re "104\\\^done,source-path=.*\r\n$mi_gdb_prompt$" {}
-re "$mi_gdb_prompt$" {}
timeout {error "Dir reinitialization failed (timeout)"}
}
} }
send_gdb "105-environment-directory $subdir\n" send_gdb "105-environment-directory $subdir\n"