From patchwork Tue Sep 6 23:03:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 15365 Received: (qmail 10520 invoked by alias); 6 Sep 2016 23:03:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 10410 invoked by uid 89); 6 Sep 2016 23:03:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Events, tidy, console, restores 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 ESMTP; Tue, 06 Sep 2016 23:03:27 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 4FE54335F82 for ; Tue, 6 Sep 2016 23:03:26 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86N3Ov2000681 for ; Tue, 6 Sep 2016 19:03:25 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed master+7.12 1/2] Introduce make_cleanup_restore_current_ui Date: Wed, 7 Sep 2016 00:03:23 +0100 Message-Id: <1473203004-28598-2-git-send-email-palves@redhat.com> In-Reply-To: <1473203004-28598-1-git-send-email-palves@redhat.com> References: <1473203004-28598-1-git-send-email-palves@redhat.com> Just a tidy, no functional changes. gdb/ChangeLog: 2016-09-06 Pedro Alves * event-top.c (restore_ui_cleanup): Now static. (make_cleanup_restore_current_ui): New function. (switch_thru_all_uis_init): Use it. * infcall.c (call_thread_fsm_should_stop): Use it. * infrun.c (fetch_inferior_event): Use it. * top.c (new_ui_command): Use it. * top.h (restore_ui_cleanup): Delete declaration. (make_cleanup_restore_current_ui): New declaration. --- gdb/ChangeLog | 11 +++++++++++ gdb/event-top.c | 14 +++++++++++--- gdb/infcall.c | 2 +- gdb/infrun.c | 2 +- gdb/top.c | 2 +- gdb/top.h | 4 ++-- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0df1486..e5e0cb5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2016-09-06 Pedro Alves + + * event-top.c (restore_ui_cleanup): Now static. + (make_cleanup_restore_current_ui): New function. + (switch_thru_all_uis_init): Use it. + * infcall.c (call_thread_fsm_should_stop): Use it. + * infrun.c (fetch_inferior_event): Use it. + * top.c (new_ui_command): Use it. + * top.h (restore_ui_cleanup): Delete declaration. + (make_cleanup_restore_current_ui): New declaration. + 2016-09-05 Ulrich Weigand * i386-tdep.c (i386_floatformat_for_type): New function. diff --git a/gdb/event-top.c b/gdb/event-top.c index 91b06e6..576eded 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -447,9 +447,9 @@ struct ui *main_ui; struct ui *current_ui; struct ui *ui_list; -/* See top.h. */ +/* A cleanup handler that restores the current UI. */ -void +static void restore_ui_cleanup (void *data) { current_ui = (struct ui *) data; @@ -457,11 +457,19 @@ restore_ui_cleanup (void *data) /* See top.h. */ +struct cleanup * +make_cleanup_restore_current_ui (void) +{ + return make_cleanup (restore_ui_cleanup, current_ui); +} + +/* See top.h. */ + void switch_thru_all_uis_init (struct switch_thru_all_uis *state) { state->iter = ui_list; - state->old_chain = make_cleanup (restore_ui_cleanup, current_ui); + state->old_chain = make_cleanup_restore_current_ui (); } /* See top.h. */ diff --git a/gdb/infcall.c b/gdb/infcall.c index 8595d9e..3c33c11 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -530,7 +530,7 @@ call_thread_fsm_should_stop (struct thread_fsm *self, f->return_value = get_call_return_value (&f->return_meta_info); /* Break out of wait_sync_command_done. */ - old_chain = make_cleanup (restore_ui_cleanup, current_ui); + old_chain = make_cleanup_restore_current_ui (); current_ui = f->waiting_ui; target_terminal_ours (); f->waiting_ui->prompt_state = PROMPT_NEEDED; diff --git a/gdb/infrun.c b/gdb/infrun.c index 90841f4..70d7a09 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3915,7 +3915,7 @@ fetch_inferior_event (void *client_data) /* 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); + make_cleanup_restore_current_ui (); current_ui = main_ui; /* End up with readline processing input, if necessary. */ diff --git a/gdb/top.c b/gdb/top.c index bc44192..5b385d2 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -386,7 +386,7 @@ new_ui_command (char *args, int from_tty) interpreter_name = argv[0]; tty_name = argv[1]; - make_cleanup (restore_ui_cleanup, current_ui); + make_cleanup_restore_current_ui (); failure_chain = make_cleanup (null_cleanup, NULL); diff --git a/gdb/top.h b/gdb/top.h index c5f6bc7..ee664c1 100644 --- a/gdb/top.h +++ b/gdb/top.h @@ -188,8 +188,8 @@ extern void delete_ui (struct ui *todel); /* Cleanup that deletes a UI. */ extern struct cleanup *make_delete_ui_cleanup (struct ui *ui); -/* Cleanup that restores the current UI. */ -extern void restore_ui_cleanup (void *data); +/* Make a cleanup that restores the current UI. */ +extern struct cleanup *make_cleanup_restore_current_ui (void); /* Register the UI's input file descriptor in the event loop. */ extern void ui_register_input_event_handler (struct ui *ui);