This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Implement MI's ``cli hack'' with mi_cmd_interpreter_exec


Simple cleanup. Now that there's a real --interpreter-exec command the cli-hack might as well use it (the hack is that the MI will recognize CLI commands).

committed,
Andrew
2005-02-20  Andrew Cagney  <cagney@gnu.org>

	* mi/mi-main.c (captured_mi_execute_command): Use
	mi_cmd_interpreter_exec.

Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.75
diff -p -u -r1.75 mi-main.c
--- mi/mi-main.c	7 Feb 2005 17:06:29 -0000	1.75
+++ mi/mi-main.c	21 Feb 2005 03:57:17 -0000
@@ -1103,30 +1103,36 @@ captured_mi_execute_command (struct ui_o
       break;
 
     case CLI_COMMAND:
-      /* A CLI command was read from the input stream */
-      /* This will be removed as soon as we have a complete set of
-         mi commands */
-      /* echo the command on the console. */
-      fprintf_unfiltered (gdb_stdlog, "%s\n", context->command);
-      mi_execute_cli_command (context->command, 0, NULL);
-
-      /* 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))
-	{
-	  /* print the result */
-	  /* FIXME: Check for errors here. */
-	  fputs_unfiltered (context->token, raw_stdout);
-	  fputs_unfiltered ("^done", raw_stdout);
-	  mi_out_put (uiout, raw_stdout);
-	  mi_out_rewind (uiout);
-	  fputs_unfiltered ("\n", raw_stdout);
-	  args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
-	  args->rc = MI_CMD_DONE;
-	}
-      break;
+      {
+	char *argv[2];
+	/* A CLI command was read from the input stream.  */
+	/* This "feature" will be removed as soon as we have a
+	   complete set of mi commands.  */
+	/* Echo the command on the console.  */
+	fprintf_unfiltered (gdb_stdlog, "%s\n", context->command);
+	/* Call the "console" interpreter.  */
+	argv[0] = "console";
+	argv[1] = context->command;
+	mi_cmd_interpreter_exec ("-interpreter-exec", argv, 2);
+
+	/* 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))
+	  {
+	    /* print the result */
+	    /* FIXME: Check for errors here. */
+	    fputs_unfiltered (context->token, raw_stdout);
+	    fputs_unfiltered ("^done", raw_stdout);
+	    mi_out_put (uiout, raw_stdout);
+	    mi_out_rewind (uiout);
+	    fputs_unfiltered ("\n", raw_stdout);
+	    args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
+	    args->rc = MI_CMD_DONE;
+	  }
+	break;
+      }
 
     }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]