This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v3 15/34] Always process target events in the main UI
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 6 May 2016 13:34:45 +0100
- Subject: [PATCH v3 15/34] Always process target events in the main UI
- Authentication-results: sourceware.org; auth=none
- References: <1462538104-19109-1-git-send-email-palves at redhat dot com>
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:
yyyy-mm-dd 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.
---
gdb/event-top.c | 4 ++--
gdb/infrun.c | 6 ++++++
gdb/top.h | 3 +++
3 files changed, 11 insertions(+), 2 deletions(-)
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 eb2388b..2b4d331 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -3883,6 +3883,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 2facd1e..3447a2f 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;
--
2.5.5