From patchwork Tue Sep 10 19:08:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 34484 Received: (qmail 26382 invoked by alias); 10 Sep 2019 19:09:13 -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 25842 invoked by uid 89); 10 Sep 2019 19:09:09 -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: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.148.142) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 19:09:07 +0000 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 2A2431115D8A for ; Tue, 10 Sep 2019 14:09:06 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 7lVhi5wardnCe7lViiR9CK; Tue, 10 Sep 2019 14:09:06 -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=bJmWB1dDy37LUl6zSV4f5vjx7PJUe6FpT5c8KU8DF5g=; b=r9YCNsQTjCN4emVf9iy+5PU1Ky 9YbyxS49ir4wLmyOwrxpVGFMsf91pY9FwKFpVmX+VUdQMpglaHc7IDbM3mkg+EQw2RrgrvEI9FW5l DLwOoAONyym4S87rpN1T5BbsB; Received: from 71-218-73-27.hlrn.qwest.net ([71.218.73.27]:51788 helo=bapiya.Home) by box5379.bluehost.com with esmtpa (Exim 4.92) (envelope-from ) id 1i7lVh-000EcZ-Ap; Tue, 10 Sep 2019 14:09:05 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 14/20] Change members of tui_locator_window to std::string Date: Tue, 10 Sep 2019 13:08:51 -0600 Message-Id: <20190910190857.6562-15-tom@tromey.com> In-Reply-To: <20190910190857.6562-1-tom@tromey.com> References: <20190910190857.6562-1-tom@tromey.com> This changes two members of tui_locator_window to have type std::string. This removes a static limit. gdb/ChangeLog 2019-09-10 Tom Tromey * tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN): Remove define. (struct tui_locator_window) : Now std::string. * tui/tui-stack.c (tui_locator_window::make_status_line) (tui_locator_window::set_locator_fullname) (tui_locator_window::set_locator_info): Update. * tui/tui-source.c (tui_source_window::set_contents) (tui_source_window::showing_source_p): Update. --- gdb/ChangeLog | 11 +++++++++++ gdb/tui/tui-source.c | 4 ++-- gdb/tui/tui-stack.c | 18 +++++++----------- gdb/tui/tui-stack.h | 10 ++-------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index f70e053bdb5..e6cc0dbc1a3 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -179,7 +179,7 @@ tui_source_window::set_contents (struct gdbarch *arch, element->line_or_addr.loa = LOA_LINE; element->line_or_addr.u.line_no = cur_line_no; element->is_exec_point - = (filename_cmp (locator->full_name, + = (filename_cmp (locator->full_name.c_str (), symtab_to_fullname (s)) == 0 && cur_line_no == locator->line_no); @@ -213,7 +213,7 @@ bool tui_source_window::showing_source_p (const char *fullname) const { return (!content.empty () - && (filename_cmp (tui_locator_win_info_ptr ()->full_name, + && (filename_cmp (tui_locator_win_info_ptr ()->full_name.c_str (), fullname) == 0)); } diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 830187995be..d66e3589e42 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -166,12 +166,12 @@ tui_locator_window::make_status_line () const /* Procedure/class name. */ if (proc_width > 0) { - if (strlen (proc_name) > proc_width) + if (proc_name.size () > proc_width) string.printf ("%s%*.*s* ", PROC_PREFIX, - 1 - proc_width, proc_width - 1, proc_name); + 1 - proc_width, proc_width - 1, proc_name.c_str ()); else string.printf ("%s%*.*s ", PROC_PREFIX, - -proc_width, proc_width, proc_name); + -proc_width, proc_width, proc_name.c_str ()); } if (line_width > 0) @@ -250,8 +250,7 @@ tui_locator_window::rerender () void tui_locator_window::set_locator_fullname (const char *fullname) { - full_name[0] = 0; - strcat_to_buf (full_name, MAX_LOCATOR_ELEMENT_LEN, fullname); + full_name = fullname; rerender (); } @@ -272,16 +271,13 @@ tui_locator_window::set_locator_info (struct gdbarch *gdbarch_in, if (fullname == NULL) fullname = ""; - locator_changed_p |= strncmp (proc_name, procname, - MAX_LOCATOR_ELEMENT_LEN) != 0; + locator_changed_p |= proc_name != procname; locator_changed_p |= lineno != line_no; locator_changed_p |= addr_in != addr; locator_changed_p |= gdbarch_in != gdbarch; - locator_changed_p |= strncmp (full_name, fullname, - MAX_LOCATOR_ELEMENT_LEN) != 0; + locator_changed_p |= full_name != fullname; - proc_name[0] = (char) 0; - strcat_to_buf (proc_name, MAX_LOCATOR_ELEMENT_LEN, procname); + proc_name = procname; line_no = lineno; addr = addr_in; gdbarch = gdbarch_in; diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h index b6ffa986a6f..93a79fbd799 100644 --- a/gdb/tui/tui-stack.h +++ b/gdb/tui/tui-stack.h @@ -26,12 +26,6 @@ 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 @@ -57,8 +51,8 @@ struct tui_locator_window : public tui_gen_win_info /* Set the full_name portion of the locator. */ void set_locator_fullname (const char *fullname); - char full_name[MAX_LOCATOR_ELEMENT_LEN]; - char proc_name[MAX_LOCATOR_ELEMENT_LEN]; + std::string full_name; + std::string proc_name; int line_no = 0; CORE_ADDR addr = 0; /* Architecture associated with code at this location. */