This is the mail archive of the gdb-cvs@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]

[binutils-gdb] Always process target events in the main UI


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c61db772bf5dc21bf8e0db9acfa8796804f945ab

commit c61db772bf5dc21bf8e0db9acfa8796804f945ab
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Jun 21 01:11:49 2016 +0100

    Always process target events in the main UI
    
    This makes target events always be always processed with the main UI
    as current UI.  This way, warnings, debug output, etc. are always
    consistently sent to the main console.
    
    gdb/ChangeLog:
    2016-06-21  Pedro Alves  <palves@redhat.com>
    
    	* event-top.c (restore_ui_cleanup): Make extern.
    	* infrun.c (fetch_inferior_event): Always switch to the main UI.
    	* top.h (restore_ui_cleanup): Declare.

Diff:
---
 gdb/ChangeLog   | 6 ++++++
 gdb/event-top.c | 4 ++--
 gdb/infrun.c    | 6 ++++++
 gdb/top.h       | 3 +++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c60ac72..d87a51b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2016-06-21  Pedro Alves  <palves@redhat.com>
 
+	* event-top.c (restore_ui_cleanup): Make extern.
+	* infrun.c (fetch_inferior_event): Always switch to the main UI.
+	* top.h (restore_ui_cleanup): Declare.
+
+2016-06-21  Pedro Alves  <palves@redhat.com>
+
 	PR mi/20034
 	* cli/cli-interp.c: Include cli-interp.h and event-top.h.
 	(cli_interpreter_resume): Pass 1 to gdb_setup_readline.  Set the
diff --git a/gdb/event-top.c b/gdb/event-top.c
index c84b3f4..e90d00d 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -456,9 +456,9 @@ struct ui *main_ui = &main_ui_;
 struct ui *current_ui = &main_ui_;
 struct ui *ui_list = &main_ui_;
 
-/* Cleanup that restores the current UI.  */
+/* See top.h.  */
 
-static void
+void
 restore_ui_cleanup (void *data)
 {
   current_ui = (struct ui *) data;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 0925f41..1e9c28e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3879,6 +3879,12 @@ fetch_inferior_event (void *client_data)
 
   memset (ecs, 0, sizeof (*ecs));
 
+  /* Events are always processed with the main UI as current UI.  This
+     way, warnings, debug output, etc. are always consistently sent to
+     the main console.  */
+  make_cleanup (restore_ui_cleanup, current_ui);
+  current_ui = main_ui;
+
   /* End up with readline processing input, if necessary.  */
   make_cleanup (reinstall_readline_callback_handler_cleanup, NULL);
 
diff --git a/gdb/top.h b/gdb/top.h
index 11825b0..009fdb7 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -141,6 +141,9 @@ extern void switch_thru_all_uis_next (struct switch_thru_all_uis *state);
        switch_thru_all_uis_cond (&STATE);		\
        switch_thru_all_uis_next (&STATE))
 
+/* Cleanup that restores the current UI.  */
+extern void restore_ui_cleanup (void *data);
+
 /* From top.c.  */
 extern char *saved_command_line;
 extern int in_user_command;


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