public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Remove MI version 1
@ 2022-08-10 21:43 Tom Tromey
  2022-08-10 21:43 ` [PATCH 1/2] Remove vestiges of MI version 0 Tom Tromey
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tom Tromey @ 2022-08-10 21:43 UTC (permalink / raw)
  To: gdb-patches

MI version 1 is long since obsolete.  This series removes it, and
removes some leftovers from MI version 0.

Regression tested on x86-64 Fedora 34.

Tom



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] Remove vestiges of MI version 0
  2022-08-10 21:43 [PATCH 0/2] Remove MI version 1 Tom Tromey
@ 2022-08-10 21:43 ` Tom Tromey
  2022-08-10 21:43 ` [PATCH 2/2] Remove MI version 1 Tom Tromey
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-08-10 21:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I found a few vestiges of MI version 0 in the test suite.  This patch
removes them.
---
 gdb/testsuite/lib/mi-support.exp | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index ca56e12b06b..346140745aa 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1424,33 +1424,6 @@ proc mi_continue_to {func} {
     mi_runto_helper $func "continue"
 }
 
-proc mi0_execute_to { cmd reason func args file line extra test } {
-    mi_execute_to_helper "$cmd" "$reason" "$func" "\{$args\}" \
-	"$file" "$line" "$extra" "$test"
-}
-
-proc mi0_next_to { func args file line test } {
-    mi0_execute_to "exec-next" "end-stepping-range" "$func" "$args" \
-	"$file" "$line" "" "$test"
-}
-
-proc mi0_step_to { func args file line test } {
-    mi0_execute_to "exec-step" "end-stepping-range" "$func" "$args" \
-	"$file" "$line" "" "$test"
-}
-
-proc mi0_finish_to { func args file line result ret test } {
-    mi0_execute_to "exec-finish" "function-finished" "$func" "$args" \
-	"$file" "$line" \
-	",gdb-result-var=\"$result\",return-value=\"$ret\"" \
-	"$test"
-}
-
-proc mi0_continue_to { bkptno func args file line test } {
-    mi0_execute_to "exec-continue" "breakpoint-hit\",bkptno=\"$bkptno" \
-	"$func" "$args" "$file" "$line" "" "$test"
-}
-
 # Creates a breakpoint and checks the reported fields are as expected.
 # This procedure takes the same options as mi_make_breakpoint and
 # returns the breakpoint regexp from that procedure.
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Remove MI version 1
  2022-08-10 21:43 [PATCH 0/2] Remove MI version 1 Tom Tromey
  2022-08-10 21:43 ` [PATCH 1/2] Remove vestiges of MI version 0 Tom Tromey
