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 v2 06/25] 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/event-loop.c | 4 ++++
 gdb/event-top.c  | 1 +
 gdb/top.h        | 1 +
 3 files changed, 6 insertions(+)

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;
 
-- 
2.5.0


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