From patchwork Fri Jan 20 21:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 63535 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 1F08E393BA56 for ; Fri, 20 Jan 2023 21:48:39 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from progateway7-pub.mail.pro1.eigbox.com (gproxy5-pub.mail.unifiedlayer.com [67.222.38.55]) by sourceware.org (Postfix) with ESMTPS id D5B573858031 for ; Fri, 20 Jan 2023 21:46:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D5B573858031 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw10.mail.unifiedlayer.com (unknown [10.0.90.125]) by progateway7.mail.pro1.eigbox.com (Postfix) with ESMTP id 4F4CF10047427 for ; Fri, 20 Jan 2023 21:46:38 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id IzDapicpUFqSRIzDap2cC0; Fri, 20 Jan 2023 21:46:38 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=c6Ru/Txl c=1 sm=1 tr=0 ts=63cb0bbe a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=RvmDmJFTN0MA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=J5fIvHI6Pr9BaEm0oNIA: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:References:In-Reply-To: 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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=RX5rWOpeP+szorpsPIg80vevZgxw6+/pH9TsBfs5aFM=; b=KCENXyh8EdxnGDbFQY6lMOVLR7 20AU6kRyJ1uo6KW5/ux3DOVQ7yZ6LbjdiAxWxj/kHN/WQNwtfCbm0GALi/B7YW5QPqZJXxD2SS0xb pN0t5uqAJcy9Z2jqI48rY8rF8; Received: from 97-122-76-186.hlrn.qwest.net ([97.122.76.186]:60138 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pIzDa-001GGF-0o; Fri, 20 Jan 2023 14:46:38 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 15/27] Convert block_static_link to method Date: Fri, 20 Jan 2023 14:46:06 -0700 Message-Id: <20230120214618.3236224-16-tom@tromey.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230120214618.3236224-1-tom@tromey.com> References: <20230120214618.3236224-1-tom@tromey.com> 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.76.186 X-Source-L: No X-Exim-ID: 1pIzDa-001GGF-0o X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-76-186.hlrn.qwest.net (localhost.localdomain) [97.122.76.186]:60138 X-Source-Auth: tom+tromey.com X-Email-Count: 16 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, 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.29 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 Sender: "Gdb-patches" This converts block_static_link to be a method. This was mostly written by script. --- gdb/block.c | 8 ++++---- gdb/block.h | 24 +++++++++++++----------- gdb/findvar.c | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/gdb/block.c b/gdb/block.c index 3cd90dcb4ed..8aa0e676894 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -420,16 +420,16 @@ block::set_compunit_symtab (struct compunit_symtab *cu) /* See block.h. */ struct dynamic_prop * -block_static_link (const struct block *block) +block::static_link () const { - struct objfile *objfile = block->objfile (); + struct objfile *objfile = this->objfile (); /* Only objfile-owned blocks that materialize top function scopes can have static links. */ - if (objfile == NULL || block->function () == NULL) + if (objfile == NULL || function () == NULL) return NULL; - return (struct dynamic_prop *) objfile_lookup_static_link (objfile, block); + return (struct dynamic_prop *) objfile_lookup_static_link (objfile, this); } /* Return the compunit of the global block. */ diff --git a/gdb/block.h b/gdb/block.h index ce8c9679a07..9bc80490d7c 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -258,6 +258,19 @@ struct block void set_compunit_symtab (struct compunit_symtab *); + /* Return a property to evaluate the static link associated to this + block. + + In the context of nested functions (available in Pascal, Ada and + GNU C, for instance), a static link (as in DWARF's + DW_AT_static_link attribute) for a function is a way to get the + frame corresponding to the enclosing function. + + Note that only objfile-owned and function-level blocks can have a + static link. Return NULL if there is no such property. */ + + struct dynamic_prop *static_link () const; + /* Addresses in the executable code that are in this block. */ CORE_ADDR m_start; @@ -421,17 +434,6 @@ extern struct block *allocate_block (struct obstack *obstack); extern struct block *allocate_global_block (struct obstack *obstack); -/* Return a property to evaluate the static link associated to BLOCK. - - In the context of nested functions (available in Pascal, Ada and GNU C, for - instance), a static link (as in DWARF's DW_AT_static_link attribute) for a - function is a way to get the frame corresponding to the enclosing function. - - Note that only objfile-owned and function-level blocks can have a static - link. Return NULL if there is no such property. */ - -extern struct dynamic_prop *block_static_link (const struct block *block); - /* A block iterator. This structure should be treated as though it were opaque; it is only defined here because we want to support stack allocation of iterators. */ diff --git a/gdb/findvar.c b/gdb/findvar.c index 586ceb9dc72..8564047290e 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -498,7 +498,7 @@ get_hosting_frame (struct symbol *var, const struct block *var_block, else if (frame_block->function ()) { const struct dynamic_prop *static_link - = block_static_link (frame_block); + = frame_block->static_link (); int could_climb_up = 0; if (static_link != NULL)