From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78390 invoked by alias); 6 May 2016 12:35:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 78325 invoked by uid 89); 6 May 2016 12:35:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=STATE, Events X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 06 May 2016 12:35:21 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E50C3B754 for ; Fri, 6 May 2016 12:35:20 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u46CZ5IC017259 for ; Fri, 6 May 2016 08:35:19 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v3 15/34] Always process target events in the main UI Date: Fri, 06 May 2016 12:35:00 -0000 Message-Id: <1462538104-19109-16-git-send-email-palves@redhat.com> In-Reply-To: <1462538104-19109-1-git-send-email-palves@redhat.com> References: <1462538104-19109-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-05/txt/msg00102.txt.bz2 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 * 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