From patchwork Mon Oct 30 22:30:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78801 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F06293858C62 for ; Mon, 30 Oct 2023 22:30:10 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id A19713858D1E for ; Mon, 30 Oct 2023 22:29:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A19713858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A19713858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698704996; cv=none; b=wy+qk44KjaVml6TFFZ1zhrPs2dWmbUZumPrGDlG0Jcl7sBFg2vr4Q+XkaYYg09OuqRiM83DpAMnKkvccSEivN343JR9uy73yBlWxtk05XffOCIzyBsxyhBhgpmPofk9TSEf3eNySysm7zV3uGm9u+jwzzJV2E2NGVnqJFJlNZM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698704996; c=relaxed/simple; bh=DiDEt8PeYx51Bj4Icl5ChEkXW4vZOA4wfhsW4SjJ9dM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=U7RjOMop5sZbbypm6yA8q8J5I6u1FA1VF9IGP4VzTl5fSnsKmENpH6mOxpPpB/Rv92gD6k0UUS0uPXeDmkvqzbx/4mia/XiI3C85OZXn+w46/oFjSSydJir58hNWK3O/bGqf5t3GxJd2DwgReN30zBQjom7CWR033hAmKVYbSmI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5010a.ext.cloudfilter.net ([10.0.29.199]) by cmsmtp with ESMTPS id xP40qplKO8HtexalcqOBxu; Mon, 30 Oct 2023 22:29:52 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xalbqAdfsoIDwxalbq9RGc; Mon, 30 Oct 2023 22:29:51 +0000 X-Authority-Analysis: v=2.4 cv=TP1W9npa c=1 sm=1 tr=0 ts=65402e5f a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=4ejfoaJvqq8r6i_LBCsA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=eBC5sS2eF1y1HqhYmQ8wzm1L5BV/17gpAx23bDbEakE=; b=GJM7NHPiJKxJDZlnRXan1i7PFs MCB/ewrsqiLhxs3XnqkZnPV7aW5tIvoxusK7rSZ+gboAaeC8gS6+TBGrl5rPdqJmB60Xlmo8ahkgQ cn/FiCXT0jHPBK5LMj4dluVMx; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:55186 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxalb-002CyB-06; Mon, 30 Oct 2023 16:29:51 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove some frame invalidation code Date: Mon, 30 Oct 2023 16:30:01 -0600 Message-ID: <20231030223001.1714967-1-tom@tromey.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.77.73 X-Source-L: No X-Exim-ID: 1qxalb-002CyB-06 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (localhost.localdomain) [97.122.77.73]:55186 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDVeAlSHdiPWPrm2j44y8ZJYT9i2s0Ys3ycQ/7g3WompWdXwqh0H869fnKTFHH6sMyMc+QRwBcmbZMxQZikiLLqKCOU2v3s71lHBiEPC5yLcJNd7NW36 TRfUMfbxujCRUYQGsyq0YO8yN7KlA86mH79PN9yxZ8IzcUUZSQc4H30i/s+axmBONH35cg37iVkkfPpCeHWV2EgySr1zWodeanU= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org I stumbled across a few spots that mention that a function "invalidates frame" and also assignments of NULL to a frame_info_ptr. This code isn't harmful, but is also unnecessary since the introduction of frame_info_ptr -- nowadays frame invalidations are handled automatically. Regression tested on x86-64 Fedora 38. --- gdb/breakpoint.c | 3 --- gdb/printcmd.c | 8 +------- gdb/stack.c | 11 ++--------- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 828c99cabc0..fe09dbcbeee 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -10952,9 +10952,6 @@ until_break_command (const char *arg, int from_tty, int anywhere) lj_deleter.emplace (thread); } - /* set_momentary_breakpoint could invalidate FRAME. */ - frame = NULL; - /* If the user told us to continue until a specified location, we don't specify a frame at which we need to stop. Otherwise, specify the selected frame, because we want to stop only at the diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b9b6a3b8648..06cc5316eec 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2391,9 +2391,7 @@ clear_dangling_display_expressions (struct objfile *objfile) struct symbol. NAME is the name to print; if NULL then VAR's print name will be used. STREAM is the ui_file on which to print the value. INDENT specifies the number of indent levels to print - before printing the variable name. - - This function invalidates FRAME. */ + before printing the variable name. */ void print_variable_and_value (const char *name, struct symbol *var, @@ -2420,10 +2418,6 @@ print_variable_and_value (const char *name, struct symbol *var, get_user_print_options (&opts); opts.deref_ref = true; common_val_print_checked (val, stream, indent, &opts, current_language); - - /* common_val_print invalidates FRAME when a pretty printer calls inferior - function. */ - frame = NULL; } catch (const gdb_exception_error &except) { diff --git a/gdb/stack.c b/gdb/stack.c index 0b35d62f82f..39dcefa87b8 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2326,9 +2326,7 @@ prepare_reg (const char *regexp, gdb::optional *reg) If T_REGEXP is not NULL, only print local variables whose type matches T_REGEXP. If no local variables have been printed and !QUIET, prints a message - explaining why no local variables could be printed. - - This function will invalidate FRAME. */ + explaining why no local variables could be printed. */ static void print_frame_local_vars (frame_info_ptr frame, @@ -2490,9 +2488,7 @@ iterate_over_block_arg_vars (const struct block *b, If T_REGEXP is not NULL, only print argument variables whose type matches T_REGEXP. If no argument variables have been printed and !QUIET, prints a message - explaining why no argument variables could be printed. - - This function will invalidate FRAME. */ + explaining why no argument variables could be printed. */ static void print_frame_arg_vars (frame_info_ptr frame, @@ -2531,9 +2527,6 @@ print_frame_arg_vars (frame_info_ptr frame, iterate_over_block_arg_vars (func->value_block (), cb_data); - /* do_print_variable_and_value invalidates FRAME. */ - frame = NULL; - if (!cb_data.values_printed && !quiet) { if (regexp == NULL && t_regexp == NULL)