From patchwork Sat Jan 4 18:33:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37175 Received: (qmail 130196 invoked by alias); 4 Jan 2020 18:34:17 -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 130131 invoked by uid 89); 4 Jan 2020 18:34:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 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=Switch, rolling X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.192.34) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Jan 2020 18:34:15 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 052F01EDE1 for ; Sat, 4 Jan 2020 12:34:14 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id noFZinbFzOdBHnoFZis7hq; Sat, 04 Jan 2020 12:34:14 -0600 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=eIamzrJyQHUfVJ6hohYldBz4wc744VIAHqRg7Nyd3RI=; b=LSbdKaypaXOsa4TTDjkXEoIfqq S+vXtYqXLmssulRSEtBTTwnNw0FDnzbyYKpaOz9PxoRUW0PNdY3RFazVDJsNBVwzdUKAxKc6Kd2bw 7Li75BO4tsF66T7K01HzkYmoY; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:48942 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1inoFZ-0026Lh-RK; Sat, 04 Jan 2020 11:34:13 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 04/24] Simplify TUI C-x 2 binding Date: Sat, 4 Jan 2020 11:33:50 -0700 Message-Id: <20200104183410.17114-5-tom@tromey.com> In-Reply-To: <20200104183410.17114-1-tom@tromey.com> References: <20200104183410.17114-1-tom@tromey.com> The TUI "C-x 2" binding tries to switch to a different layout based on the current layout. Once user-defined layouts are available, this won't really make sense. I wasn't entirely sure how to handle this. This patch changes the binding to simply cycle through the existing layouts. I considered this a reasonable, though not ideal, compromise. gdb/ChangeLog 2020-01-04 Tom Tromey * tui/tui.c (tui_rl_change_windows): Call tui_next_layout. * tui/tui-layout.h (tui_next_layout): Declare. * tui/tui-layout.c (tui_next_layout): New function. Change-Id: Ic101f0e3831a4235a048b3090ef60f025f7449bb --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-layout.c | 7 +++++++ gdb/tui/tui-layout.h | 3 +++ gdb/tui/tui.c | 38 ++------------------------------------ 4 files changed, 18 insertions(+), 36 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 8be98e9ba48..016cab649d4 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -276,6 +276,13 @@ tui_layout_command (const char *layout_name, int from_tty) tui_set_layout (new_layout); } +/* See tui-layout.h. */ + +void +tui_next_layout () +{ + tui_layout_command ("next", 0); +} static void extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h index 37f07c24e4f..7e4b7b7a816 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -181,6 +181,9 @@ extern void tui_add_win_to_layout (enum tui_win_type); extern void tui_set_layout (enum tui_layout_type); +/* Switch to the next layout. */ +extern void tui_next_layout (); + /* Apply the current layout. */ extern void tui_apply_current_layout (); diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 7ff5825ece2..780d3bae9c0 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -139,8 +139,7 @@ tui_rl_switch_mode (int notused1, int notused2) /* TUI readline command. Change the TUI layout to show a next layout. This function is bound to CTRL-X 2. It is intended to provide - a functionality close to the Emacs split-window command. We - always show two windows (src+asm), (src+regs) or (asm+regs). */ + a functionality close to the Emacs split-window command. */ static int tui_rl_change_windows (int notused1, int notused2) { @@ -148,41 +147,8 @@ tui_rl_change_windows (int notused1, int notused2) tui_rl_switch_mode (0 /* notused */, 0 /* notused */); if (tui_active) - { - enum tui_layout_type new_layout; - - new_layout = tui_current_layout (); - - /* Select a new layout to have a rolling layout behavior with - always two windows (except when undefined). */ - switch (new_layout) - { - case SRC_COMMAND: - new_layout = SRC_DISASSEM_COMMAND; - break; - - case DISASSEM_COMMAND: - new_layout = SRC_DISASSEM_COMMAND; - break; - - case SRC_DATA_COMMAND: - new_layout = SRC_DISASSEM_COMMAND; - break; - - case SRC_DISASSEM_COMMAND: - new_layout = DISASSEM_DATA_COMMAND; - break; - - case DISASSEM_DATA_COMMAND: - new_layout = SRC_DATA_COMMAND; - break; + tui_next_layout (); - default: - new_layout = SRC_COMMAND; - break; - } - tui_set_layout (new_layout); - } return 0; }