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]

[patch] Fix "interpreter-exec mi" output causing false FAILs


Hi,

(gdb) interpreter-exec mi -break-list
^done,BreakpointTable={[...]}
(gdb) 
(gdb) q

which can cause false
	FAIL: gdb.dwarf2/dw2-filename.exp: info sources
with "read1" from
	reproducer for races of expect incomplete reads
	http://sourceware.org/bugzilla/show_bug.cgi?id=12649

No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.


Thanks,
Jan


2012-03-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix double prompt of 'interpreter-exec mi'.
	* mi/mi-interp.c (mi_execute_command_input_handler): New prototype.
	(mi_interpreter_resume): use it.
	(mi_execute_command_input_handler): New function.
	* mi/mi-main.c (mi_execute_command): Move prompt printing to
	mi_execute_command_input_handler.

--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -40,6 +40,7 @@
    interpreter.  */
 
 static void mi_execute_command_wrapper (char *cmd);
+static void mi_execute_command_input_handler (char *cmd);
 static void mi_command_loop (int mi_version);
 
 /* These are hooks that we put in place while doing interpreter_exec
@@ -151,7 +152,7 @@ mi_interpreter_resume (void *data)
   /* These overwrite some of the initialization done in
      _intialize_event_loop.  */
   call_readline = gdb_readline2;
-  input_handler = mi_execute_command_wrapper;
+  input_handler = mi_execute_command_input_handler;
   add_file_handler (input_fd, stdin_event_handler, 0);
   async_command_editing_p = 0;
   /* FIXME: This is a total hack for now.  PB's use of the MI
@@ -297,6 +298,17 @@ mi_execute_command_wrapper (char *cmd)
   mi_execute_command (cmd, stdin == instream);
 }
 
+/* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER.  */
+
+static void
+mi_execute_command_input_handler (char *cmd)
+{
+  mi_execute_command_wrapper (cmd);
+
+  fputs_unfiltered ("(gdb) \n", raw_stdout);
+  gdb_flush (raw_stdout);
+}
+
 static void
 mi1_command_loop (void)
 {
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2027,9 +2027,6 @@ mi_execute_command (char *cmd, int from_tty)
 
       mi_parse_free (command);
     }
-
-  fputs_unfiltered ("(gdb) \n", raw_stdout);
-  gdb_flush (raw_stdout);
 }
 
 static void


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