From patchwork Sun Jun 23 22:42:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33288 Received: (qmail 47932 invoked by alias); 23 Jun 2019 22:43:44 -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 47747 invoked by uid 89); 23 Jun 2019 22:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 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=pertinent, UD:list X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 22:43:40 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway31.websitewelcome.com (Postfix) with ESMTP id B288FD9CF for ; Sun, 23 Jun 2019 17:43:39 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBD1hfHlN2qH7fBD1hoQ8w; Sun, 23 Jun 2019 17:43:39 -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=EVRYeH7XgnmrXZxgBG9WzQEp7JUAnVgWGEXqjQLdMO4=; b=Gx4Ok+9FiQNcENtc/CCGoy2sks E2wL/JfR6t9MlGQV5lCnqopII4a2tFjFRySoAx0Gp/EalaCjAVZiPaQWJ4b5+hcNRWuuRZaQ3xk4f 0IKw/IOJKaVR8aDKD6H/wMrge; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBD1-000vDQ-GA; Sun, 23 Jun 2019 17:43:39 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 07/66] Introduce tui_win_info::clear_detail method Date: Sun, 23 Jun 2019 16:42:30 -0600 Message-Id: <20190623224329.16060-8-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> This introduces the clear_detail method and updates the various subclasses of tui_win_info to implement it. A subsequent patch will remove tui_clear_win_detail, but that isn't done for now because at this point it isn't readily obvious that the NULL check is not needed. gdb/ChangeLog 2019-06-23 Tom Tromey * tui/tui-data.h (struct tui_win_info, struct tui_source_window) (struct tui_data_window, struct tui_cmd_window): Declare clear_detail method. * tui/tui-data.c (tui_source_window::clear_detail) (tui_cmd_window::clear_detail, tui_data_window::clear_detail): New methods. (tui_clear_win_detail): Simplify. --- gdb/ChangeLog | 10 ++++++++ gdb/tui/tui-data.c | 57 ++++++++++++++++++++++++++-------------------- gdb/tui/tui-data.h | 9 ++++++++ 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 3320b4fc62a..9923a2fb052 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -178,37 +178,44 @@ tui_add_to_source_windows (struct tui_win_info *win_info) source_windows.list[source_windows.count++] = win_info; } +/* See tui-data.h. */ + +void +tui_source_window::clear_detail () +{ + detail.source_info.gdbarch = NULL; + detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; + detail.source_info.start_line_or_addr.u.addr = 0; + detail.source_info.horizontal_offset = 0; +} + +/* See tui-data.h. */ + +void +tui_cmd_window::clear_detail () +{ + wmove (generic.handle, 0, 0); +} + +/* See tui-data.h. */ + +void +tui_data_window::clear_detail () +{ + detail.data_display_info.data_content = NULL; + detail.data_display_info.data_content_count = 0; + detail.data_display_info.regs_content = NULL; + detail.data_display_info.regs_content_count = 0; + detail.data_display_info.regs_column_count = 1; + detail.data_display_info.display_regs = FALSE; +} /* Clear the pertinant detail in the windows. */ void tui_clear_win_detail (struct tui_win_info *win_info) { if (win_info != NULL) - { - switch (win_info->generic.type) - { - case SRC_WIN: - case DISASSEM_WIN: - win_info->detail.source_info.gdbarch = NULL; - win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; - win_info->detail.source_info.start_line_or_addr.u.addr = 0; - win_info->detail.source_info.horizontal_offset = 0; - break; - case CMD_WIN: - wmove (win_info->generic.handle, 0, 0); - break; - case DATA_WIN: - win_info->detail.data_display_info.data_content = NULL; - win_info->detail.data_display_info.data_content_count = 0; - win_info->detail.data_display_info.regs_content = NULL; - win_info->detail.data_display_info.regs_content_count = 0; - win_info->detail.data_display_info.regs_column_count = 1; - win_info->detail.data_display_info.display_regs = FALSE; - break; - default: - break; - } - } + win_info->clear_detail (); } diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 2c873c26a2f..281729f7deb 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -280,6 +280,9 @@ public: virtual ~tui_win_info (); + /* Clear the pertinent detail in the window. */ + virtual void clear_detail () = 0; + struct tui_gen_win_info generic; /* General window information. */ union { @@ -300,18 +303,24 @@ struct tui_source_window : public tui_win_info { tui_source_window (enum tui_win_type type); DISABLE_COPY_AND_ASSIGN (tui_source_window); + + void clear_detail () override; }; struct tui_data_window : public tui_win_info { tui_data_window (); DISABLE_COPY_AND_ASSIGN (tui_data_window); + + void clear_detail () override; }; struct tui_cmd_window : public tui_win_info { tui_cmd_window (); DISABLE_COPY_AND_ASSIGN (tui_cmd_window); + + void clear_detail () override; }; extern int tui_win_is_source_type (enum tui_win_type win_type);