From patchwork Thu Dec 12 02:35:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36769 Received: (qmail 17162 invoked by alias); 12 Dec 2019 02:41:55 -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 17133 invoked by uid 89); 12 Dec 2019 02:41:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=HX-Languages-Length:4680 X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Dec 2019 02:41:52 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 45A14208B6; Wed, 11 Dec 2019 21:35:14 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 10B8520C05 for ; Wed, 11 Dec 2019 21:35:06 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 00B1328175 for ; Wed, 11 Dec 2019 21:35:06 -0500 (EST) X-Gerrit-PatchSet: 2 Date: Wed, 11 Dec 2019 21:35:02 -0500 From: "Tom Tromey (Code Review)" To: gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [review v2] Change set_locator_info to take a symtab_and_line X-Gerrit-Change-Id: Icb58d67e6c5bdc034eede9e5bbe8c1d1e633fbb5 X-Gerrit-Change-Number: 646 X-Gerrit-ChangeURL: X-Gerrit-Commit: 79eb1793638ac0986d8d39f61b3ebaf3b2ffa59a In-Reply-To: References: Reply-To: tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191212023506.00B1328175@gnutoolchain-gerrit.osci.io> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/646 ...................................................................... Change set_locator_info to take a symtab_and_line This changes set_locator_info to take a symtab_and_line, rather than the individual components. 2019-12-11 Tom Tromey * tui/tui-stack.h (struct tui_locator_window) : Take a symtab_and_line. * tui/tui-stack.c (tui_locator_window::set_locator_info): Take a symtab_and_line. (tui_show_frame_info): Update. Change-Id: Icb58d67e6c5bdc034eede9e5bbe8c1d1e633fbb5 --- M gdb/ChangeLog M gdb/tui/tui-stack.c M gdb/tui/tui-stack.h 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 57632dc..5559a94 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-12-11 Tom Tromey + * tui/tui-stack.h (struct tui_locator_window) : + Take a symtab_and_line. + * tui/tui-stack.c (tui_locator_window::set_locator_info): Take a + symtab_and_line. + (tui_show_frame_info): Update. + +2019-12-11 Tom Tromey + * tui/tui-stack.c (tui_show_frame_info): Don't call update_exec_info. diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index f42bd83..d244343 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -258,28 +258,26 @@ bool tui_locator_window::set_locator_info (struct gdbarch *gdbarch_in, - const char *fullname, - const char *procname, - int lineno, - CORE_ADDR addr_in) + const struct symtab_and_line &sal, + const char *procname) { bool locator_changed_p = false; - if (procname == NULL) - procname = ""; + gdb_assert (procname != NULL); - if (fullname == NULL) - fullname = ""; + const char *fullname = (sal.symtab == nullptr + ? "??" + : symtab_to_fullname (sal.symtab)); locator_changed_p |= proc_name != procname; - locator_changed_p |= lineno != line_no; - locator_changed_p |= addr_in != addr; + locator_changed_p |= sal.line != line_no; + locator_changed_p |= sal.pc != addr; locator_changed_p |= gdbarch_in != gdbarch; locator_changed_p |= full_name != fullname; proc_name = procname; - line_no = lineno; - addr = addr_in; + line_no = sal.line; + addr = sal.pc; gdbarch = gdbarch_in; set_locator_fullname (fullname); @@ -314,26 +312,18 @@ if (fi) { - CORE_ADDR pc; - symtab_and_line sal = find_frame_sal (fi); - const char *fullname = nullptr; - if (sal.symtab != nullptr) - fullname = symtab_to_fullname (sal.symtab); - - if (get_frame_pc_if_available (fi, &pc)) - locator_changed_p - = locator->set_locator_info (get_frame_arch (fi), - (sal.symtab == 0 - ? "??" : fullname), - tui_get_function_from_frame (fi), - sal.line, - pc); + const char *func_name; + /* find_frame_sal does not always set PC, but we want to ensure + that it is available in the SAL. */ + if (get_frame_pc_if_available (fi, &sal.pc)) + func_name = tui_get_function_from_frame (fi); else - locator_changed_p - = locator->set_locator_info (get_frame_arch (fi), - "??", _(""), sal.line, 0); + func_name = _(""); + + locator_changed_p = locator->set_locator_info (get_frame_arch (fi), + sal, func_name); /* If the locator information has not changed, then frame information has not changed. If frame information has not changed, then the windows' @@ -341,10 +331,6 @@ if (!locator_changed_p) return 0; - /* find_frame_sal does not always set PC, but we want to ensure - that it is available in the SAL. */ - sal.pc = pc; - for (struct tui_source_window_base *win_info : tui_source_windows ()) { win_info->maybe_update (fi, sal); @@ -355,8 +341,9 @@ } else { - locator_changed_p - = locator->set_locator_info (NULL, NULL, NULL, 0, (CORE_ADDR) 0); + symtab_and_line sal {}; + + locator_changed_p = locator->set_locator_info (NULL, sal, ""); if (!locator_changed_p) return 0; diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h index 97e6956..3bfe529 100644 --- a/gdb/tui/tui-stack.h +++ b/gdb/tui/tui-stack.h @@ -54,9 +54,8 @@ Returns true if any of the locator's fields were actually changed, and false otherwise. */ bool set_locator_info (struct gdbarch *gdbarch, - const char *fullname, - const char *procname, - int lineno, CORE_ADDR addr); + const struct symtab_and_line &sal, + const char *procname); /* Set the full_name portion of the locator. */ void set_locator_fullname (const char *fullname);