@ 2022-08-10 21:43 ` Tom Tromey
  2022-08-23 19:40 ` [PATCH 0/2] " Tom Tromey
  2022-12-19 14:49 ` Tom Tromey
  3 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-08-10 21:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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
---
 gdb/NEWS                          |  2 ++
 gdb/doc/gdb.texinfo               |  4 ---
 gdb/interps.h                     |  1 -
 gdb/main.c                        | 22 +--------------
 gdb/mi/mi-cmd-env.c               | 24 ----------------
 gdb/mi/mi-cmd-var.c               | 24 ++--------------
 gdb/mi/mi-interp.c                |  1 -
 gdb/mi/mi-main.c                  |  1 -
 gdb/mi/mi-out.c                   |  3 --
 gdb/testsuite/gdb.base/interp.exp |  9 ------
 gdb/testsuite/lib/mi-support.exp  | 46 ++++---------------------------
 11 files changed, 11 insertions(+), 126 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 8c837df76e5..8e46e7db008 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,8 @@
 
 *** Changes since GDB 12
 
+* MI version 1 has been removed.
+
 * GDB now supports dumping memory tag data for AArch64 MTE.  It also supports
   reading memory tag data for AArch64 MTE from core files generated by
   the gcore command or the Linux kernel.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 382df00ee7d..7951df6a45d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28984,10 +28984,6 @@ The @sc{gdb/mi} interface introduced in @value{GDBN} 9.1.
 @cindex mi2 interpreter
 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
 
 @cindex invoke another interpreter
diff --git a/gdb/interps.h b/gdb/interps.h
index e393b08c962..762b3baf3b5 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -175,7 +175,6 @@ extern void interpreter_completer (struct cmd_list_element *ignore,
 
 /* well-known interpreters */
 #define INTERP_CONSOLE		"console"
-#define INTERP_MI1             "mi1"
 #define INTERP_MI2             "mi2"
 #define INTERP_MI3             "mi3"
 #define INTERP_MI		"mi"
diff --git a/gdb/main.c b/gdb/main.c
index 8c97987956b..0811dc9cff1 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1123,31 +1123,11 @@ captured_main_1 (struct captured_main_args *context)
       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
      look at things by now.  Initialize the default interpreter.  */
   set_top_level_interpreter (interpreter_p.c_str ());
 
-  /* 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 && !current_interp_named_p (INTERP_MI1))
+  if (!quiet)
     {
       /* Print all the junk at the top, with trailing "..." if we are
 	 about to read a symbol file (possibly slowly).  */
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index 0c75b8042ff..5b077979352 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -65,14 +65,6 @@ mi_cmd_env_pwd (const char *command, char **argv, int argc)
   if (argc > 0)
     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));
   if (cwd == NULL)
     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 ();
 
-  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)
     {
       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 ();
 
-  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)
     {
       int opt = mi_getopt ("-environment-directory", argc, argv, opts,
diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 3db09cf7815..e05866657e3 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -390,15 +390,7 @@ mi_cmd_var_list_children (const char *command, char **argv, int argc)
 
   if (from < to)
     {
-      /* For historical reasons this might emit a list or a tuple, so
-	 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");
+      ui_out_emit_list list_emitter (uiout, "children");
       for (int ix = from; ix < to && ix < children.size (); ix++)
 	{
 	  ui_out_emit_tuple child_emitter (uiout, "child");
@@ -633,15 +625,7 @@ mi_cmd_var_update (const char *command, char **argv, int argc)
   else
     print_values = PRINT_NO_VALUES;
 
-  /* For historical reasons this might emit a list or a tuple, so 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, "changelist");
-  else
-    list_emitter.emplace (uiout, "changelist");
+  ui_out_emit_list list_emitter (uiout, "changelist");
 
   /* Check if the parameter is a "*", which means that we want to
      update all variables.  */
@@ -680,9 +664,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
     {
       int from, to;
 
-      gdb::optional<ui_out_emit_tuple> tuple_emitter;
-      if (mi_version (uiout) > 1)
-	tuple_emitter.emplace (uiout, nullptr);
+      ui_out_emit_tuple tuple_emitter (uiout, nullptr);
       uiout->field_string ("name", varobj_get_objname (r.varobj));
 
       switch (r.status)
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index ae15177890c..11a6cba29e3 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1340,7 +1340,6 @@ void
 _initialize_mi_interp ()
 {
   /* The various interpreter levels.  */
-  interp_factory_register (INTERP_MI1, mi_interp_factory);
   interp_factory_register (INTERP_MI2, mi_interp_factory);
   interp_factory_register (INTERP_MI3, mi_interp_factory);
   interp_factory_register (INTERP_MI, mi_interp_factory);
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 68868e49e99..4dbd9e8f8ae 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1863,7 +1863,6 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
 
 	/* If we changed interpreters, DON'T print out anything.  */
 	if (current_interp_named_p (INTERP_MI)
-	    || current_interp_named_p (INTERP_MI1)
 	    || current_interp_named_p (INTERP_MI2)
 	    || current_interp_named_p (INTERP_MI3))
 	  {
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c
index 567ef83de9b..4afd825ca7b 100644
--- a/gdb/mi/mi-out.c
+++ b/gdb/mi/mi-out.c
@@ -313,9 +313,6 @@ mi_out_new (const char *mi_version)
   if (streq (mi_version, INTERP_MI2))
     return new mi_ui_out (2);
 
-  if (streq (mi_version, INTERP_MI1))
-    return new mi_ui_out (1);
-
   return nullptr;
 }
 
diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp
index f748ffd8050..a1ebaac9b94 100644
--- a/gdb/testsuite/gdb.base/interp.exp
+++ b/gdb/testsuite/gdb.base/interp.exp
@@ -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\"" "" {
     -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
 	pass $gdb_test_name
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 346140745aa..78d0f981aa9 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -264,27 +264,7 @@ proc default_mi_gdb_start { { flags {} } } {
 
     gdb_expect {
 	-re "~\"GNU.*\r\n~\".*$mi_gdb_prompt$" {
-	    # 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
-		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
-	    }
+	    # We have a new format mi startup prompt.
 	    verbose "GDB initialized."
 	}
 	-re ".*unrecognized option.*for a complete list of options." {
@@ -399,27 +379,11 @@ proc mi_gdb_reinitialize_dir { subdir } {
 	return ""
     }
 
-    if { $MIFLAGS == "-i=mi1" } {
-      send_gdb "104-environment-directory\n"
-      gdb_expect 60 {
-	-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)"}
-	    }
-	}
+    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)"}
-      }
-    } 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)"}
-      }
+	timeout {error "Dir reinitialization failed (timeout)"}
     }
 
     send_gdb "105-environment-directory $subdir\n"
-- 
2.34.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Remove MI version 1
  2022-08-10 21:43 [PATCH 0/2] Remove MI version 1 Tom Tromey
  2022-08-10 21:43 ` [PATCH 1/2] Remove vestiges of MI version 0 Tom Tromey
  2022-08-10 21:43 ` [PATCH 2/2] Remove MI version 1 Tom Tromey
@ 2022-08-23 19:40 ` Tom Tromey
  2022-08-23 19:42   ` Simon Marchi
  2022-12-19 14:49 ` Tom Tromey
  3 siblings, 1 reply; 6+ messages in thread
