From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id E9D153858C00 for ; Fri, 20 Jan 2023 21:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E9D153858C00 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 cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 5CAB3100400F9 for ; Fri, 20 Jan 2023 21:46:33 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id IzDVp991viOW0IzDVpygBD; Fri, 20 Jan 2023 21:46:33 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=S5kcfKgP c=1 sm=1 tr=0 ts=63cb0bb9 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=-hahWWqg_23KX-hwVqQA: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=ztdm0UqrMWrBgnRhX1gMaLwko1kSeeK4xWVOlJOo0kA=; b=yF9po1ITG9Z8IYYbP9m46/qfUj DhKu9AHMNIOUwjVWPzOgPmIkARihKCs6YnmFDO2xcftpYoCicRNnYNcmF02guIfr9iCamsfl7tjkP jqIJCyGw+abLGfA75+5PTYyXn; Received: from 97-122-76-186.hlrn.qwest.net ([97.122.76.186]:36374 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 1pIzDV-001G7B-3o; Fri, 20 Jan 2023 14:46:33 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 08/27] Convert block_gdbarch to method Date: Fri, 20 Jan 2023 14:45:59 -0700 Message-Id: <20230120214618.3236224-9-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 Content-Transfer-Encoding: 8bit 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: 1pIzDV-001G7B-3o X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-76-186.hlrn.qwest.net (localhost.localdomain) [97.122.76.186]:36374 X-Source-Auth: tom+tromey.com X-Email-Count: 9 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 List-Id: This converts block_gdbarch to be a method. This was mostly written by script. --- gdb/ada-lang.c | 2 +- gdb/block.c | 8 ++++---- gdb/block.h | 8 ++++---- gdb/cp-namespace.c | 2 +- gdb/d-namespace.c | 2 +- gdb/symtab.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dfcd9a5fcd1..8fdf5fcef5a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13842,7 +13842,7 @@ class ada_language : public language_defn if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (this, gdbarch, name); if (sym.symbol != NULL) diff --git a/gdb/block.c b/gdb/block.c index d7d5f0bf19e..b9c48e79d46 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -54,12 +54,12 @@ block::objfile () const /* See block. */ struct gdbarch * -block_gdbarch (const struct block *block) +block::gdbarch () const { - if (block->function () != nullptr) - return block->function ()->arch (); + if (function () != nullptr) + return function ()->arch (); - return block->objfile ()->arch (); + return objfile ()->arch (); } /* See block.h. */ diff --git a/gdb/block.h b/gdb/block.h index 2243c9a2a52..b9f1ba81b50 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -208,6 +208,10 @@ struct block struct objfile *objfile () const; + /* Return the architecture of this block. */ + + struct gdbarch *gdbarch () const; + /* Addresses in the executable code that are in this block. */ CORE_ADDR m_start; @@ -335,10 +339,6 @@ struct blockvector struct block *m_blocks[1]; }; -/* Return the architecture of BLOCK, which must be non-NULL. */ - -extern struct gdbarch *block_gdbarch (const struct block *block); - extern struct symbol *block_linkage_function (const struct block *); extern struct symbol *block_containing_function (const struct block *); diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index b1c54c57da6..97b7a653e33 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -197,7 +197,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name); sym.block = NULL; diff --git a/gdb/d-namespace.c b/gdb/d-namespace.c index 2978e5fecaf..aaef1dfae1f 100644 --- a/gdb/d-namespace.c +++ b/gdb/d-namespace.c @@ -94,7 +94,7 @@ d_lookup_symbol (const struct language_defn *langdef, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); sym.symbol = language_lookup_primitive_type_as_symbol (langdef, gdbarch, name); sym.block = NULL; diff --git a/gdb/symtab.c b/gdb/symtab.c index 60bed9f0b4b..78f56d9d377 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2468,7 +2468,7 @@ language_defn::lookup_symbol_nonlocal (const char *name, if (block == NULL) gdbarch = target_gdbarch (); else - gdbarch = block_gdbarch (block); + gdbarch = block->gdbarch (); result.symbol = language_lookup_primitive_type_as_symbol (this, gdbarch, name); result.block = NULL; -- 2.39.0