[v2,06/25] Always run async signal handlers in the main UI

Message ID 1458573675-15478-7-git-send-email-palves@redhat.com
State New, archived
Headers

Commit Message

Pedro Alves March 21, 2016, 3:20 p.m. UTC
  Async signal handlers have no connection to whichever was the current
UI, and thus always run on the main one.
---
 gdb/event-loop.c | 4 ++++
 gdb/event-top.c  | 1 +
 gdb/top.h        | 1 +
 3 files changed, 6 insertions(+)
  

Patch

diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 0e1cb2b..c7062eb 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -34,6 +34,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.  */
@@ -946,6 +947,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 05df8b8..b40ae93 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -356,6 +356,7 @@  top_level_prompt (void)
 
 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 2cb0c90..ef05942 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -85,6 +85,7 @@  struct ui
   struct ui_file *m_gdb_stdlog;
 };
 
+extern struct ui *main_ui;
 extern struct ui *current_ui;
 extern struct ui *ui_list;