From: Tom Tromey @ 2022-08-23 19:40 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> MI version 1 is long since obsolete.  This series removes it, and
Tom> removes some leftovers from MI version 0.

Tom> Regression tested on x86-64 Fedora 34.

While I doubt anyone is using MI 1, I wonder if we would rather
deprecate it for gdb 13 and only remove it in 14, out of an abundance of
caution.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Remove MI version 1
  2022-08-23 19:40 ` [PATCH 0/2] " Tom Tromey
@ 2022-08-23 19:42   ` Simon Marchi
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Marchi @ 2022-08-23 19:42 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches




On 2022-08-23 15:40, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
> 
> Tom> MI version 1 is long since obsolete.  This series removes it, and
> Tom> removes some leftovers from MI version 0.
> 
> Tom> Regression tested on x86-64 Fedora 34.
> 
> While I doubt anyone is using MI 1, I wonder if we would rather
> deprecate it for gdb 13 and only remove it in 14, out of an abundance of
> caution.
> 
> Tom

If there is no rush in removing it, I think this is a good plan.

Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Remove MI version 1
  2022-08-10 21:43 [PATCH 0/2] Remove MI version 1 Tom Tromey
                   ` (2 preceding siblings ...)
  2022-08-23 19:40 ` [PATCH 0/2] " Tom Tromey
@ 2022-12-19 14:49 ` Tom Tromey
  3 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-12-19 14:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> MI version 1 is long since obsolete.  This series removes it, and
Tom> removes some leftovers from MI version 0.

Tom> Regression tested on x86-64 Fedora 34.

Now that GDB 13 has branched, I am checking this in on the trunk.

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-19 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 21:43 [PATCH 0/2] Remove MI version 1 Tom Tromey
2022-08-10 21:43 ` [PATCH 1/2] Remove vestiges of MI version 0 Tom Tromey
2022-08-10 21:43 ` [PATCH 2/2] Remove MI version 1 Tom Tromey
2022-08-23 19:40 ` [PATCH 0/2] " Tom Tromey
2022-08-23 19:42   ` Simon Marchi
2022-12-19 14:49 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).