This is the mail archive of the gdb-patches@sourceware.org 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]

[MI] kill captured_mi_execute_command_actions


The captured_mi_execute_command presently is passed a pointer to
struct captured_mi_execute_command_args, and the 'action' field
thereof is later consulted by mi_execute_command to decide if we
should print the prompt. The problem is that the 'action' field is
never assigned the value that would cause the prompt to be suppressed,
and in fact not always assigned any deterministic value. This patch
garbage-collects all this.

Checked in.

- Volodya
Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.9503
diff -u -p -r1.9503 ChangeLog
--- gdb/ChangeLog	28 Jun 2008 11:15:32 -0000	1.9503
+++ gdb/ChangeLog	28 Jun 2008 11:52:30 -0000
@@ -1,3 +1,15 @@
+2008-06-28  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* mi/mi-main.c (enum captured_mi_execute_command_actions)
+	(captured_mi_execute_command_args): Remove.
+	(captured_mi_execute_command): Cast the closure to mi_parse
+	pointer, not to captured_mi_execute_command_args, and don't
+	set the action field thereof.
+	(mi_execute_command): Pass struct mi_parse, not
+	captured_mi_execute_command_args to captured_mi_execute_command.
+	(mi_execute_command): Remove (dead) code for suppressing
+	printing prompt.
+
 2008-06-28  Pedro Alves  <pedro@codesourcery.com>
 
 	* linux-nat.c (enum sigchld_state): New.
Index: gdb/mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.119
diff -u -p -r1.119 mi-main.c
--- gdb/mi/mi-main.c	26 Jun 2008 15:10:48 -0000	1.119
+++ gdb/mi/mi-main.c	28 Jun 2008 11:52:30 -0000
@@ -62,26 +62,6 @@ enum
     FROM_TTY = 0
   };
 
-/* Enumerations of the actions that may result from calling
-   captured_mi_execute_command.  */
-
-enum captured_mi_execute_command_actions
-  {
-    EXECUTE_COMMAND_DISPLAY_PROMPT,
-    EXECUTE_COMMAND_SUPPRESS_PROMPT
-  };
-
-/* This structure is used to pass information from captured_mi_execute_command
-   to mi_execute_command.  */
-struct captured_mi_execute_command_args
-{
-  /* What action to perform when the call is finished (output).  */
-  enum captured_mi_execute_command_actions action;
-
-  /* The command context to be executed (input).  */
-  struct mi_parse *command;
-};
-
 int mi_debug_p;
 struct ui_file *raw_stdout;
 
@@ -994,9 +974,7 @@ mi_cmd_list_features (char *command, cha
 static void
 captured_mi_execute_command (struct ui_out *uiout, void *data)
 {
-  struct captured_mi_execute_command_args *args =
-    (struct captured_mi_execute_command_args *) data;
-  struct mi_parse *context = args->command;
+  struct mi_parse *context = (struct mi_parse *) data;
 
   struct mi_timestamp cmd_finished;
 
@@ -1009,11 +987,6 @@ captured_mi_execute_command (struct ui_o
 	/* FIXME: gdb_???? */
 	fprintf_unfiltered (raw_stdout, " token=`%s' command=`%s' args=`%s'\n",
 			    context->token, context->command, context->args);
-      /* FIXME: cagney/1999-09-25: Rather than this convoluted
-         condition expression, each function should return an
-         indication of what action is required and then switch on
-         that.  */
-      args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
 
       if (do_timings)
 	current_command_ts = context->cmd_start;
@@ -1077,7 +1050,6 @@ captured_mi_execute_command (struct ui_o
 		mi_out_put (uiout, raw_stdout);
 		mi_out_rewind (uiout);
 		fputs_unfiltered ("\n", raw_stdout);
-		args->action = EXECUTE_COMMAND_DISPLAY_PROMPT;
 	      }
 	    else
 	      mi_out_rewind (uiout);
@@ -1095,7 +1067,6 @@ void
 mi_execute_command (char *cmd, int from_tty)
 {
   struct mi_parse *command;
-  struct captured_mi_execute_command_args args;
   struct ui_out *saved_uiout = uiout;
 
   /* This is to handle EOF (^D). We just quit gdb.  */
@@ -1116,8 +1087,7 @@ mi_execute_command (char *cmd, int from_
 	  timestamp (command->cmd_start);
 	}
 
-      args.command = command;
-      result = catch_exception (uiout, captured_mi_execute_command, &args,
+      result = catch_exception (uiout, captured_mi_execute_command, command,
 				RETURN_MASK_ALL);
       if (result.reason < 0)
 	{
@@ -1134,11 +1104,6 @@ mi_execute_command (char *cmd, int from_
 	}
 
       mi_parse_free (command);
-
-      if (args.action == EXECUTE_COMMAND_SUPPRESS_PROMPT)
-	/* The command is executing synchronously.  Bail out early
-	   suppressing the finished prompt.  */
-	return;
     }
 
   fputs_unfiltered ("(gdb) \n", raw_stdout);

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