From patchwork Sat Aug 3 13:29:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 33947 Received: (qmail 96716 invoked by alias); 3 Aug 2019 13:29:43 -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 95858 invoked by uid 89); 3 Aug 2019 13:29:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.4 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:36 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 2500D6CFE for ; Sat, 3 Aug 2019 08:29:35 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id tu6JhqP993Qi0tu6JhaInf; Sat, 03 Aug 2019 08:29:35 -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=UhkaWGV3GidkZ6bTUFmROYkWB3iJNj1vfRFOgU/Gdio=; b=r0rf6R2sWAeK4tc+6WaFC2ZprA hSBtqIuv16k6zNumsHB3kAUV07vYQTI0XS7NMbaLEoiZXffhtuieLLlGFY0g7MCocWdpPJ7YBDgWS oi3fbellC1t1Mnu3zf7lfVZME; 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 1htu6I-003nqS-Td; Sat, 03 Aug 2019 08:29:35 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 18/19] Don't track the contents of the execution info window Date: Sat, 3 Aug 2019 07:29:24 -0600 Message-Id: <20190803132925.25074-19-tom@tromey.com> In-Reply-To: <20190803132925.25074-1-tom@tromey.com> References: <20190803132925.25074-1-tom@tromey.com> The curses library keeps track of the contents of each window, and can redraw the screen as needed. This means that in most cases is no need for the TUI windows to also keep track of their contents. This patch removes content tracking from the execution window, leaving that to curses. gdb/ChangeLog 2019-08-03 Tom Tromey * tui/tui-winsource.h (struct tui_exec_info_window) <~tui_exec_info_window, maybe_allocate_content, get_content, m_content>: Remove. (struct tui_source_window_base) : Don't declare. * tui/tui-winsource.c (tui_exec_info_window::maybe_allocate_content): Remove. (tui_source_window_base::update_exec_info): Rename from set_exec_info_content. (tui_source_window_base::show_exec_info_content) (tui_source_window_base::update_exec_info): Remove. --- gdb/ChangeLog | 14 +++++++++++ gdb/tui/tui-winsource.c | 56 ++++++----------------------------------- gdb/tui/tui-winsource.h | 22 ---------------- 3 files changed, 22 insertions(+), 70 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 2f02c6a0120..1b2b4393fd9 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -587,41 +587,22 @@ tui_update_breakpoint_info (struct tui_source_window_base *win, return need_refresh; } -/* See tui-data.h. */ - -tui_exec_info_content * -tui_exec_info_window::maybe_allocate_content (int n_elements) -{ - if (m_content == nullptr) - m_content = XNEWVEC (tui_exec_info_content, n_elements); - return m_content; -} - - /* Function to initialize the content of the execution info window, based upon the input window which is either the source or disassembly window. */ void -tui_source_window_base::set_exec_info_content () +tui_source_window_base::update_exec_info () { - tui_exec_info_content *exec_content - = execution_info->maybe_allocate_content (height); - + werase (execution_info->handle); tui_update_breakpoint_info (this, nullptr, true); for (int i = 0; i < content.size (); i++) { - tui_exec_info_content &element = exec_content[i]; - struct tui_source_element *src_element; - tui_bp_flags mode; - - src_element = &content[i]; - - memset (element, ' ', sizeof (tui_exec_info_content)); - element[TUI_EXECINFO_SIZE - 1] = 0; + struct tui_source_element *src_element = &content[i]; + char element[TUI_EXECINFO_SIZE] = " "; /* Now update the exec info content based upon the state of each line as indicated by the source content. */ - mode = src_element->break_mode; + tui_bp_flags mode = src_element->break_mode; if (mode & TUI_BP_HIT) element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B'; else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED)) @@ -634,34 +615,13 @@ tui_source_window_base::set_exec_info_content () if (src_element->is_exec_point) element[TUI_EXEC_POS] = '>'; - } -} - -void -tui_source_window_base::show_exec_info_content () -{ - struct tui_exec_info_window *exec_info = execution_info; - const tui_exec_info_content *exec_content = exec_info->get_content (); - - werase (exec_info->handle); - for (int cur_line = 1; cur_line <= content.size (); cur_line++) - mvwaddstr (exec_info->handle, - cur_line, - 0, - exec_content[cur_line - 1]); - exec_info->refresh_window (); + mvwaddstr (execution_info->handle, i + 1, 0, element); + } + execution_info->refresh_window (); } -/* Function to update the execution info window. */ -void -tui_source_window_base::update_exec_info () -{ - set_exec_info_content (); - show_exec_info_content (); -} - void tui_alloc_source_buffer (struct tui_source_window_base *win_info) { diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index e0a96c14dcc..abb7ea34816 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -52,24 +52,6 @@ struct tui_exec_info_window : public tui_gen_win_info : tui_gen_win_info (EXEC_INFO_WIN) { } - - ~tui_exec_info_window () override - { - xfree (m_content); - } - - /* Get or allocate contents. */ - tui_exec_info_content *maybe_allocate_content (int n_elements); - - /* Return the contents. */ - const tui_exec_info_content *get_content () const - { - return m_content; - } - -private: - - tui_exec_info_content *m_content = nullptr; }; /* Elements in the Source/Disassembly Window. */ @@ -132,7 +114,6 @@ public: void show_source_content (); - void set_exec_info_content (); void update_exec_info (); /* Does the locator belong to this window? */ @@ -150,9 +131,6 @@ public: struct gdbarch *gdbarch = nullptr; std::vector content; - -private: - void show_exec_info_content (); }; /* Update the execution windows to show the active breakpoints. This