From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77414 invoked by alias); 18 Aug 2019 17:27:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 77322 invoked by uid 89); 18 Aug 2019 17:27:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.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=string_file, ncurses, printable, tabs X-HELO: gateway23.websitewelcome.com Received: from gateway23.websitewelcome.com (HELO gateway23.websitewelcome.com) (192.185.47.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Aug 2019 17:27:39 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 83B3981F5 for ; Sun, 18 Aug 2019 12:27:38 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id zOxuhly7LiQerzOxuh7JEZ; Sun, 18 Aug 2019 12:27:38 -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=kWFilwFpigmqUFyBKYV14CUYODumMoRBjQ0j4/XKiXU=; b=k2jQPgmSbLWdy7ynJ2gMde89eo AGGX2Jste66em5gXsTYaI4tXNvNEHAuIF8VXsTaskolh4JtS+MW1cjtAiPXHYDRDJF5SpS9VrBa9D mtXJV0RIP3pWrsYGFqq5FyxJi; Received: from 97-122-178-82.hlrn.qwest.net ([97.122.178.82]:44512 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hzOxu-002aYY-9e; Sun, 18 Aug 2019 12:27:38 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 03/14] Minor rearrangement in tui-regs.c Date: Sun, 18 Aug 2019 17:27:00 -0000 Message-Id: <20190818172735.17477-4-tom@tromey.com> In-Reply-To: <20190818172735.17477-1-tom@tromey.com> References: <20190818172735.17477-1-tom@tromey.com> X-SW-Source: 2019-08/txt/msg00394.txt.bz2 This moves a couple of functions earlier in tui-regs.c. Previously they were in the "command" section of the file, but really they belong in the "window implementation" section. gdb/ChangeLog 2019-08-18 Tom Tromey * tui/tui-regs.c (tui_register_format, tui_get_register): Move earlier. --- gdb/ChangeLog | 5 +++ gdb/tui/tui-regs.c | 101 +++++++++++++++++++++------------------------ 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index b3c7ce627b4..9ea6e723644 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -49,10 +49,55 @@ static void tui_show_register_group (tui_data_window *win_info, struct frame_info *frame, int refresh_values_only); -static void tui_get_register (struct frame_info *frame, - struct tui_data_item_window *data, - int regnum, bool *changedp); +/* Get the register from the frame and return a printable + representation of it. */ + +static char * +tui_register_format (struct frame_info *frame, int regnum) +{ + struct gdbarch *gdbarch = get_frame_arch (frame); + string_file stream; + + scoped_restore save_pagination + = make_scoped_restore (&pagination_enabled, 0); + scoped_restore save_stdout + = make_scoped_restore (&gdb_stdout, &stream); + + gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1); + + /* Remove the possible \n. */ + std::string &str = stream.string (); + if (!str.empty () && str.back () == '\n') + str.resize (str.size () - 1); + + /* Expand tabs into spaces, since ncurses on MS-Windows doesn't. */ + return tui_expand_tabs (str.c_str (), 0); +} + +/* Get the register value from the given frame and format it for the + display. When changep is set, check if the new register value has + changed with respect to the previous call. */ +static void +tui_get_register (struct frame_info *frame, + struct tui_data_item_window *data, + int regnum, bool *changedp) +{ + if (changedp) + *changedp = false; + if (target_has_registers) + { + char *prev_content = data->content; + + data->content = tui_register_format (frame, regnum); + + if (changedp != NULL + && strcmp (prev_content, data->content) != 0) + *changedp = true; + + xfree (prev_content); + } +} /* See tui-regs.h. */ @@ -739,56 +784,6 @@ tui_reggroup_completer (struct cmd_list_element *ignore, } } -/* Get the register from the frame and return a printable - representation of it. */ - -static char * -tui_register_format (struct frame_info *frame, int regnum) -{ - struct gdbarch *gdbarch = get_frame_arch (frame); - - string_file stream; - - scoped_restore save_pagination - = make_scoped_restore (&pagination_enabled, 0); - scoped_restore save_stdout - = make_scoped_restore (&gdb_stdout, &stream); - - gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1); - - /* Remove the possible \n. */ - std::string &str = stream.string (); - if (!str.empty () && str.back () == '\n') - str.resize (str.size () - 1); - - /* Expand tabs into spaces, since ncurses on MS-Windows doesn't. */ - return tui_expand_tabs (str.c_str (), 0); -} - -/* Get the register value from the given frame and format it for the - display. When changep is set, check if the new register value has - changed with respect to the previous call. */ -static void -tui_get_register (struct frame_info *frame, - struct tui_data_item_window *data, - int regnum, bool *changedp) -{ - if (changedp) - *changedp = false; - if (target_has_registers) - { - char *prev_content = data->content; - - data->content = tui_register_format (frame, regnum); - - if (changedp != NULL - && strcmp (prev_content, data->content) != 0) - *changedp = true; - - xfree (prev_content); - } -} - void _initialize_tui_regs (void) { -- 2.17.2