From patchwork Sat Aug 3 13:29:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33932 Received: (qmail 94756 invoked by alias); 3 Aug 2019 13:29:32 -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 94636 invoked by uid 89); 3 Aug 2019 13:29:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=*************************** X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.196.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 03 Aug 2019 13:29:30 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 885FF44B9 for ; Sat, 3 Aug 2019 08:29:29 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id tu6DhqP743Qi0tu6DhaIla; Sat, 03 Aug 2019 08:29:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j+EO9upKw9r+vy1QhUPeDmOCy2trYbJd4plKIoEin4A=; b=xcnE/sM+6+JCcU8/kzhv8zg1vN otXzVxeZyq4F41WYyOjVzfg74mBF7pZoECvslFieOnshBG13lREpgR2IdfwlPF2hBrXdgHuFB5yfN iL5opv6ndcC3wevn40QzOf9jb; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:36980 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1htu6D-003nqS-4F; Sat, 03 Aug 2019 08:29:29 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 03/19] Move current_layout to tui-layout.c Date: Sat, 3 Aug 2019 07:29:09 -0600 Message-Id: <20190803132925.25074-4-tom@tromey.com> In-Reply-To: <20190803132925.25074-1-tom@tromey.com> References: <20190803132925.25074-1-tom@tromey.com> This moves the current_layout global to tui-layout.c. This allows for the removal of an accessor function; but also it just seems clearer to have it here. gdb/ChangeLog 2019-08-03 Tom Tromey * tui/tui-layout.c (current_layout, tui_current_layout): Move from tui-data.c. (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Don't use tui_set_current_layout_to. * tui/tui-data.h (tui_set_current_layout_to): Don't declare. * tui/tui-data.c (current_layout, tui_current_layout): Move to tui-layout.c. (tui_set_current_layout_to): Remove. --- gdb/ChangeLog | 12 ++++++++++++ gdb/tui/tui-data.c | 17 ----------------- gdb/tui/tui-data.h | 1 - gdb/tui/tui-layout.c | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index af5e509ff0b..fd7649bdeab 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -35,7 +35,6 @@ struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS]; /*************************** ** Private data ****************************/ -static enum tui_layout_type current_layout = UNDEFINED_LAYOUT; static int term_height, term_width; static struct tui_locator_window _locator; static std::vector source_windows; @@ -170,22 +169,6 @@ tui_set_term_width_to (int w) } -/* Accessor for the current layout. */ -enum tui_layout_type -tui_current_layout (void) -{ - return current_layout; -} - - -/* Mutator for the current layout. */ -void -tui_set_current_layout_to (enum tui_layout_type new_layout) -{ - current_layout = new_layout; -} - - /***************************** ** OTHER PUBLIC FUNCTIONS *****************************/ diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 745181043aa..dbae2fb3b00 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -382,7 +382,6 @@ struct all_tui_windows extern void tui_initialize_static_data (void); extern struct tui_win_info *tui_partial_win_by_name (const char *); extern enum tui_layout_type tui_current_layout (void); -extern void tui_set_current_layout_to (enum tui_layout_type); extern int tui_term_height (void); extern void tui_set_term_height_to (int); extern int tui_term_width (void); diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 93687f3bd99..2b25e7a57fd 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -55,6 +55,15 @@ static void tui_layout_command (const char *, int); static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *); +static enum tui_layout_type current_layout = UNDEFINED_LAYOUT; + +/* Accessor for the current layout. */ +enum tui_layout_type +tui_current_layout (void) +{ + return current_layout; +} + /*************************************** ** DEFINITIONS ***************************************/ @@ -543,7 +552,7 @@ show_source_disasm_command (void) /* FIXME tui_cmd_window won't recreate the handle on make_visible, so we need this instead. */ tui_make_window (TUI_CMD_WIN, DONT_BOX_WINDOW); - tui_set_current_layout_to (SRC_DISASSEM_COMMAND); + current_layout = SRC_DISASSEM_COMMAND; } } @@ -597,7 +606,7 @@ show_data (enum tui_layout_type new_layout) locator->make_visible (true); tui_show_locator_content (); tui_add_to_source_windows (base); - tui_set_current_layout_to (new_layout); + current_layout = new_layout; } void @@ -675,6 +684,6 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) /* FIXME tui_cmd_window won't recreate the handle on make_visible, so we need this instead. */ tui_make_window (TUI_CMD_WIN, DONT_BOX_WINDOW); - tui_set_current_layout_to (layout_type); + current_layout = layout_type; } }