From patchwork Wed Aug 14 16:21:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34093 Received: (qmail 71394 invoked by alias); 14 Aug 2019 16:21:40 -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 71222 invoked by uid 89); 14 Aug 2019 16:21:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.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= X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.60.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Aug 2019 16:21:37 +0000 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway20.websitewelcome.com (Postfix) with ESMTP id A4878400D1683 for ; Wed, 14 Aug 2019 10:17:18 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id xw1nhyKG04FKpxw1nh57wI; Wed, 14 Aug 2019 11:21:36 -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=HwOXFBINC2m20vCPzoYjE7HL9kQhgwz0tZwiTQ+W7LE=; b=gR4k7kijc9BBUOBelydr+Ycwvh z1vGaqDxhgjGHhgINEVrU0/KpXLgaNjeesy3UNY8zl416YHO4dqOZxGqNDjFeumECpcnWUD0lXRR+ JFCwgOmFQaQ8crqvwIb99fc73; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:38600 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hxw1n-002Cwq-Mb; Wed, 14 Aug 2019 11:21:35 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 03/15] Move locator code to tui-stack.c Date: Wed, 14 Aug 2019 10:21:20 -0600 Message-Id: <20190814162132.31424-4-tom@tromey.com> In-Reply-To: <20190814162132.31424-1-tom@tromey.com> References: <20190814162132.31424-1-tom@tromey.com> The locator is mostly implemented in tui-stack.c. This moves the remaining bits to tui-stack.c and tui-stack.h, as appropriate. gdb/ChangeLog 2019-08-14 Tom Tromey * tui/tui-wingeneral.c: Include tui-stack.h. * tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move from tui-data.h. * tui/tui-stack.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move from tui-data.c. * tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move to tui-stack.c. * tui/tui-data.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move to tui-stack.c. --- gdb/ChangeLog | 12 ++++++++++++ gdb/tui/tui-data.c | 25 ------------------------- gdb/tui/tui-data.h | 25 ------------------------- gdb/tui/tui-stack.c | 25 +++++++++++++++++++++++++ gdb/tui/tui-stack.h | 27 +++++++++++++++++++++++++++ gdb/tui/tui-wingeneral.c | 1 + 6 files changed, 65 insertions(+), 50 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index add1f33926f..c308237d187 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -36,7 +36,6 @@ struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS]; ** Private data ****************************/ static int term_height, term_width; -static struct tui_locator_window _locator; static std::vector source_windows; static struct tui_win_info *win_with_focus = NULL; @@ -128,15 +127,6 @@ tui_add_to_source_windows (struct tui_source_window_base *win_info) source_windows.push_back (win_info); } -/* Accessor for the locator win info. Answers a pointer to the static - locator win info struct. */ -struct tui_locator_window * -tui_locator_win_info_ptr (void) -{ - return &_locator; -} - - /* Accessor for the term_height. */ int tui_term_height (void) @@ -253,21 +243,6 @@ tui_partial_win_by_name (const char *name) return NULL; } - -void -tui_initialize_static_data () -{ - tui_gen_win_info *win = tui_locator_win_info_ptr (); - win->width = - win->height = - win->origin.x = - win->origin.y = - win->viewport_height = 0; - win->handle = NULL; - win->is_visible = false; - win->title = 0; -} - /* See tui-data.h. */ void diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 017e7a40f52..b5eeecdee97 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -148,31 +148,6 @@ struct tui_line_or_address } u; }; -#ifdef PATH_MAX -# define MAX_LOCATOR_ELEMENT_LEN PATH_MAX -#else -# define MAX_LOCATOR_ELEMENT_LEN 1024 -#endif - -/* Locator window class. */ - -struct tui_locator_window : public tui_gen_win_info -{ - tui_locator_window () - : tui_gen_win_info (LOCATOR_WIN) - { - full_name[0] = 0; - proc_name[0] = 0; - } - - char full_name[MAX_LOCATOR_ELEMENT_LEN]; - char proc_name[MAX_LOCATOR_ELEMENT_LEN]; - int line_no = 0; - CORE_ADDR addr = 0; - /* Architecture associated with code at this location. */ - struct gdbarch *gdbarch = nullptr; -}; - /* This defines information about each logical window. */ struct tui_win_info : public tui_gen_win_info { diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 0a712231fa5..c67ac1ba549 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -39,6 +39,8 @@ #include "gdb_curses.h" +static struct tui_locator_window _locator; + /* Get a printable name for the function at the address. The symbol name is demangled if demangling is turned on. Returns a pointer to a static area holding the result. */ @@ -56,6 +58,29 @@ static int tui_set_locator_info (struct gdbarch *gdbarch, static void tui_update_command (const char *, int); +/* Accessor for the locator win info. Answers a pointer to the static + locator win info struct. */ +struct tui_locator_window * +tui_locator_win_info_ptr (void) +{ + return &_locator; +} + +void +tui_initialize_static_data () +{ + tui_gen_win_info *win = tui_locator_win_info_ptr (); + win->width = + win->height = + win->origin.x = + win->origin.y = + win->viewport_height = 0; + win->handle = NULL; + win->is_visible = false; + win->title = 0; +} + + /* Create the status line to display as much information as we can on this single line: target name, process number, current function, current line, current PC, SingleKey mode. */ diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h index 0a88f49932e..51c976b2f56 100644 --- a/gdb/tui/tui-stack.h +++ b/gdb/tui/tui-stack.h @@ -22,8 +22,35 @@ #ifndef TUI_TUI_STACK_H #define TUI_TUI_STACK_H +#include "tui/tui-data.h" + struct frame_info; +#ifdef PATH_MAX +# define MAX_LOCATOR_ELEMENT_LEN PATH_MAX +#else +# define MAX_LOCATOR_ELEMENT_LEN 1024 +#endif + +/* Locator window class. */ + +struct tui_locator_window : public tui_gen_win_info +{ + tui_locator_window () + : tui_gen_win_info (LOCATOR_WIN) + { + full_name[0] = 0; + proc_name[0] = 0; + } + + char full_name[MAX_LOCATOR_ELEMENT_LEN]; + char proc_name[MAX_LOCATOR_ELEMENT_LEN]; + int line_no = 0; + CORE_ADDR addr = 0; + /* Architecture associated with code at this location. */ + struct gdbarch *gdbarch = nullptr; +}; + extern void tui_update_locator_fullname (const char *); extern void tui_show_locator_content (void); extern int tui_show_frame_info (struct frame_info *); diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c index e2d06bcebad..52583cfb8ac 100644 --- a/gdb/tui/tui-wingeneral.c +++ b/gdb/tui/tui-wingeneral.c @@ -24,6 +24,7 @@ #include "tui/tui-data.h" #include "tui/tui-wingeneral.h" #include "tui/tui-win.h" +#include "tui/tui-stack.h" #include "gdb_curses.h"