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 run async signal handlers in the main UI


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

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

    Always run async signal handlers in the main UI
    
    Async signal handlers have no connection to whichever was the current
    UI, and thus always run on the main one.
    
    gdb/ChangeLog:
    2016-06-21  Pedro Alves  <palves@redhat.com>
    
    	* event-loop.c: Include top.h.
    	(invoke_async_signal_handlers): Switch to the main UI.
    	* event-top.c (main_ui_): Update comment.
    	(main_ui): New global.
    	* top.h (main_ui): Declare.

Diff:
---
 gdb/event-loop.c | 4 ++++
 gdb/event-top.c  | 5 ++---
 gdb/top.h        | 5 +++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 60ef2a5..fe28305 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -35,6 +35,7 @@
 #include "gdb_sys_time.h"
 #include "gdb_select.h"
 #include "observer.h"
+#include "top.h"
 
 /* Tell create_file_handler what events we are interested in.
    This is used by the select version of the event loop.  */
@@ -967,6 +968,9 @@ invoke_async_signal_handlers (void)
 	break;
       any_ready = 1;
       async_handler_ptr->ready = 0;
+      /* Async signal handlers have no connection to whichever was the
+	 current UI, and thus always run on the main one.  */
+      current_ui = main_ui;
       (*async_handler_ptr->proc) (async_handler_ptr->client_data);
     }
 
diff --git a/gdb/event-top.c b/gdb/event-top.c
index c6e3b7e..63f6896 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -437,11 +437,10 @@ top_level_prompt (void)
   return xstrdup (prompt);
 }
 
-/* The main UI.  This is the UI that is bound to stdin/stdout/stderr.
-   It always exists and is created automatically when GDB starts
-   up.  */
+/* The main UI.  */
 static struct ui main_ui_;
 
+struct ui *main_ui = &main_ui_;
 struct ui *current_ui = &main_ui_;
 struct ui *ui_list = &main_ui_;
 
diff --git a/gdb/top.h b/gdb/top.h
index 80fcb40..a76abaf 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -86,6 +86,11 @@ struct ui
   struct ui_file *m_gdb_stdlog;
 };
 
+/* The main UI.  This is the UI that is bound to stdin/stdout/stderr.
+   It always exists and is created automatically when GDB starts
+   up.  */
+extern struct ui *main_ui;
+
 /* The current UI.  */
 extern struct ui *current_ui;


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