From patchwork Sat Jan 4 18:33:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 37177 Received: (qmail 130764 invoked by alias); 4 Jan 2020 18:34:20 -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 130516 invoked by uid 89); 4 Jan 2020 18:34:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 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=displays, focused X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.47.228) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 Jan 2020 18:34:15 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 5B86149FA6 for ; Sat, 4 Jan 2020 12:34:14 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id noFaiWgCrW4frnoFainK0l; 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=/EvUzqg9tNHZTfchk34DqM2BT1/eFvb8SHxDjisYdeg=; b=s6Lx+xBSq8zOWt4atCp8aFEFdi 8s0XECpaUfyfMPICB4oUjpFdjVkfyjWhOASClDJOBBQidwNXjtMtO1d8SxQBfAj7/GmidM0pOwaIY MNZUz0iQMCT2rEMxzIk/9ywhj; 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 1inoFa-0026Lh-6c; Sat, 04 Jan 2020 11:34:14 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 06/24] Reimplement "tui reg" command Date: Sat, 4 Jan 2020 11:33:52 -0700 Message-Id: <20200104183410.17114-7-tom@tromey.com> In-Reply-To: <20200104183410.17114-1-tom@tromey.com> References: <20200104183410.17114-1-tom@tromey.com> This reimplements the low-level layout function that is used by the "tui reg" command. Now it simply calls into the existing "layout" command, though this will be changed again in a subsequent patch. The rationale for this patch is that it makes it simpler to remove "enum tui_layout_type". gdb/ChangeLog 2020-01-04 Tom Tromey * tui/tui-regs.c (tui_reg_layout): Remove. (tui_reg_command): Use tui_regs_layout. * tui/tui-layout.h (tui_reg_command): Declare. * tui/tui-layout.c (tui_reg_command): New function. Change-Id: I0ca6884e2967005e7d3fbf5f13a0ac8f9c3298cf --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-layout.c | 8 ++++++++ gdb/tui/tui-layout.h | 3 +++ gdb/tui/tui-regs.c | 17 +---------------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 86b496d273e..68a55179d98 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -286,6 +286,14 @@ tui_next_layout () /* See tui-layout.h. */ +void +tui_regs_layout () +{ + tui_layout_command ("regs", 0); +} + +/* See tui-layout.h. */ + void tui_remove_some_windows () { diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h index f711b004b84..05089ab8fff 100644 --- a/gdb/tui/tui-layout.h +++ b/gdb/tui/tui-layout.h @@ -194,6 +194,9 @@ extern void tui_set_layout (enum tui_layout_type); /* Switch to the next layout. */ extern void tui_next_layout (); +/* Show the register window. Like "layout regs". */ +extern void tui_regs_layout (); + /* Remove some windows from the layout, leaving only the focused window and the command window; if no window has the focus, then some other window is chosen to remain. */ diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 41b8f0d933c..ad57069968c 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -542,21 +542,6 @@ tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch) return group; } -/* A helper function to display the register window in the appropriate - way. */ - -static void -tui_reg_layout () -{ - enum tui_layout_type cur_layout = tui_current_layout (); - enum tui_layout_type new_layout; - if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND) - new_layout = SRC_DATA_COMMAND; - else - new_layout = DISASSEM_DATA_COMMAND; - tui_set_layout (new_layout); -} - /* Implement the 'tui reg' command. Changes the register group displayed in the tui register window. Displays the tui register window if it is not already on display. */ @@ -578,7 +563,7 @@ tui_reg_command (const char *args, int from_tty) appropriate layout. We need to do this before trying to run the 'next' or 'prev' commands. */ if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ()) - tui_reg_layout (); + tui_regs_layout (); struct reggroup *current_group = TUI_DATA_WIN->get_current_group (); if (strncmp (args, "next", len) == 0)