From patchwork Sun Oct 29 23:23:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78696 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 8AD223875431 for ; Sun, 29 Oct 2023 23:23:25 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 72156385276F for ; Sun, 29 Oct 2023 23:23:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 72156385276F 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 72156385276F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; cv=none; b=B4bg04BaZw/e5zeXcqgvV971WPHT1qsj8l1q6zjaVJMHpMJTbY0iLcFTXfbTqw0GYNhHhqYa33TgRWfFgYHSyARNMHzng26C0W+WL/qMhvlWpswoM33nmVoyYhGKz3OHosCS6nkh6lZTDvfJp2jSDExBoCFqGfW+yV3Ee14rfvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; c=relaxed/simple; bh=2WHez4+npPZgKAWRkPcWkgoEkDxIkPZCK+LBw3T0XqE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=xaBsDk9BGzj0ILluuxWK1sxf3nI+WB5pveXQ/Q5nJEXugjSeI0Vj1NTQxVSu6hybt/N+AXSksTH9h7HBAJI0BnHILYp3sW5SqS1TEnBDXZFRHqDeBScQCX8Wn0cPjYhavOqYIbHtfgQbFe4JfDQY7AjJ2OOgXcjyS6vRo8msvk4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5008a.ext.cloudfilter.net ([10.0.29.246]) by cmsmtp with ESMTPS id xCknqhwnYgpyExF7aqEF9b; Sun, 29 Oct 2023 23:23:06 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqkcoEpPpmxF7aqT06F; Sun, 29 Oct 2023 23:23:06 +0000 X-Authority-Analysis: v=2.4 cv=MJVzJeVl c=1 sm=1 tr=0 ts=653ee95a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=mDV3o1hIAAAA:8 a=xidWkcqldO9mH9tVxSAA:9 a=QEXdDO2ut3YA:10 a=_FVE-zBwftR9WsbkzFJk:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=0ed0FW55xWaGGNHeqAr/H9W0rsu+h0ArpqkeXH6herE=; b=g6j48kGYw9MxmiPgazvbmnpHwv iCiTlWgKu1xDn59vS10awIIEKEaA+G4OS8R9Y3h4tZGlb5AjoP7aQq3BVSe3fzKV6P9vGaqlg8t2r 3NguzMK23NBbqAT/rOmX92DHb; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7Z-0042zY-2T for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:05 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:22 -0600 Subject: [PATCH 01/30] Introduce block-symbol.h MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-1-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7Z-0042zY-2T X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNGD/d2EuTFpQ8WAA0gRUYiyYYhl+VxtyIQ1xqnsa69Y1Nw+AmmeBzBDEt1TUBmVr428O4RSpWz8Ah6NnI98mwoKfEhNlwC9azRoxC2fNjMCL8dzi2cx UBpLwegcl+RIJAZWEfVvf9BSEhJdMjzY7ALUtZqK8Ni1WHcqlQi7OWfsdehvE81JHyN/Vh5tpOg0Q9h4yA0dA2zo/gfN8I0wIw8= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, 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.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 This adds a new header file, block-symbol.h. This is needed to break include cycles in later patches. --- gdb/block-symbol.h | 39 +++++++++++++++++++++++++++++++++++++++ gdb/symtab.h | 14 +------------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/gdb/block-symbol.h b/gdb/block-symbol.h new file mode 100644 index 00000000000..35bc40c1986 --- /dev/null +++ b/gdb/block-symbol.h @@ -0,0 +1,39 @@ +/* The block_symbol type + + Copyright (C) 2023 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_BLOCK_SYMBOL_H +#define GDB_BLOCK_SYMBOL_H + +struct block; +struct symbol; + +/* Several lookup functions return both a symbol and the block in which the + symbol is found. This structure is used in these cases. */ + +struct block_symbol +{ + /* The symbol that was found, or NULL if no symbol was found. */ + struct symbol *symbol; + + /* If SYMBOL is not NULL, then this is the block in which the symbol is + defined. */ + const struct block *block; +}; + +#endif /* GDB_BLOCK_SYMBOL_H */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 8dfc873b1c9..0b3ca3964b6 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -38,6 +38,7 @@ #include "gdb-demangle.h" #include "split-name.h" #include "frame.h" +#include "block-symbol.h" /* Opaque declarations. */ struct ui_file; @@ -1521,19 +1522,6 @@ struct symbol : public general_symbol_info, public allocate_on_obstack CORE_ADDR get_maybe_copied_address () const; }; -/* Several lookup functions return both a symbol and the block in which the - symbol is found. This structure is used in these cases. */ - -struct block_symbol -{ - /* The symbol that was found, or NULL if no symbol was found. */ - struct symbol *symbol; - - /* If SYMBOL is not NULL, then this is the block in which the symbol is - defined. */ - const struct block *block; -}; - /* Note: There is no accessor macro for symbol.owner because it is "private". */ From patchwork Sun Oct 29 23:23:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78699 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 C6AC03865C15 for ; Sun, 29 Oct 2023 23:23:44 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 2AA6938618A9 for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AA6938618A9 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 2AA6938618A9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621790; cv=none; b=WmcM31ieSIw+ZhJicHLJunT91INfGNNuoq/v0KrzSp/R3F2CgLHG8caRFDZ64MqWlnvhaEQBwb2a+dhWcaGj5KsQq82CBOB6eRv5+WxQ3FD63J3gvMiS/uaosag3Xky37SQ/qji7/IKizEx82qyWE4eo0L0QJ0JkITjXAlpRJq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621790; c=relaxed/simple; bh=MOG/Eput8uElzlO7rSvhcT5f+P3m/La3vJlr2gda2ug=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=jZoU6aksBatbDeSypvSLLRGLdzIqfT4Nx/Cp3FNRrSajOkt7kxy6TfkFqBFnI55Rvg558bQ0+frJnijv/YwU3Ctk/+/P+TrLg80ITM67fT44Bya5MtcHcw8awo2LWw1FWn8frLWtD4l6dZkUvjmPTtpMxwNqx7nQJ98OgWYBaXs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id x7GmqQzEKKOkLxF7aqQEP5; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqlJmzF1O4xF7aq7aq3; Sun, 29 Oct 2023 23:23:06 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=653ee95a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=XJF8YgxpR_xPzUxlkKQA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=/jAE6+rF6niFEq63AE45BxX2hZSrHd0OvjZfaztmsjk=; b=VLN4SK5+YCx9Ah4c9gYwr3ONo3 /H06HgpyOw6jDOHTOkUUTMRMUgXPJ7lcrkEC2X8yT0/aK+wvdmfpreq/1KM3Y+ngCb31VpoBDyvNF iKw95i6f8dxCd23U5DL+AI8WK; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7Z-0042zY-2v for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:05 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:23 -0600 Subject: [PATCH 02/30] Add block_symbol::address MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-2-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7Z-0042zY-2v X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNBv/sU1/AM3So2Sm6UqiQctXlRBzEKNA1B7Rl9Vye5zUNZssfm/pNgHh2r35nFazrpwGS04+qIhfgGA5lWhyjaLBB1a9P1/2XNuGBTAmMIi/BNnQria UTMSLm8yFoouTcfYoxZNSroS5ZaWVb/jlnpQDLc7e4lnv4h8HXoD9m2VYxqxnIvL+h6tpPaqpfBU88ChQ1yz31wXaFxyFSA6e5Y= 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 This adds a new block_symbol::address method. The long-term goal here is to change most existing calls to symbol::value_address to call block_symbol::address instead. Then, at some future date, we can add an objfile to block_symbol and change this method to relocate the address when called -- making a symbol independent of the objfile, as we've already done for minimal symbols and partial symbols. --- gdb/block-symbol.h | 2 ++ gdb/symtab.h | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/gdb/block-symbol.h b/gdb/block-symbol.h index 35bc40c1986..f7087cf9943 100644 --- a/gdb/block-symbol.h +++ b/gdb/block-symbol.h @@ -34,6 +34,8 @@ struct block_symbol /* If SYMBOL is not NULL, then this is the block in which the symbol is defined. */ const struct block *block; + + CORE_ADDR address () const; }; #endif /* GDB_BLOCK_SYMBOL_H */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 0b3ca3964b6..93cc1f11d08 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1522,6 +1522,12 @@ struct symbol : public general_symbol_info, public allocate_on_obstack CORE_ADDR get_maybe_copied_address () const; }; +inline CORE_ADDR +block_symbol::address () const +{ + return symbol->value_address (); +} + /* Note: There is no accessor macro for symbol.owner because it is "private". */ From patchwork Sun Oct 29 23:23:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78698 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 847B43875470 for ; Sun, 29 Oct 2023 23:23:30 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 78DE23861856 for ; Sun, 29 Oct 2023 23:23:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 78DE23861856 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 78DE23861856 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; cv=none; b=vrmpyHRvIcb4QotCB8aBCgRQuHanOFDm6eq73V7yw5batYHm78zhhjGRLrou8RGI783T++iPQPGjCAGxRIQBZU+L9QTfS6kYRJ2A43D6N1UmkErHlh1GCR9KIorvfJh8a3axU80VBpf4N3BS0h6AMdUmKQCFUOmcYIAfmMFfJqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; c=relaxed/simple; bh=Nht1fDzR4ofSwyGQ9r2PEczWIk9PRSbi2q+HJo2/8oo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rmyJwgIwEqjhyXHwwMvLb4IH1c+9Eugj/PXLT385YbaXpgMy88tIgGOj5Ohp1qd8ugzWNje7Z7ZbmuRsPYNw39MDUus+5WmLLxwc4boRq7V90ZH6RIBB20uphNNVVoDac9lHTAN4ipsn347Buoda1081hX4BJeT8nh1Z7kdlmX4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5007a.ext.cloudfilter.net ([10.0.29.141]) by cmsmtp with ESMTPS id xBxKqhrQmgpyExF7bqEF9d; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aq09rf6uHPxF7aq1akR; Sun, 29 Oct 2023 23:23:06 +0000 X-Authority-Analysis: v=2.4 cv=TuH1ORbh c=1 sm=1 tr=0 ts=653ee95a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=tfeAfrXyRAfakcOlqI8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=0tw6mgwP8GerFCq4Q6jz6TVlAjWN2MPDr/vnTsB+sGw=; b=v7r8HOh7vstV6BrSPscOXpa+D5 xRml75pNlhp4MKuLRJCB7WytQk0ZFxIl4SO5sxQp1Jo/6gKg7n4L/NeSZOc2FVSlGSDescGEXL6Uw QUe9SKtHaWO/UJPV9ComY/7g3; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-08 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:24 -0600 Subject: [PATCH 03/30] Easy conversions to use block_symbol::address MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-3-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-08 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfIxLKgt1mK0NZfQyR9wMB9sn1WEAZn9k2pIVQHLbTMQRtqw9drIkawx93QV9AxBGO1ouPeLC40U5/kXCTjps0XlAvpDALOjoJAcpAs8FTxiuGCEWLoxj pCtKmaPhhhlI0uS12UCLGqY8NzPTmZ1WYTp6js8+dAaFDUSymVfXlE2AituqUMNqaST3Ry086vb9PvDq3tKx7SaTdWvryzcm9nE= X-Spam-Status: No, score=-3023.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, 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.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 This changes a few obvious spots to use block_symbol::address. --- gdb/ada-lang.c | 3 +-- gdb/compile/compile-c-symbols.c | 4 ++-- gdb/compile/compile-cplus-symbols.c | 4 ++-- gdb/compile/compile-cplus-types.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 9bb649e901d..3391aaeccb3 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -5101,8 +5101,7 @@ remove_extra_symbols (std::vector &syms) syms[j].symbol->linkage_name ()) == 0 && (syms[i].symbol->aclass () == syms[j].symbol->aclass ()) - && syms[i].symbol->value_address () - == syms[j].symbol->value_address ()) + && syms[i].address () == syms[j].address ()) remove_p = true; } } diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 5982178170c..2d49ead249e 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -88,7 +88,7 @@ convert_one_symbol (compile_c_instance *context, case LOC_LABEL: kind = GCC_C_SYMBOL_LABEL; - addr = sym.symbol->value_address (); + addr = sym.address (); break; case LOC_BLOCK: @@ -179,7 +179,7 @@ convert_one_symbol (compile_c_instance *context, case LOC_STATIC: kind = GCC_C_SYMBOL_VARIABLE; - addr = sym.symbol->value_address (); + addr = sym.address (); break; case LOC_FINAL_VALUE: diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 1edbf8f64b5..dec0260bf7a 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -82,7 +82,7 @@ convert_one_symbol (compile_cplus_instance *instance, case LOC_LABEL: kind = GCC_CP_SYMBOL_LABEL; - addr = sym.symbol->value_address (); + addr = sym.address (); break; case LOC_BLOCK: @@ -175,7 +175,7 @@ convert_one_symbol (compile_cplus_instance *instance, case LOC_STATIC: kind = GCC_CP_SYMBOL_VARIABLE; - addr = sym.symbol->value_address (); + addr = sym.address (); break; case LOC_FINAL_VALUE: diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index ac27e83618b..53a98b432f4 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -627,7 +627,7 @@ compile_cplus_convert_struct_or_union_members const char *filename = sym.symbol->symtab ()->filename; unsigned int line = sym.symbol->line (); - physaddr = sym.symbol->value_address (); + physaddr = sym.address (); instance->plugin ().build_decl ("field physname", field_name, (GCC_CP_SYMBOL_VARIABLE| get_field_access_flag (type, i)), From patchwork Sun Oct 29 23:23:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78697 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 199D5387103C for ; Sun, 29 Oct 2023 23:23:26 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 76272386181F for ; Sun, 29 Oct 2023 23:23:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76272386181F 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 76272386181F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; cv=none; b=h8LcccI8QbuVqyUNmvO019JWL+47Jt2baC83i72IE8ekopUtMWT9alauspSjy5lnedQjlR69IkFQqeckWyTElYBRNQZH/bwUoEv1A3/qji87bQwLFIMgvjPQnYi5x4LZu/EIFDC8kpWkSRgheCY71XkZs//d2H/vLwRlqy0dkXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621789; c=relaxed/simple; bh=J8qlAnhEkftWhF9GPw0XwOcQrT/+/p3tlfT3k4Gs/lY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=vRw35UQqHY/uF+xEMjdEuPcnfTxrdT/24Je4ZpP1bdXegZD+YG/kRiIaBzNSzmkioELLqV5iK0FTuZYkFYJnIqrkWd9EB8N/CR8IAHU+bUo/EWBYBDDSPJDH6i0klByNWfsMoMWLKszmXhW/JjG/zfWClNYdoXyBDle1Uypyw3s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5005a.ext.cloudfilter.net ([10.0.29.234]) by cmsmtp with ESMTPS id xCabqhvYMgpyExF7bqEF9g; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aq4hn4TiJWxF7aqBNKV; Sun, 29 Oct 2023 23:23:06 +0000 X-Authority-Analysis: v=2.4 cv=IpgNzZzg c=1 sm=1 tr=0 ts=653ee95a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=MG6f6Lqqdchsc9LnQAUA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=/ya4iyyPXSM41Z8tQg2kryJH4xpXo7ANscXmORMN7bc=; b=reltVQr60QhF7dlK5qX/j34VIC pRenLXVjk/qubbF8xhxVwSDJXDFv+UZuwDshslaJuTYgiZfjqiHk4sNbtZyJRTnhhBoF7IIB7R/u6 EyboE2clT6iBVOwNc+PKI0z81; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-0b for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:25 -0600 Subject: [PATCH 04/30] Use block_symbol::address in ada-tasks.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-4-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-0b X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfKNthG1TuN/69g6LtneXygMjCT32K50OWQQO8s4B+8IkTxedl6Icvyf09K2t8DBVstnkHmHmDz5jQpIyYCKkKpLf4gWCNQVVoMAvl4h7iJ6Hnm0TFUNN BSOq4vEXYZx2mfwjMfzgDjkD9Q+xyLWvwybwoMMdyN3AnsMc6GmkmWsjM0vupwIjtkMhcmEsG3agOkV/Oj/yYa0V/l8ESZHpbW0= 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_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.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 This changes ada-tasks.c to use block_symbol::address. --- gdb/ada-tasks.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 047566e6228..9f2d670e71e 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -914,7 +914,7 @@ static void ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) { struct bound_minimal_symbol msym; - struct symbol *sym; + struct block_symbol sym; /* Return now if already set. */ if (data->known_tasks_kind != ADA_TASKS_UNKNOWN) @@ -930,11 +930,11 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) /* Try to get pointer type and array length from the symtab. */ sym = lookup_symbol_in_language (KNOWN_TASKS_NAME, NULL, VAR_DOMAIN, - language_c, NULL).symbol; - if (sym != NULL) + language_c, NULL); + if (sym.symbol != nullptr) { /* Validate. */ - struct type *type = check_typedef (sym->type ()); + struct type *type = check_typedef (sym.symbol->type ()); struct type *eltype = NULL; struct type *idxtype = NULL; @@ -976,11 +976,11 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) data->known_tasks_length = 1; sym = lookup_symbol_in_language (KNOWN_TASKS_LIST, NULL, VAR_DOMAIN, - language_c, NULL).symbol; - if (sym != NULL && sym->value_address () != 0) + language_c, NULL); + if (sym.symbol != nullptr && sym.address () != 0) { /* Validate. */ - struct type *type = check_typedef (sym->type ()); + struct type *type = check_typedef (sym.symbol->type ()); if (type->code () == TYPE_CODE_PTR) { From patchwork Sun Oct 29 23:23:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78703 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 819A938323D2 for ; Sun, 29 Oct 2023 23:23:50 +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 A72D538618EE for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A72D538618EE 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 A72D538618EE 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=1698621791; cv=none; b=AS+afn25C6Jn8AsJRemouMglbgWZUR5f2PJcQ1ydT8sSZLFLh/XSKZr3+xSfzuSN92/TEXenlbwD8Q4egpUR2EhjyAViHfnEdOUiQ4CewEUUzkpCBv2K07qgEDqDNyZS/X4nbFRPaK0mVUFC9pcm2uZ8IxwFiP9aVT7aBl4a31c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621791; c=relaxed/simple; bh=i5k1hsq+nkHDy8XlWqkC4gWtufrEfN7G4WVOTRolHk8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=cMAJtknWXW350gpM9LI56ezz97i1zU4kCxLj4Ksrq42fXakAZlVEmmlLno7rPrMh3fof0z8vskZ9HONdPa/xFLLNx0oS1ytDpEJvi+Uic16QmkScEbVQp5ftG+QUvCLgh1wmUjvc1NJ853XIFY5aJLSaQ94rf2xdYwUYQv8rLr8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id x3H1qn6Bp8HtexF7bqEXdp; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqJcdyRqxCxF7aqwDvY; Sun, 29 Oct 2023 23:23:06 +0000 X-Authority-Analysis: v=2.4 cv=IY2U5Ema c=1 sm=1 tr=0 ts=653ee95a a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=gNE060aIARCBDlep2ecA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=17ebomy6i7NsO+YMiVzibIm1LLCmUAwjqtix/Vw2gK0=; b=OLHXWxNeDiIQgbi7SOOxv20erg wVWSBXqGkv1GC8b5nRaqV2buLsntuEDAqy2z+Tofrw84/rTCZEohNTq1GPcyV00zJzs9aP+kRjpZ3 v7fKE4h4EFnsqZal3l23lmPzp; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-13 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:26 -0600 Subject: [PATCH 05/30] Use block_symbol::address in printcmd.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-5-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-13 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMyh2mfhBgQXJ7zqpjV0lmTxzZnBmBFsHwDhpzCmUT2cpKOrwQc7xTYxr7brbVcqNcN6ajEetr02SP5ogEtCsGoGy+yuREg47CHJN0oH7oFWA2eWkOnv js4ixJPOtaSNh4yafsuZkpUJD1+QTRS9bxAnOGNAcy/3cNKy8LiEym6AUNaiUVlDsa/T3trhlUfFHO3/gerrlTMHgd2HRzmCSBI= 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 This changes printcmd.c to use block_symbol::address. --- gdb/printcmd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b9b6a3b8648..94ce5113e06 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1647,8 +1647,10 @@ info_address_command (const char *exp, int from_tty) if (exp == 0) error (_("Argument required.")); - sym = lookup_symbol (exp, get_selected_block (&context_pc), VAR_DOMAIN, - &is_a_field_of_this).symbol; + block_symbol bsym = lookup_symbol (exp, get_selected_block (&context_pc), + VAR_DOMAIN, + &is_a_field_of_this); + sym = bsym.symbol; if (sym == NULL) { if (is_a_field_of_this.type != NULL) @@ -1725,7 +1727,7 @@ info_address_command (const char *exp, int from_tty) case LOC_LABEL: gdb_printf ("a label at address "); - load_addr = sym->value_address (); + load_addr = bsym.address (); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); if (section_is_overlay (section)) @@ -1761,7 +1763,7 @@ info_address_command (const char *exp, int from_tty) case LOC_STATIC: gdb_printf (_("static storage at address ")); - load_addr = sym->value_address (); + load_addr = bsym.address (); fputs_styled (paddress (gdbarch, load_addr), address_style.style (), gdb_stdout); if (section_is_overlay (section)) From patchwork Sun Oct 29 23:23:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78702 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 DA8573831E32 for ; Sun, 29 Oct 2023 23:23:48 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 400C638618D9 for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 400C638618D9 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 400C638618D9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621790; cv=none; b=elZe9kM6C805IdQ7r51jC0RXNjOB0oGAMey6rVg8HVW4MjhKGqRpX4xOJDmkjMyazJbmVP3zvYyBDPKkSpMPI/4WIh6GNBrSc/2PF/RF51DxFnMpCPl5cRORhlOxjTxm/qcpHFAiyqFN9P74kIUEx0akYgAnTEBG5ug1rZpMF9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621790; c=relaxed/simple; bh=FpuTR72u0aug03+qddVuVTsWEi5fyQ2zed4/PYqoAco=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=TC80TYiOzXJiHtLm/Puw1+WX3T+7LS1DCDUd3WmUjuzZoGkcrjfzYzkj+N1TIyiR3vNuDFV3o5D+RLy0FjVApawJJCZVCGIswpjcqvmdU/n87yR0VwHMFD63kUg9bQ5cYo/jNm5lCGHZijHyvrEqYY5DH9KLK2iq4uvYJq6ivzE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id wjr9qO05EKOkLxF7bqQEPE; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqlJnaF1O4xF7bq7aqU; Sun, 29 Oct 2023 23:23:07 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=653ee95b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=O4yZiLRku0mW-y6P6AMA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=60oEbkis+iOKmf4Jkhm28QTqyeYGYMFNVJCKwpz6jYo=; b=GtobL5ao92NckrtYWNEE5sYZHF BSGI85ZQ5xO73kqmwMfxYRk9ZAGWQ8Me9pDeheO6/bTx1DOVXWfCVJoglCmRWbvdD6mEa/+Nsrcil Awa+NiWqkCJj/f+sUHETG3kT4; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-1X for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:27 -0600 Subject: [PATCH 06/30] Use block_symbol::address in tracepoint.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-6-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-1X X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfE8yuh/H3liO7Gpeqq+COIOJlWieu/z+4h7/Ibuz3Otar9sdQXhMeoCbM00xdF/hFPohlU5e6thKp2H7f4XF8VISNFE8kxvtp1PP6W/pelkVssTnox/I 2ZqeXFvDzJx/SOSQJvn0TMO1315nrkAmLaxXFV+2mrkP8YL4FE2Lqyg+iejB6maBdrEt1iZnOrYGJBNPnR3c8ZgpFgBTWx7uEsE= 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 This changes the easy spots in tracepoint.c to use block_symbol::address. --- gdb/tracepoint.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2c548688570..89611114c9b 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2489,6 +2489,8 @@ info_scope_command (const char *args_in, int from_tty) QUIT; /* Allow user to bail out with ^C. */ for (struct symbol *sym : block_iterator_range (block)) { + block_symbol bsym { sym, block }; + QUIT; /* Allow user to bail out with ^C. */ if (count == 0) gdb_printf ("Scope for %s:\n", save_args); @@ -2529,7 +2531,7 @@ info_scope_command (const char *args_in, int from_tty) break; case LOC_STATIC: gdb_printf ("in static storage at address "); - gdb_printf ("%s", paddress (gdbarch, sym->value_address ())); + gdb_printf ("%s", paddress (gdbarch, bsym.address ())); break; case LOC_REGISTER: /* GDBARCH is the architecture associated with the objfile @@ -2573,7 +2575,7 @@ info_scope_command (const char *args_in, int from_tty) continue; case LOC_LABEL: gdb_printf ("a label at address "); - gdb_printf ("%s", paddress (gdbarch, sym->value_address ())); + gdb_printf ("%s", paddress (gdbarch, bsym.address ())); break; case LOC_BLOCK: gdb_printf ("a function at address "); From patchwork Sun Oct 29 23:23:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78701 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 A1D453831E08 for ; Sun, 29 Oct 2023 23:23:47 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id A0C1A38618EA for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A0C1A38618EA 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 A0C1A38618EA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621791; cv=none; b=Zw+EJMlkzZwLL/4qg7m+3DS/YgzE5PLWUEGrcPghc8m0DTiViiYDdOxilGMKzfPKUI0oSWs6KKVSDhTYkZL+RABekUj/5WG/+ilmGFeM3+0mn0n3zhPQ4Vx8u1RiZbq9UmL5WqXQnq5eZCxs+46chNFXoldCThV+W+dFgeDANXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621791; c=relaxed/simple; bh=+bRTXXpNvRoAJr+Z3BK3dy74QzN44PWxD+ylKPpUPxU=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=hxkSdte97U1TqlVf48VWx6eD5X91iBUCzN3wqW9HhvbIBHeeD5Pw3NEvm2HzAAV/83fo1JZd9jkdCY6g/Q+6tKmfEcS5oGV1gnCXiMZc9DX69kLy3iHX5/MkJrcz7lU7NRU13q00TCGqrl6Yti0VEgmIA0rYTaFlykm1lGfeZ00= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id xCtAqtmVhL9AgxF7bqdPr2; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqx1NzGYrgxF7bqfHYS; Sun, 29 Oct 2023 23:23:07 +0000 X-Authority-Analysis: v=2.4 cv=bYd47cDB c=1 sm=1 tr=0 ts=653ee95b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=6rMzt0fA10ZSSo4t_W8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=DzJ/RQz2qdNwM/m37PfY1/QHOvcU8Y0Kbi0WGYkspBw=; b=XwIbaeKnRhPQUMkcBa8eL6L7u6 cYOiRsYCBXkIamPH+BuQdJyEeOwJSvLdsR0XMWdD23WWimr+kJOCSsVFGg7tHKIk33Y3XyN4vjkbh +cLrgNuDsPy33Z1Tryf7tVkHT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-22 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:28 -0600 Subject: [PATCH 07/30] More use of block_symbol::address in tracepoint.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-7-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-22 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 8 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLAZ2HVAKWxC40kBZ9DS3/xotiG/9T8o+rgrH9rLOCQGU+Ekvo3AtTu4CY0PCzm3p9p7Ohhnf+wLdXH2mGY8UO1EW+w95UA8uAZZsDD49qkUtoFU52J8 Mqf7fLTsk3Sq9uKHDUtheQSZV4Kt5qnG6qBQZiweAk63QFU5PNop3HRJm21kLM5G2NKGknwoFjNoE9ZzWXJdswmouTEZr0wkIds= 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 This changes the remaining spots in tracepoint.c to use block_symbol::address. --- gdb/expop.h | 5 +++++ gdb/tracepoint.c | 12 +++++++----- gdb/tracepoint.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/expop.h b/gdb/expop.h index 25769d5b810..433c92c9a00 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -667,6 +667,11 @@ class var_value_operation return std::get<0> (m_storage).symbol; } + block_symbol get_block_symbol () const + { + return std::get<0> (m_storage); + } + protected: void do_generate_ax (struct expression *exp, diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 89611114c9b..6d017179283 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -905,7 +905,7 @@ collection_list::add_memrange (struct gdbarch *gdbarch, /* Add a symbol to a collection list. */ void -collection_list::collect_symbol (struct symbol *sym, +collection_list::collect_symbol (block_symbol bsym, struct gdbarch *gdbarch, long frame_regno, long frame_offset, CORE_ADDR scope, @@ -916,6 +916,7 @@ collection_list::collect_symbol (struct symbol *sym, bfd_signed_vma offset; int treat_as_expr = 0; + symbol *sym = bsym.symbol; len = check_typedef (sym->type ())->length (); switch (sym->aclass ()) { @@ -928,7 +929,7 @@ collection_list::collect_symbol (struct symbol *sym, sym->print_name (), plongest (sym->value_longest ())); break; case LOC_STATIC: - offset = sym->value_address (); + offset = bsym.address (); if (info_verbose) { gdb_printf ("LOC_STATIC %s: collect %ld bytes at %s.\n", @@ -1049,7 +1050,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc, auto do_collect_symbol = [&] (const char *print_name, struct symbol *sym) { - collect_symbol (sym, gdbarch, frame_regno, + block_symbol bsym { sym, block }; + collect_symbol (bsym, gdbarch, frame_regno, frame_offset, pc, trace_string); count++; add_wholly_collected (print_name); @@ -1392,8 +1394,8 @@ encode_actions_1 (struct command_line *action, expr::var_value_operation *vvo = (gdb::checked_static_cast (exp->op.get ())); - struct symbol *sym = vvo->get_symbol (); - const char *name = sym->natural_name (); + block_symbol sym = vvo->get_block_symbol (); + const char *name = sym.symbol->natural_name (); collect->collect_symbol (sym, arch, diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index b9ff31fa0f6..8c94f1d9fc2 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -270,7 +270,7 @@ class collection_list void add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base, unsigned long len, CORE_ADDR scope); - void collect_symbol (struct symbol *sym, + void collect_symbol (block_symbol sym, struct gdbarch *gdbarch, long frame_regno, long frame_offset, CORE_ADDR scope, From patchwork Sun Oct 29 23:23:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78706 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 493DE3875454 for ; Sun, 29 Oct 2023 23:24:06 +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 A375F38618EC for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A375F38618EC 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 A375F38618EC 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=1698621792; cv=none; b=hk4nm+yhcHv0Ww9CaGXHnF70KTA0a4+2JC/skusdlxhbBWzLV/c/jukmIIS8mTwGy1t0Hq6ThfrjKPoweTki95A1qqaDu0/CIwLpsXvRToYCRhfAVKPr1jdOjn/0YJe+0V+vI/6btUVZAPwjDPXOc2b8dAXHzjVNgJazqzlwC5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621792; c=relaxed/simple; bh=gtuuR3Gy7ywivAk4vPt0eTYBodC82LVmwXI0KSyFhM0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=cg9RgZnrsipL3CxD4MMHpGldhkt0NkQaTrMsdrC2LXRBS3yHFgRd/rNi2vF13Zfc2lb7r9kbE8uviswhX82T1Z7Pk7CwmLfyZ97k3qdKTFODdAhn9a91C6djnGOQCJccVUGV6Krx01yB0slWK4ciAmNCmIk/D8pSt+FZQ3lDC88= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6010a.ext.cloudfilter.net ([10.0.30.248]) by cmsmtp with ESMTPS id x5gFqnO1V8HtexF7bqEXdx; Sun, 29 Oct 2023 23:23:07 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7aqjzfZruMPxF7bqQyRE; Sun, 29 Oct 2023 23:23:07 +0000 X-Authority-Analysis: v=2.4 cv=ZNHEJF3b c=1 sm=1 tr=0 ts=653ee95b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=ls6l4_V7LcGA53ig-DIA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=25FQ5g9qGdiRIlSLmTIWHJZFv/gJQODLjvDRaU4S5uI=; b=ViMynI9Pbcubp7/0QXITHuutLh Xgizn7wb2OAyXHB7NetRPoVIb3UAMdCumLTZY3HTMhlX5z2M6f6K8lbh+iOGah02WH1gA2g97Wf0u Mwt2Vob0DbUh9HeZlkNnXfCxP; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7a-0042zY-2S for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:06 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:29 -0600 Subject: [PATCH 08/30] Use block_symbol::address in ax-gdb.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-8-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7a-0042zY-2S X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfBHSTXfTsd2GaKpmYu70E/jZm2rrDmobw4ojOMkRCNjx3r+fPQB9jlCvY3TWG+WGN+b0O1Cz73xqnSaHxwrhDEPUEz0iHPSPHqDJ0MxcCJGnGeNXKfHK oBEYmYVdOOlMtlYsu+cbH3ay9gv7ifXF3ASqkIIQ6K0qpKyxIGk+31a+z/yZWxhvdgEBPerocdFnDjP1wiFXd9H1sEWORWLArts= 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 This changes ax-gdb.c to use block_symbol::address. --- gdb/ax-gdb.c | 28 +++++++++++++++------------- gdb/ax-gdb.h | 2 +- gdb/tracepoint.c | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index a679c864915..dc3ac14078f 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -86,7 +86,7 @@ static void gen_frame_locals_address (struct agent_expr *); static void gen_offset (struct agent_expr *ax, int offset); static void gen_sym_offset (struct agent_expr *, struct symbol *); static void gen_var_ref (struct agent_expr *ax, struct axs_value *value, - struct symbol *var); + block_symbol var); static void gen_int_literal (struct agent_expr *ax, @@ -515,8 +515,10 @@ gen_sym_offset (struct agent_expr *ax, struct symbol *var) symbol VAR. Set VALUE to describe the result. */ static void -gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) +gen_var_ref (struct agent_expr *ax, struct axs_value *value, block_symbol bvar) { + symbol *var = bvar.symbol; + /* Dereference any typedefs. */ value->type = check_typedef (var->type ()); value->optimized_out = 0; @@ -536,7 +538,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) break; case LOC_LABEL: /* A goto label, being used as a value. */ - ax_const_l (ax, (LONGEST) var->value_address ()); + ax_const_l (ax, (LONGEST) bvar.address ()); value->kind = axs_rvalue; break; @@ -547,7 +549,7 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) /* Variable at a fixed location in memory. Easy. */ case LOC_STATIC: /* Push the address of the variable. */ - ax_const_l (ax, var->value_address ()); + ax_const_l (ax, bvar.address ()); value->kind = axs_lvalue_memory; break; @@ -1457,9 +1459,9 @@ gen_static_field (struct agent_expr *ax, struct axs_value *value, else { const char *phys_name = type->field (fieldno).loc_physname (); - struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0).symbol; + block_symbol sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0); - if (sym) + if (sym.symbol != nullptr) { gen_var_ref (ax, value, sym); @@ -1553,7 +1555,7 @@ gen_maybe_namespace_elt (struct agent_expr *ax, struct axs_value *value, if (sym.symbol == NULL) return 0; - gen_var_ref (ax, value, sym.symbol); + gen_var_ref (ax, value, sym); if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), @@ -1896,7 +1898,7 @@ op_this_operation::do_generate_ax (struct expression *exp, struct axs_value *value, struct type *cast_type) { - struct symbol *sym, *func; + struct symbol *func; const struct block *b; const struct language_defn *lang; @@ -1904,15 +1906,15 @@ op_this_operation::do_generate_ax (struct expression *exp, func = b->linkage_function (); lang = language_def (func->language ()); - sym = lookup_language_this (lang, b).symbol; - if (!sym) + block_symbol sym = lookup_language_this (lang, b); + if (sym.symbol == nullptr) error (_("no `%s' found"), lang->name_of_this ()); gen_var_ref (ax, value, sym); if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), - sym->print_name ()); + sym.symbol->print_name ()); } void @@ -2003,7 +2005,7 @@ var_value_operation::do_generate_ax (struct expression *exp, struct axs_value *value, struct type *cast_type) { - gen_var_ref (ax, value, std::get<0> (m_storage).symbol); + gen_var_ref (ax, value, std::get<0> (m_storage)); if (value->optimized_out) error (_("`%s' has been optimized out, cannot use"), @@ -2330,7 +2332,7 @@ gen_expr_unop (struct expression *exp, agent_expr_up gen_trace_for_var (CORE_ADDR scope, struct gdbarch *gdbarch, - struct symbol *var, int trace_string) + block_symbol var, int trace_string) { agent_expr_up ax (new agent_expr (gdbarch, scope)); struct axs_value value; diff --git a/gdb/ax-gdb.h b/gdb/ax-gdb.h index 4f73385208c..8376d7ee29e 100644 --- a/gdb/ax-gdb.h +++ b/gdb/ax-gdb.h @@ -106,7 +106,7 @@ extern agent_expr_up gen_trace_for_expr (CORE_ADDR, struct expression *, int); extern agent_expr_up gen_trace_for_var (CORE_ADDR, struct gdbarch *, - struct symbol *, int); + block_symbol, int); extern agent_expr_up gen_trace_for_return_address (CORE_ADDR, struct gdbarch *, diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 6d017179283..80239200984 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1010,7 +1010,7 @@ collection_list::collect_symbol (block_symbol bsym, if (treat_as_expr) { agent_expr_up aexpr = gen_trace_for_var (scope, gdbarch, - sym, trace_string); + bsym, trace_string); /* It can happen that the symbol is recorded as a computed location, but it's been optimized away and doesn't actually From patchwork Sun Oct 29 23:23:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78704 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 AB4A038768A2 for ; Sun, 29 Oct 2023 23:24:03 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 033DC38618F4 for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 033DC38618F4 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 033DC38618F4 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; cv=none; b=WrmHZM2U7DY+tUexwNYD3VH+RLPwmIhNauS2W3IyC7GJw+2Ga66JM+GTdFk7M6APUEIwngM5AT9IBipCN39UX8hhX3D8eqgN/VY5KIMMN0ZCy9tQLQGMw4YulG3Y0AEuV5GZrCpp89i9GaOHChGsAosuzcNdREtqJEbn1LVmLIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; c=relaxed/simple; bh=DPvThK9Hi8lJ3cDNv8l1mdVMIC/SwfsF7LcMAIBkbkQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=vmhqDGE2APpWxFmZ69JYZyIfu3n0uBIFnYkVkgcyYEStdrOBVrzoD6gZVGDZTLUcIfsFVyjt1EJwyRl6Y8Dv6e1qexLaY6GcOsibMSPH3b7FvcOyKdlb9K5Tol1t9h2w+CyuKRtaIxuuLiyGNUcHxqqGjNy3qI63lKdNZU0vUvc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id wu9rqrZtsL9AgxF7cqdPr5; Sun, 29 Oct 2023 23:23:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7bqy0HOkmEdxF7bqWc8P; Sun, 29 Oct 2023 23:23:07 +0000 X-Authority-Analysis: v=2.4 cv=AsL9YcxP c=1 sm=1 tr=0 ts=653ee95b a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=vdn_P9uBLAvIqKZbNcQA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=q2Vlx3e2jSIOMCiEsZm7xt3crHc7RzpftVTxddlFXrE=; b=WXFajf3cw0dN3QT+c/3xnaSK3q QOtAQ8NfWUa6maRPse/QfYm/iAHtDEqzVHLw2cSYw1eSWznjet7HmI4WzSHvIyKouPxgo2jLnBcLC 11qj6++KK/EIL837gXI2l0dun; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-0S for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:30 -0600 Subject: [PATCH 09/30] Use block_symbol::address in linespec.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-9-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-0S X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfL9u36EW75ZmyDAhqsm5X6zkh/S0akrfQOl8+RIVquHJGCE8EOqVrkZjxU96+/Dbky/FpIypVTcJicGe7EhTMpIBP+Mzsbn9QuG/87tfQ7aZtCO1nTdo m4jHYXg1O9TKYHTN2fE4WyyWm3hmfC4Q0xpP1nGVDKVYUWXMWh5cBRsTXhC2xXtP0hYs6Ng3Ty5Dfw/Hn3I84AQ3o0dvp2wGAkk= 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 This changes linespec.c to use block_symbol::address. --- gdb/linespec.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/linespec.c b/gdb/linespec.c index fa733d880e3..a118a20cade 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -383,7 +383,7 @@ static struct line_offset const char *variable); static int symbol_to_sal (struct symtab_and_line *result, - int funfirstline, struct symbol *sym); + int funfirstline, block_symbol sym); static void add_matching_symbols_to_info (const char *name, symbol_name_match_type name_match_type, @@ -2187,7 +2187,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) struct program_space *pspace = sym.symbol->symtab ()->compunit ()->objfile ()->pspace; - if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) + if (symbol_to_sal (&sal, state->funfirstline, sym) && maybe_add_address (state->addr_set, pspace, sal.pc)) add_sal_to_sals (state, &sals, &sal, sym.symbol->natural_name (), 0); @@ -2252,7 +2252,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls) if (!found_ifunc) { symtab_and_line sal; - if (symbol_to_sal (&sal, state->funfirstline, sym.symbol) + if (symbol_to_sal (&sal, state->funfirstline, sym) && maybe_add_address (state->addr_set, pspace, sal.pc)) add_sal_to_sals (state, &sals, &sal, sym.symbol->natural_name (), 0); @@ -4358,8 +4358,9 @@ add_matching_symbols_to_info (const char *name, static int symbol_to_sal (struct symtab_and_line *result, - int funfirstline, struct symbol *sym) + int funfirstline, block_symbol bsym) { + symbol *sym = bsym.symbol; if (sym->aclass () == LOC_BLOCK) { *result = find_function_start_sal (sym, funfirstline); @@ -4367,13 +4368,13 @@ symbol_to_sal (struct symtab_and_line *result, } else { - if (sym->aclass () == LOC_LABEL && sym->value_address () != 0) + if (sym->aclass () == LOC_LABEL && bsym.address () != 0) { *result = {}; result->symtab = sym->symtab (); result->symbol = sym; result->line = sym->line (); - result->pc = sym->value_address (); + result->pc = bsym.address (); result->pspace = result->symtab->compunit ()->objfile ()->pspace; result->explicit_pc = 1; return 1; @@ -4389,7 +4390,7 @@ symbol_to_sal (struct symtab_and_line *result, result->symtab = sym->symtab (); result->symbol = sym; result->line = sym->line (); - result->pc = sym->value_address (); + result->pc = bsym.address (); result->pspace = result->symtab->compunit ()->objfile ()->pspace; return 1; } From patchwork Sun Oct 29 23:23:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78711 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 098383865C36 for ; Sun, 29 Oct 2023 23:24:42 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 58BDB3861923 for ; Sun, 29 Oct 2023 23:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58BDB3861923 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 58BDB3861923 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; cv=none; b=o5xU7xyFnkPTN5N1MAQ6urV6QmidU1Yd5jgXqGF0Dy/i7vYeQ9c+ounXYSht/VIgt3GXtOHXVseWowtg4KfWtgT7zYHmLaqqn+rhFlo1D984ThErLznFNFhKJV6P/AmtcqEXQGain6DJRyWKwNFRIobUNoMqT7WcDOVIk8K8W4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; c=relaxed/simple; bh=8U/naP98WbLG+gKeUyFr7Y6rOxCTafkM+wsQnUSGYFQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=VGQ8RF2V0cQDBODL8TxI0++/vFc2JUNOGJHQcHo/R1xaGhFDkZtvq5d2F95ywWA3fxx1oSfQFDxj+4FfTC0EroIANo3DFZEzE6BFR6Y2ghVSTN+t1uKwFpy6zls8ZZL6k3d1BBGteJqrsWDrtE2mDiLE1yVK3ukY6CFHipN53mk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5004a.ext.cloudfilter.net ([10.0.29.221]) by cmsmtp with ESMTPS id wrLfqrGGIL9AgxF7cqdPr9; Sun, 29 Oct 2023 23:23:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7bqRNZOnippxF7bqkS7N; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=VpAwvs6n c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=IlYUbf1OrnInEeu20AAA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=eXHAtvAvEI/NUiiwWCYTEatZn14AO2iv48ZF4L1miVo=; b=cMF0RQG5gH8BPU9SlJeh469GiL JcquET8oYYs4b+SqVdzd8+64jRsNFmhrRlN/hP2XqkklNKbTvKXnmu7VTULicsiKzaxiprKtbINLm 9UYKFUiCQvjixmZ6h0t5E55d0; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-0s for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:31 -0600 Subject: [PATCH 10/30] Use block_symbol::address in ada-lang.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-10-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-0s X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 11 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMQuEsrXbYuVNrDw46J8/oqlCCr6DYQ0QghrZr/OUkCACDbYwv4e9U0mTSB90KRgfAbT5wOMJqQN2hC7PxfO4PS0q4O08RaF957/MGj0PbXyeD0ZrY9J Z/InAlkr7x8/E1sNgfdP74188ZnQCHjtxy2a1R7Y9chfaUayxIs08jL7qRHExTYaxfbR7PMslRQL40c6cdh4ZeRxC7GxW8klaAE= 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 This changes ada-lang.c to use block_symbol::address. --- gdb/ada-lang.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3391aaeccb3..aeb21e0c15c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -160,8 +160,6 @@ static struct value *value_subscript_packed (struct value *, int, static struct value *coerce_unspec_val_to_type (struct value *, struct type *); -static int lesseq_defined_than (struct symbol *, struct symbol *); - static int equiv_types (struct type *, struct type *); static int is_name_suffix (const char *); @@ -4814,12 +4812,15 @@ equiv_types (struct type *type0, struct type *type1) return 0; } -/* True iff SYM0 represents the same entity as SYM1, or one that is - no more defined than that of SYM1. */ +/* True iff BSYM0 represents the same entity as BSYM1, or one that is + no more defined than that of BSYM1. */ static int -lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) +lesseq_defined_than (block_symbol bsym0, block_symbol bsym1) { + symbol *sym0 = bsym0.symbol; + symbol *sym1 = bsym1.symbol; + if (sym0 == sym1) return 1; if (sym0->domain () != sym1->domain () @@ -4853,7 +4854,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) const char *name0 = sym0->linkage_name (); const char *name1 = sym1->linkage_name (); return (strcmp (name0, name1) == 0 - && sym0->value_address () == sym1->value_address ()); + && bsym0.address () == bsym1.address ()); } default: @@ -4869,6 +4870,8 @@ add_defn_to_vec (std::vector &result, struct symbol *sym, const struct block *block) { + block_symbol info { sym, block }; + /* Do not try to complete stub types, as the debugger is probably already scanning all symbols matching a certain name at the time when this function is called. Trying to replace the stub @@ -4880,19 +4883,15 @@ add_defn_to_vec (std::vector &result, for (int i = result.size () - 1; i >= 0; i -= 1) { - if (lesseq_defined_than (sym, result[i].symbol)) + if (lesseq_defined_than (info, result[i])) return; - else if (lesseq_defined_than (result[i].symbol, sym)) + else if (lesseq_defined_than (result[i], info)) { - result[i].symbol = sym; - result[i].block = block; + result[i] = info; return; } } - struct block_symbol info; - info.symbol = sym; - info.block = block; result.push_back (info); } @@ -12999,8 +12998,10 @@ ada_add_exceptions_from_frame (compiled_regex *preg, default: if (ada_is_exception_sym (sym)) { + block_symbol bsym { sym, block }; + struct ada_exc_info info = {sym->print_name (), - sym->value_address ()}; + bsym.address ()}; exceptions->push_back (info); } @@ -13075,8 +13076,10 @@ ada_add_global_exceptions (compiled_regex *preg, if (ada_is_non_standard_exception_sym (sym) && name_matches_regex (sym->natural_name (), preg)) { + block_symbol bsym { sym, b }; + struct ada_exc_info info - = {sym->print_name (), sym->value_address ()}; + = {sym->print_name (), bsym.address ()}; exceptions->push_back (info); } From patchwork Sun Oct 29 23:23:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78700 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 F0C7C3876894 for ; Sun, 29 Oct 2023 23:23:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 7FEA538618DE for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7FEA538618DE 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 7FEA538618DE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621791; cv=none; b=scssUyCY8CLhC9tSpxtRJZN4MPTiyEovvRm/gRr4Z5Zq5XCyPj1xrwJQ95A3zL1mtbKuHa62zNaS36bn3nz+C6YOkmnxHh+n2SpB/XmqCooxrj7Pc2JA7sDmZjb1Y821LhH4h6xWGoelz0+J++glEE4AElod7IU+sXUYWNXnQTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621791; c=relaxed/simple; bh=qJe0ipy9gWDitjjBADu7a+2K+/Z3BAAfToNb99Vr8tY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=qdAT5h6aeH0yDOzT+rEMy37lGDcfO+hMvSY+tvaKbuWNjqVQFCnofCdK1x6XKwjU7mT1oe3ehtlYxrZbalwuedkldP4aH8wHfzcIJLyugtzrjzscpZGq5dCLolEB2R2coC8pRYkjQfz8RGIyU/44Jf+eXdqyV8FsgA22IwMRAdg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5009a.ext.cloudfilter.net ([10.0.29.176]) by cmsmtp with ESMTPS id x3NDq5t50WcCIxF7cqWTgF; Sun, 29 Oct 2023 23:23:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7bqHYFWI9guxF7cqvxRD; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=Ds1FRUz+ c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=INqLYPXPp5oCZDKoHgwA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=5AKr0bSIaT/Ha+aTED3LLEplqGwlqB+5YbJdZpuAllM=; b=yFl2OjsN96SvKaa9bYojF8T3l9 zXIRA2fyE7oRMUysDbj+3EOk/CFjos5x4Nl52Ve7RrLJGdNycGZwOpI5nrIO3203+kL3lhHIUyGo9 qshxofYQuRmBY8TwnU73i+J44; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-1S for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:32 -0600 Subject: [PATCH 11/30] Use block_symbol::address in symmisc.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-11-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-1S X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 12 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMdj3KamJVT1y70iAVUw4/D4zgCIgLZeMMOonC/RUxbYTGixcDXRGkguO1ZY2vrSP4eExh+bZRX1ogezdLPem1+HIfr1mFe/1akCqi+G4q93fTk3pAFe e7kzFXKlhArvGiFGD0HE7NkKhIDGaKMT6h0tJpMfDf1kDSdZHNCuh1f+jqqlGVjZioYxOd0ipm5idHG/qesO7us0bzS2JkDJHU0= 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_DNSWL_NONE, 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 This changes symmisc.c to use block_symbol::address. --- gdb/symmisc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gdb/symmisc.c b/gdb/symmisc.c index c1a6ab5cd7d..50b761a3b42 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -44,7 +44,7 @@ static int block_depth (const struct block *); -static void print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, +static void print_symbol (struct gdbarch *gdbarch, block_symbol symbol, int depth, ui_file *outfile); @@ -309,7 +309,8 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) { try { - print_symbol (gdbarch, sym, depth + 1, outfile); + block_symbol bsym { sym, b }; + print_symbol (gdbarch, bsym, depth + 1, outfile); } catch (const gdb_exception_error &ex) { @@ -489,11 +490,13 @@ maintenance_print_symbols (const char *args, int from_tty) /* Print symbol SYMBOL on OUTFILE. DEPTH says how far to indent. */ static void -print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, +print_symbol (struct gdbarch *gdbarch, block_symbol bsymbol, int depth, ui_file *outfile) { struct obj_section *section; + symbol *symbol = bsymbol.symbol; + if (symbol->is_objfile_owned ()) section = symbol->obj_section (symbol->objfile ()); else @@ -503,7 +506,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, if (symbol->domain () == LABEL_DOMAIN) { gdb_printf (outfile, "label %s at ", symbol->print_name ()); - gdb_puts (paddress (gdbarch, symbol->value_address ()), + gdb_puts (paddress (gdbarch, bsymbol.address ()), outfile); if (section) gdb_printf (outfile, " section %s\n", @@ -573,7 +576,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_STATIC: gdb_printf (outfile, "static at "); - gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile); + gdb_puts (paddress (gdbarch, bsymbol.address ()), outfile); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); @@ -613,7 +616,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, case LOC_LABEL: gdb_printf (outfile, "label at "); - gdb_puts (paddress (gdbarch, symbol->value_address ()), outfile); + gdb_puts (paddress (gdbarch, bsymbol.address ()), outfile); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); From patchwork Sun Oct 29 23:23:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78707 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 D902838319EE for ; Sun, 29 Oct 2023 23:24:07 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 1495838618FA for ; Sun, 29 Oct 2023 23:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1495838618FA 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 1495838618FA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621792; cv=none; b=q83Xzy/xKeeKZXV0cSNArwz+5QQrQEtF3+dVJgR6vkkSn1F6KeAAdIh+DdPpdPrbNuCOuNCTA3Czi+T2YG5+B992UiRd16FjO7KTZcjB8OUsThK06PSpLH1pe9Dfmc4YBMeNKb5V2dWaa2Z+EyFa0X1HLYMCh44d6nfrpC0aCfY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621792; c=relaxed/simple; bh=g9JbqdJ/76LdF+mVHrVA4nc9eSrhxftb/3IpLH+8MHg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=riNNRG5O/qN4xlyTmLE+vf/w0IdiPPNn1dQPW7cOv04kpo3F8qellCjnIChFKlHZDS8RidnB2fC9T9EzuWqPdNLKKC9HWnlWvV0Ewgnq2PTKZM1BSpY25Y1D/O0VAO0/TdFFi8Q+zGSKqrIxwLFa6NRgFz01iQDurWJ7KZPON3E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id wrLlqblVwjtZ3xF7dqTyKE; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7bqF6RywasUxF7cqq23Y; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=ZpP+lv3G c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=aqUAavmje40TS3ATxx8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=jlwDAs0SNryrfiqGnL1YDM9RYM17xet2cxbI6izz6zQ=; b=S+rx+mZFubqGoLKeZdNbQfQrwV o/C21FQnmStAK/nyVw0BBdcLAbuarJ8f3pK6gVpvKpWjF33fT45m6s0/ASixyZ1NIuvS2XHnPNY+E AGxAdlr/F6zQm6nEQQ5+9BieS; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-1v for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:33 -0600 Subject: [PATCH 12/30] Introduce read_var_value overload MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-12-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-1v X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfArP58j66rClxdZgQfremzquKx0V4HA4xPrh4d72YhJ2j4G2XU5mJ+Kg2a2oAooBhwX5w0CI/8IFTk0eZSNCZWC6hM4XPfT/MkKgCNI04OP0CpPoK0cx NW6d9h8CV1XlEzvxHHabPgwRofqYwQ6plFJ2qa1FmaNu89R5T0+b/tBGLHf2mVs3EY8DrmM8XyRd2QuAvZ4EmXTtLdAVJ7g7e+E= X-Spam-Status: No, score=-3024.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, 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 This adds an overload of read_var_value that accepts a block_symbol. The next batch of patches concern rewriting gdb to use this overload, in the end allowing us to remove a use of value_address. --- gdb/compile/compile-c-symbols.c | 2 +- gdb/compile/compile-cplus-symbols.c | 2 +- gdb/findvar.c | 12 ++++++++++++ gdb/infrun.c | 2 +- gdb/valops.c | 26 ++++++++++++-------------- gdb/value.h | 3 +++ 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 2d49ead249e..40578bf36f4 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -155,7 +155,7 @@ convert_one_symbol (compile_c_instance *context, sym.symbol->print_name ()); } - val = read_var_value (sym.symbol, sym.block, frame); + val = read_var_value (sym, frame); if (val->lval () != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation " "evaluation as its address has not been found."), diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index dec0260bf7a..1288225f08e 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -151,7 +151,7 @@ convert_one_symbol (compile_cplus_instance *instance, sym.symbol->print_name ()); } - val = read_var_value (sym.symbol, sym.block, frame); + val = read_var_value (sym, frame); if (val->lval () != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation " "evaluation as its address has not been found."), diff --git a/gdb/findvar.c b/gdb/findvar.c index 4e992ecdcc7..909dca65532 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -794,6 +794,18 @@ read_var_value (struct symbol *var, const struct block *var_block, return lang->read_var_value (var, var_block, frame); } +/* Calls VAR's language read_var_value hook with the given arguments. */ + +struct value * +read_var_value (block_symbol var, frame_info_ptr frame) +{ + const struct language_defn *lang = language_def (var.symbol->language ()); + + gdb_assert (lang != NULL); + + return lang->read_var_value (var.symbol, var.block, frame); +} + /* Install default attributes for register values. */ struct value * diff --git a/gdb/infrun.c b/gdb/infrun.c index 4fde96800fb..a7cb02c958e 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8311,7 +8311,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp, vsym = lookup_symbol_search_name (sym->search_name (), b, VAR_DOMAIN); - value = read_var_value (vsym.symbol, vsym.block, frame); + value = read_var_value (vsym, frame); /* If the value was optimized out, revert to the old behavior. */ if (! value->optimized_out ()) { diff --git a/gdb/valops.c b/gdb/valops.c index 70851cd40b4..b7ed458a649 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3711,17 +3711,16 @@ value_struct_elt_for_reference (struct type *domain, int offset, if (TYPE_FN_FIELD_STATIC_P (f, j)) { - struct symbol *s = - lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j), - 0, VAR_DOMAIN, 0).symbol; + block_symbol s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j), + 0, VAR_DOMAIN, 0); - if (s == NULL) - return NULL; + if (s.symbol == nullptr) + return nullptr; if (want_address) - return value_addr (read_var_value (s, 0, 0)); + return value_addr (read_var_value (s, 0)); else - return read_var_value (s, 0, 0); + return read_var_value (s, 0); } if (TYPE_FN_FIELD_VIRTUAL_P (f, j)) @@ -3742,14 +3741,13 @@ value_struct_elt_for_reference (struct type *domain, int offset, } else { - struct symbol *s = - lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j), - 0, VAR_DOMAIN, 0).symbol; + block_symbol s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j), + 0, VAR_DOMAIN, 0); - if (s == NULL) - return NULL; + if (s.symbol == nullptr) + return nullptr; - struct value *v = read_var_value (s, 0, 0); + struct value *v = read_var_value (s, 0); if (!want_address) result = v; else @@ -4000,7 +3998,7 @@ value_of_this (const struct language_defn *lang) error (_("current stack frame does not contain a variable named `%s'"), lang->name_of_this ()); - return read_var_value (sym.symbol, sym.block, frame); + return read_var_value (sym, frame); } /* Return the value of the local variable, if one exists. Return NULL diff --git a/gdb/value.h b/gdb/value.h index e4912717684..b683cbf5f90 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1140,6 +1140,9 @@ extern struct value *read_var_value (struct symbol *var, const struct block *var_block, frame_info_ptr frame); +extern struct value *read_var_value (block_symbol var, + frame_info_ptr frame); + extern struct value *allocate_repeat_value (struct type *type, int count); extern struct value *value_mark (void); From patchwork Sun Oct 29 23:23:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78710 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 5998C3875438 for ; Sun, 29 Oct 2023 23:24:27 +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 892953861926 for ; Sun, 29 Oct 2023 23:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 892953861926 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 892953861926 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=1698621794; cv=none; b=ZuB0BXeh3c9dY9uy7CcDzQt4kN7xX8x7uJXKfHakN4xYOSbSayRznBxrRAS83DXLnvYpUqPgjSM+e3Ls2fJ3pKcdUV9RJ8xmnpF1n4F41EYbU7L2IZqKCATspquRaAUb8P5ksX7qZij80pVHfYzjjn5Mf/CeGsSWgIIhOdybRC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621794; c=relaxed/simple; bh=kS/Ba0vxzNlNB47ilQfDU8ZwX/+0KAX+IbmmPSNNHAA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=QyqfGl4TN0dbhc4Z9YS8sVSJ9U11NC3Ql1l/mHtuEtiaKIUOauCOmBqbqIEBWhisksAxdOtDqCBaRml0Q5SPwPGVhA2eg+ZuZxAF8WLANuRxOafItd9k9LJ2L9imHS7+YJ4Sh+G705QKz3UvxuaoxHzi1NX48b6POYrLCseOZqA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6002a.ext.cloudfilter.net ([10.0.30.222]) by cmsmtp with ESMTPS id xD15qoDVZ8HtexF7cqEXe3; Sun, 29 Oct 2023 23:23:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7bqx1PAGYrgxF7cqfHZJ; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=bYd47cDB c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=xk1Hb6maDT9vQznErTcA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=rVfera5f7pj6Iem7yEfGlhX1r2AO1Y7zP0jDv19iAMY=; b=JMc+TIO9bN4Ju6XuBY1KQEcvua S2hm8aMVuXUSJgA4sk290ereasdUDnOmtYdrxG5ciw7aG3x7fcgu1oOFRFjN1lgHbEwXUElVnqrd3 A1iheqEgIZa8gyR3wMQqrK96K; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-2K for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:34 -0600 Subject: [PATCH 13/30] Use read_var_value in gdb/compile MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-13-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-2K X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 14 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfERYQiys0nKIaH0Y3EpWbNAxZCw+5FgKUVWZAOyjIPgqvpLH45B9QKSYB2GnXwx6ivffJ+yh71mY7CdCzoIM927wzOYQ3BP+D1f3RTMzIM9nqHgkfju7 GOuoT8uLdkiPm7wOmoQ7X6qnQWPjuL8BcbFs9JyYluouHY0CmtkEoqKL6H1XyUD/18EwRPEVy3oE9Iu0OPDQsbIr5HYY9I5eM60= X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, 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 This changes the code in gdb/compile to use the new read_var_value overload. --- gdb/compile/compile-c-symbols.c | 12 +++++++----- gdb/compile/compile-loc2c.c | 14 ++++++++------ gdb/compile/compile.h | 6 +++--- gdb/dwarf2/ada-imported.c | 2 +- gdb/dwarf2/loc.c | 12 +++++++----- gdb/dwarf2/loc.h | 3 ++- gdb/symtab.h | 2 +- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 40578bf36f4..b8632013909 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -493,7 +493,7 @@ generate_vla_size (compile_instance *compiler, std::vector ®isters_used, CORE_ADDR pc, struct type *type, - struct symbol *sym) + block_symbol sym) { type = check_typedef (type); @@ -546,8 +546,9 @@ generate_c_for_for_one_variable (compile_instance *compiler, struct gdbarch *gdbarch, std::vector ®isters_used, CORE_ADDR pc, - struct symbol *sym) + block_symbol bsym) { + struct symbol *sym = bsym.symbol; try { @@ -558,7 +559,7 @@ generate_c_for_for_one_variable (compile_instance *compiler, string_file local_file; generate_vla_size (compiler, &local_file, gdbarch, registers_used, pc, - sym->type (), sym); + sym->type (), bsym); stream->write (local_file.c_str (), local_file.size ()); } @@ -571,7 +572,7 @@ generate_c_for_for_one_variable (compile_instance *compiler, occurs in the middle. */ string_file local_file; - SYMBOL_COMPUTED_OPS (sym)->generate_c_location (sym, &local_file, + SYMBOL_COMPUTED_OPS (sym)->generate_c_location (bsym, &local_file, gdbarch, registers_used, pc, @@ -639,9 +640,10 @@ generate_c_for_variable_locations (compile_instance *compiler, compute the location of each local variable. */ for (struct symbol *sym : block_iterator_range (block)) { + block_symbol bsym { sym, block }; if (!symbol_seen (symhash.get (), sym)) generate_c_for_for_one_variable (compiler, stream, gdbarch, - registers_used, pc, sym); + registers_used, pc, bsym); } /* If we just finished the outermost block of a function, we're diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index 8a5a0f5abc5..ef150e7c27e 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -592,7 +592,7 @@ static void do_compile_dwarf_expr_to_c (int indent, string_file *stream, const char *type_name, const char *result_name, - struct symbol *sym, CORE_ADDR pc, + block_symbol bsym, CORE_ADDR pc, struct gdbarch *arch, std::vector ®isters_used, unsigned int addr_size, @@ -605,6 +605,8 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, unique names. */ static unsigned int scope; + struct symbol *sym = bsym.symbol; + enum bfd_endian byte_order = gdbarch_byte_order (arch); const gdb_byte * const base = op_ptr; int need_tempvar = 0; @@ -641,7 +643,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, "there is no selected frame"), sym->print_name ()); - val = read_var_value (sym, NULL, frame); + val = read_var_value (bsym, frame); if (val->lval () != lval_memory) error (_("Symbol \"%s\" cannot be used for compilation evaluation " "as its address has not been found."), @@ -909,7 +911,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, do_compile_dwarf_expr_to_c (indent, stream, GCC_UINTPTR, fb_name, - sym, pc, + bsym, pc, arch, registers_used, addr_size, datastart, datastart + datalen, NULL, per_cu, per_objfile); @@ -1097,7 +1099,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, do_compile_dwarf_expr_to_c (indent, stream, GCC_UINTPTR, cfa_name, - sym, pc, arch, registers_used, + bsym, pc, arch, registers_used, addr_size, cfa_start, cfa_end, &text_offset, per_cu, per_objfile); @@ -1143,7 +1145,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, void compile_dwarf_expr_to_c (string_file *stream, const char *result_name, - struct symbol *sym, CORE_ADDR pc, + block_symbol sym, CORE_ADDR pc, struct gdbarch *arch, std::vector ®isters_used, unsigned int addr_size, @@ -1162,7 +1164,7 @@ void compile_dwarf_bounds_to_c (string_file *stream, const char *result_name, const struct dynamic_prop *prop, - struct symbol *sym, CORE_ADDR pc, + block_symbol sym, CORE_ADDR pc, struct gdbarch *arch, std::vector ®isters_used, unsigned int addr_size, diff --git a/gdb/compile/compile.h b/gdb/compile/compile.h index a3b6a18fe20..7cb38cb006c 100644 --- a/gdb/compile/compile.h +++ b/gdb/compile/compile.h @@ -19,12 +19,12 @@ #define COMPILE_COMPILE_H #include "gcc-c-interface.h" +#include "block-symbol.h" struct ui_file; struct gdbarch; struct dwarf2_per_cu_data; struct dwarf2_per_objfile; -struct symbol; struct dynamic_prop; /* An object of this type holds state associated with a given @@ -177,7 +177,7 @@ extern void eval_compile_command (struct command_line *cmd, extern void compile_dwarf_expr_to_c (string_file *stream, const char *result_name, - struct symbol *sym, + block_symbol sym, CORE_ADDR pc, struct gdbarch *arch, std::vector ®isters_used, @@ -217,7 +217,7 @@ extern void compile_dwarf_expr_to_c (string_file *stream, extern void compile_dwarf_bounds_to_c (string_file *stream, const char *result_name, const struct dynamic_prop *prop, - struct symbol *sym, CORE_ADDR pc, + block_symbol sym, CORE_ADDR pc, struct gdbarch *arch, std::vector ®isters_used, unsigned int addr_size, diff --git a/gdb/dwarf2/ada-imported.c b/gdb/dwarf2/ada-imported.c index d1d99be6923..9947d8e04b7 100644 --- a/gdb/dwarf2/ada-imported.c +++ b/gdb/dwarf2/ada-imported.c @@ -75,7 +75,7 @@ ada_imported_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax, symbol_computed_ops. */ static void -ada_imported_generate_c_location (struct symbol *symbol, string_file *stream, +ada_imported_generate_c_location (block_symbol symbol, string_file *stream, struct gdbarch *gdbarch, std::vector ®isters_used, CORE_ADDR pc, const char *result_name) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 5b2d58ab44e..53031aa809a 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1786,7 +1786,7 @@ dwarf2_compile_property_to_c (string_file *stream, std::vector ®isters_used, const struct dynamic_prop *prop, CORE_ADDR pc, - struct symbol *sym) + block_symbol sym) { const dwarf2_property_baton *baton = prop->baton (); const gdb_byte *data; @@ -3847,11 +3847,12 @@ locexpr_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax, /* symbol_computed_ops 'generate_c_location' method. */ static void -locexpr_generate_c_location (struct symbol *sym, string_file *stream, +locexpr_generate_c_location (block_symbol bsym, string_file *stream, struct gdbarch *gdbarch, std::vector ®isters_used, CORE_ADDR pc, const char *result_name) { + symbol *sym = bsym.symbol; struct dwarf2_locexpr_baton *dlbaton = (struct dwarf2_locexpr_baton *) SYMBOL_LOCATION_BATON (sym); unsigned int addr_size = dlbaton->per_cu->addr_size (); @@ -3860,7 +3861,7 @@ locexpr_generate_c_location (struct symbol *sym, string_file *stream, error (_("symbol \"%s\" is optimized out"), sym->natural_name ()); compile_dwarf_expr_to_c (stream, result_name, - sym, pc, gdbarch, registers_used, addr_size, + bsym, pc, gdbarch, registers_used, addr_size, dlbaton->data, dlbaton->data + dlbaton->size, dlbaton->per_cu, dlbaton->per_objfile); } @@ -4083,11 +4084,12 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax, /* symbol_computed_ops 'generate_c_location' method. */ static void -loclist_generate_c_location (struct symbol *sym, string_file *stream, +loclist_generate_c_location (block_symbol bsym, string_file *stream, struct gdbarch *gdbarch, std::vector ®isters_used, CORE_ADDR pc, const char *result_name) { + symbol *sym = bsym.symbol; struct dwarf2_loclist_baton *dlbaton = (struct dwarf2_loclist_baton *) SYMBOL_LOCATION_BATON (sym); unsigned int addr_size = dlbaton->per_cu->addr_size (); @@ -4099,7 +4101,7 @@ loclist_generate_c_location (struct symbol *sym, string_file *stream, error (_("symbol \"%s\" is optimized out"), sym->natural_name ()); compile_dwarf_expr_to_c (stream, result_name, - sym, pc, gdbarch, registers_used, addr_size, + bsym, pc, gdbarch, registers_used, addr_size, data, data + size, dlbaton->per_cu, dlbaton->per_objfile); diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h index 5cf824d3ae2..9722083cbeb 100644 --- a/gdb/dwarf2/loc.h +++ b/gdb/dwarf2/loc.h @@ -21,6 +21,7 @@ #define DWARF2LOC_H #include "dwarf2/expr.h" +#include "block-symbol.h" struct symbol_computed_ops; struct dwarf2_per_objfile; @@ -144,7 +145,7 @@ void dwarf2_compile_property_to_c (string_file *stream, std::vector ®isters_used, const struct dynamic_prop *prop, CORE_ADDR address, - struct symbol *sym); + block_symbol sym); /* The symbol location baton types used by the DWARF-2 reader (i.e. SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct diff --git a/gdb/symtab.h b/gdb/symtab.h index 93cc1f11d08..5292fadbbab 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1130,7 +1130,7 @@ struct symbol_computed_ops The generated C code must assign the location to a local variable; this variable's name is RESULT_NAME. */ - void (*generate_c_location) (struct symbol *symbol, string_file *stream, + void (*generate_c_location) (block_symbol symbol, string_file *stream, struct gdbarch *gdbarch, std::vector ®isters_used, CORE_ADDR pc, const char *result_name); From patchwork Sun Oct 29 23:23:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78708 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 A3B1A387689B for ; Sun, 29 Oct 2023 23:24:23 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 0090F38618EF for ; Sun, 29 Oct 2023 23:23:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0090F38618EF 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 0090F38618EF Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; cv=none; b=OAi6cWB8JHGqeU4iD6eoOuPYT48c0ao4h3/gEcBMFs9NdSTyodks+Qmgt8VHLG8Vcq5UiAxaWhoLXGfg8z00dXaQ+DgP+L05rP0mvoyG1EYhxa8FdmCCMO619wtKI5p0Kqn14wkJUKY1VOPMJuDWL+1dQUXjN2tmOTrBxima/BI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621793; c=relaxed/simple; bh=7VHzn+HlpIHrXaJkL58g/G6e1Ju2E3O1uNuxbhw2dXk=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=wZWjH+dgbOWgsBSnKpAfoCqo3qxXm3gcHZ7epEwPkPh4Nvjm7tRK6qxyG/X2h1QwvjpBKIP1OlCI4FNXR2ARQCjoy16xVeYc31lAeusk8Aof81aVDwkPJJZyuIfU53O7iIHBkEat+OM7At08OSXxJa+F9VnUqb1v361S6STzzzk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5002a.ext.cloudfilter.net ([10.0.29.215]) by cmsmtp with ESMTPS id xB11qAo1G6nOZxF7cqwrf5; Sun, 29 Oct 2023 23:23:08 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqlJoWF1O4xF7cq7arA; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=ePMSK9q8hqG6NbDvU7cA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=ySQIrp9rlZphOikU+DCUOQpyU821vhNhhAu5FwcHc+w=; b=LwVThGXWcKEvNECH2uTI2hFBBC TeUfXH3xPCu21DfwgXPCq9gS9Hlr9g5eDcYWEWk/agxM8357AuVQ2p7HpT0hrBCe3WHGRoGNfxuBE dqByWCMs1MhGyRrcoT+SrOb9q; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-2i for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:35 -0600 Subject: [PATCH 14/30] Return a block_symbol from find_pc_sect_function MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-14-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-2i X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 15 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMQuEsrXbYuVNrDw46J8/oqlCCr6DYQ0QghrZr/OUkCACDbYwv4e9U0mTSB90KRgfAbT5wOMJqQN2hC7PxfO4PS0q4O08RaF957/MGj0PbXyeD0ZrY9J Z/InAlkr7x8/E1sNgfdP74188ZnQCHjtxy2a1R7Y9chfaUayxIs08jL7qRHExTYaxfbR7PMslRQL40c6cdh4ZeRxC7GxW8klaAE= 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_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.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 This changes find_pc_sect_function to return a block_symbol and updates all the callers in a minimal way. A less intrusive approach might be possible -- but in the long run we'll want to add an objfile into this result, so it makes sense to go ahead with the conversion now. --- gdb/blockframe.c | 12 ++++++------ gdb/breakpoint.c | 2 +- gdb/btrace.c | 2 +- gdb/cli/cli-cmds.c | 4 ++-- gdb/dwarf2/loc.c | 2 +- gdb/eval.c | 2 +- gdb/guile/scm-frame.c | 2 +- gdb/infcall.c | 2 +- gdb/infcmd.c | 6 +++--- gdb/infrun.c | 4 ++-- gdb/printcmd.c | 2 +- gdb/python/py-finishbreakpoint.c | 2 +- gdb/solib-frv.c | 2 +- gdb/sparc-tdep.c | 4 ++-- gdb/symtab.c | 4 ++-- gdb/symtab.h | 4 ++-- gdb/tracepoint.c | 4 ++-- 17 files changed, 30 insertions(+), 30 deletions(-) diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 633a9674d97..981094803ed 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -132,21 +132,21 @@ get_frame_function (frame_info_ptr frame) /* Return the function containing pc value PC in section SECTION. Returns 0 if function is not known. */ -struct symbol * +block_symbol find_pc_sect_function (CORE_ADDR pc, struct obj_section *section) { const struct block *b = block_for_pc_sect (pc, section); if (b == 0) - return 0; - return b->linkage_function (); + return {}; + return { b->linkage_function (), b }; } /* Return the function containing pc value PC. Returns 0 if function is not known. Backward compatibility, no section */ -struct symbol * +block_symbol find_pc_function (CORE_ADDR pc) { return find_pc_sect_function (pc, find_pc_mapped_section (pc)); @@ -251,7 +251,7 @@ find_pc_partial_function_sym (CORE_ADDR pc, address of the function. This will happen when the function has more than one range and the entry pc is not within the lowest range of addresses. */ - f = find_pc_sect_function (mapped_pc, section); + f = find_pc_sect_function (mapped_pc, section).symbol; if (f != NULL && (msymbol.minsym == NULL || (f->value_block ()->entry_pc () @@ -421,7 +421,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name, struct type * find_function_type (CORE_ADDR pc) { - struct symbol *sym = find_pc_function (pc); + struct symbol *sym = find_pc_function (pc).symbol; if (sym != NULL && sym->value_block ()->entry_pc () == pc) return sym->type (); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 828c99cabc0..60ba22c3257 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12865,7 +12865,7 @@ update_static_tracepoint (tracepoint *tp, struct symtab_and_line sal) tp->number, tp->static_trace_marker_id.c_str ()); symtab_and_line sal2 = find_pc_line (tpmarker->address, 0); - sym = find_pc_sect_function (tpmarker->address, NULL); + sym = find_pc_sect_function (tpmarker->address, NULL).symbol; uiout->text ("Now in "); if (sym) { diff --git a/gdb/btrace.c b/gdb/btrace.c index 3f72b9c91e5..ea18daa23e0 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -556,7 +556,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) /* Try to determine the function we're in. We use both types of symbols to avoid surprises when we sometimes get a full symbol and sometimes only a minimal symbol. */ - fun = find_pc_function (pc); + fun = find_pc_function (pc).symbol; bmfun = lookup_minimal_symbol_by_pc (pc); mfun = bmfun.minsym; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 8cadd637151..cfd0ff15acb 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -1040,7 +1040,7 @@ edit_command (const char *arg, int from_tty) paddress (get_current_arch (), sal.pc)); gdbarch = sal.symtab->compunit ()->objfile ()->arch (); - sym = find_pc_function (sal.pc); + sym = find_pc_function (sal.pc).symbol; if (sym) gdb_printf ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc), @@ -1424,7 +1424,7 @@ list_command (const char *arg, int from_tty) paddress (get_current_arch (), sal.pc)); gdbarch = sal.symtab->compunit ()->objfile ()->arch (); - sym = find_pc_function (sal.pc); + sym = find_pc_function (sal.pc).symbol; if (sym) gdb_printf ("%s is in %s (%s:%d).\n", paddress (gdbarch, sal.pc), diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 53031aa809a..17509f81464 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -762,7 +762,7 @@ call_site_target::iterate_over_addresses static struct symbol * func_addr_to_tail_call_list (struct gdbarch *gdbarch, CORE_ADDR addr) { - struct symbol *sym = find_pc_function (addr); + struct symbol *sym = find_pc_function (addr).symbol; struct type *type; if (sym == NULL || sym->value_block ()->entry_pc () != addr) diff --git a/gdb/eval.c b/gdb/eval.c index b859e825925..9b76d3d5376 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2037,7 +2037,7 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, (exp->gdbarch, addr, current_inferior ()->top_target ()); /* Is it a high_level symbol? */ - sym = find_pc_function (addr); + sym = find_pc_function (addr).symbol; if (sym != NULL) method = value_of_variable (sym, 0); } diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 45863c587c1..74012ffea4f 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -666,7 +666,7 @@ gdbscm_frame_function (SCM self) if (frame != NULL) { found = true; - sym = find_pc_function (get_frame_address_in_block (frame)); + sym = find_pc_function (get_frame_address_in_block (frame)).symbol; } } catch (const gdb_exception &except) diff --git a/gdb/infcall.c b/gdb/infcall.c index 0f9ad34bbb4..a36a5e81b3a 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -413,7 +413,7 @@ static const char * get_function_name (CORE_ADDR funaddr, char *buf, int buf_size) { { - struct symbol *symbol = find_pc_function (funaddr); + struct symbol *symbol = find_pc_function (funaddr).symbol; if (symbol) return symbol->print_name (); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index cf8cd527955..c50d9bcd47d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -750,7 +750,7 @@ set_step_frame (thread_info *tp) set_step_info (tp, frame, sal); CORE_ADDR pc = get_frame_pc (frame); - tp->control.step_start_function = find_pc_function (pc); + tp->control.step_start_function = find_pc_function (pc).symbol; } /* Step until outside of current statement. */ @@ -1343,7 +1343,7 @@ until_next_command (int from_tty) not). */ pc = get_frame_pc (frame); - func = find_pc_function (pc); + func = find_pc_function (pc).symbol; if (!func) { @@ -1883,7 +1883,7 @@ finish_command (const char *arg, int from_tty) /* Find the function we will return from. */ frame_info_ptr callee_frame = get_selected_frame (nullptr); - sm->function = find_pc_function (get_frame_pc (callee_frame)); + sm->function = find_pc_function (get_frame_pc (callee_frame)).symbol; sm->return_buf = 0; /* Initialize buffer address is not available. */ /* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION, diff --git a/gdb/infrun.c b/gdb/infrun.c index a7cb02c958e..2a004690e67 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7343,7 +7343,7 @@ process_event_stop_test (struct execution_control_state *ecs) && ((ecs->event_thread->control.step_stack_frame_id != outer_frame_id) || (ecs->event_thread->control.step_start_function - != find_pc_function (ecs->event_thread->stop_pc ()))))) + != find_pc_function (ecs->event_thread->stop_pc ()).symbol)))) { CORE_ADDR stop_pc = ecs->event_thread->stop_pc (); CORE_ADDR real_stop_pc; @@ -8752,7 +8752,7 @@ print_stop_location (const target_waitstatus &ws) && (tp->control.step_frame_id == get_frame_id (get_current_frame ())) && (tp->control.step_start_function - == find_pc_function (tp->stop_pc ()))) + == find_pc_function (tp->stop_pc ()).symbol)) { /* Finished step, just print source line. */ source_flag = SRC_LINE; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 94ce5113e06..cb7023b1880 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -637,7 +637,7 @@ build_address_symbolic (struct gdbarch *gdbarch, anything/stabs--it would be inconvenient to eliminate those minimal symbols anyway). */ msymbol = lookup_minimal_symbol_by_pc_section (addr, section); - symbol = find_pc_sect_function (addr, section); + symbol = find_pc_sect_function (addr, section).symbol; if (symbol) { diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 627eb297542..04fc8c9e8a7 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -252,7 +252,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) { if (get_frame_pc_if_available (frame, &pc)) { - struct symbol *function = find_pc_function (pc); + struct symbol *function = find_pc_function (pc).symbol; if (function != nullptr) { struct type *ret_type = diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 0897bce2325..aeaf0044ba7 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -893,7 +893,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) /* Attempt to find the name of the function. If the name is available, it'll be used as an aid in finding matching functions in the dynamic symbol table. */ - sym = find_pc_function (entry_point); + sym = find_pc_function (entry_point).symbol; if (sym == 0) name = 0; else diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 78f240db04e..48a1adb7553 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1249,7 +1249,7 @@ sparc32_frame_cache (frame_info_ptr this_frame, void **this_cache) cache = sparc_frame_cache (this_frame, this_cache); - sym = find_pc_function (cache->pc); + sym = find_pc_function (cache->pc).symbol; if (sym) { cache->struct_return_p = sparc32_struct_return_from_sym (sym); @@ -1552,7 +1552,7 @@ static int sparc32_dwarf2_struct_return_p (frame_info_ptr this_frame) { CORE_ADDR pc = get_frame_address_in_block (this_frame); - struct symbol *sym = find_pc_function (pc); + struct symbol *sym = find_pc_function (pc).symbol; if (sym) return sparc32_struct_return_from_sym (sym); diff --git a/gdb/symtab.c b/gdb/symtab.c index 5ec56f4f2af..c1d78e1e2a6 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -3790,7 +3790,7 @@ skip_prologue_sal (struct symtab_and_line *sal) switch_to_program_space_and_thread (sal->pspace); - sym = find_pc_sect_function (sal->pc, sal->section); + sym = find_pc_sect_function (sal->pc, sal->section).symbol; if (sym != NULL) { objfile = sym->objfile (); @@ -4069,7 +4069,7 @@ find_function_alias_target (bound_minimal_symbol msymbol) if (!msymbol_is_function (msymbol.objfile, msymbol.minsym, &func_addr)) return NULL; - symbol *sym = find_pc_function (func_addr); + symbol *sym = find_pc_function (func_addr).symbol; if (sym != NULL && sym->aclass () == LOC_BLOCK && sym->value_block ()->entry_pc () == func_addr) diff --git a/gdb/symtab.h b/gdb/symtab.h index 5292fadbbab..9f7257f3002 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2149,13 +2149,13 @@ extern struct type *lookup_enum (const char *, const struct block *); return value will not be an inlined function; the containing function will be returned instead. */ -extern struct symbol *find_pc_function (CORE_ADDR); +extern block_symbol find_pc_function (CORE_ADDR); /* lookup the function corresponding to the address and section. The return value will not be an inlined function; the containing function will be returned instead. */ -extern struct symbol *find_pc_sect_function (CORE_ADDR, struct obj_section *); +extern block_symbol find_pc_sect_function (CORE_ADDR, struct obj_section *); /* lookup the function symbol corresponding to the address and section. The return value will be the closest enclosing function, diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 80239200984..9492274c5f4 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -217,7 +217,7 @@ set_traceframe_context (frame_info_ptr trace_frame) && get_frame_pc_if_available (trace_frame, &trace_pc)) { traceframe_sal = find_pc_line (trace_pc, 0); - traceframe_fun = find_pc_function (trace_pc); + traceframe_fun = find_pc_function (trace_pc).symbol; /* Save linenumber as "$trace_line", a debugger variable visible to users. */ @@ -3621,7 +3621,7 @@ print_one_static_tracepoint_marker (int count, uiout->field_core_addr ("addr", marker.gdbarch, marker.address); sal = find_pc_line (marker.address, 0); - sym = find_pc_sect_function (marker.address, NULL); + sym = find_pc_sect_function (marker.address, NULL).symbol; if (sym) { uiout->text ("in "); From patchwork Sun Oct 29 23:23:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78705 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 3DF1238319D2 for ; Sun, 29 Oct 2023 23:24:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id 17B6A38618FE for ; Sun, 29 Oct 2023 23:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17B6A38618FE 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 17B6A38618FE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621792; cv=none; b=UnYyeWTkKDorF+DUBLmPOiymwAEYdrn4GN9iyRTD/HUnvu1IDTwg3g8IouX4cL12iUoinaLPz0JoR18oCsorue/lSnB0Vus9eVpPpvcf9Nc51PFotlobcjw4asRi0jAB2KopHMFPvnJ1JhSNBKS6IJcZzfvCpBwoh8yulkaEIwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621792; c=relaxed/simple; bh=A7WsxTCBGkWKhymRUz7Alklv2Ufg9ul/oXNiu/KFPPY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=WoUvW9TEdbthabqmX+M3oFhvHiuPU2iv3AnTvhg00Vug3RKMZi4ZzwRQiLIdnhdN34BbwcZePVfOLQ3TuLtDgpnFfzTfx3PnjaOqjdQVOqpNopOq9rCWK+AbRbOf2OS26Vru6yowXeCYai0yOYYeAyoxF1fBuoI6KRzZl5SJDcw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5008a.ext.cloudfilter.net ([10.0.29.246]) by cmsmtp with ESMTPS id x3DKqdM9DjtZ3xF7dqTyKG; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqkcpipPpmxF7cqT07D; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=MJVzJeVl c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=bQpgz2UOOIGWnD5mVVUA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=QTefXyIwkro3tpBbwT38BYDKYQ55enUWsag+385+psM=; b=S0cW1xBTHUPSuZ9uv/+3Mc56qs O9Su3u7ftcgjkOaeRWFce5HqNXb151+DLDrY3MrOkNFMFslD1iXA/aE4yjMKSn7U2Dbsv65IBso/e k369UQAQxuS0MJlnSNeDG57PZ; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7b-0042zY-3A for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:07 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:36 -0600 Subject: [PATCH 15/30] Use read_var_value overload in finish_command_fsm MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-15-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7b-0042zY-3A X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 16 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfERYQiys0nKIaH0Y3EpWbNAxZCw+5FgKUVWZAOyjIPgqvpLH45B9QKSYB2GnXwx6ivffJ+yh71mY7CdCzoIM927wzOYQ3BP+D1f3RTMzIM9nqHgkfju7 GOuoT8uLdkiPm7wOmoQ7X6qnQWPjuL8BcbFs9JyYluouHY0CmtkEoqKL6H1XyUD/18EwRPEVy3oE9Iu0OPDQsbIr5HYY9I5eM60= X-Spam-Status: No, score=-3024.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, 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 This changes finish_command_fsm to store a block_symbol, so that the new read_var_value overload can be used. --- gdb/infcmd.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/gdb/infcmd.c b/gdb/infcmd.c index c50d9bcd47d..03e54438686 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1596,7 +1596,7 @@ struct finish_command_fsm : public thread_fsm breakpoint_up breakpoint; /* The function that we're stepping out of. */ - struct symbol *function = nullptr; + block_symbol function {}; /* If the FSM finishes successfully, this stores the function's return value. */ @@ -1629,14 +1629,14 @@ finish_command_fsm::should_stop (struct thread_info *tp) { struct return_value_info *rv = &return_value_info; - if (function != nullptr + if (function.symbol != nullptr && bpstat_find_breakpoint (tp->control.stop_bpstat, breakpoint.get ()) != nullptr) { /* We're done. */ set_finished (); - rv->type = function->type ()->target_type (); + rv->type = function.symbol->type ()->target_type (); if (rv->type == nullptr) internal_error (_("finish_command: function has no target type")); @@ -1644,13 +1644,13 @@ finish_command_fsm::should_stop (struct thread_info *tp) { struct value *func; - func = read_var_value (function, nullptr, get_current_frame ()); + func = read_var_value (function, get_current_frame ()); if (return_buf != 0) /* Retrieve return value from the buffer where it was saved. */ rv->value = value_at (rv->type, return_buf); else - rv->value = get_return_value (function, func); + rv->value = get_return_value (function.symbol, func); if (rv->value != nullptr) rv->value_history_index = rv->value->record_latest (); @@ -1883,22 +1883,22 @@ finish_command (const char *arg, int from_tty) /* Find the function we will return from. */ frame_info_ptr callee_frame = get_selected_frame (nullptr); - sm->function = find_pc_function (get_frame_pc (callee_frame)).symbol; + sm->function = find_pc_function (get_frame_pc (callee_frame)); sm->return_buf = 0; /* Initialize buffer address is not available. */ /* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION, attempt to determine the address of the return buffer. */ - if (sm->function != nullptr) + if (sm->function.symbol != nullptr) { enum return_value_convention return_value; struct gdbarch *gdbarch = get_frame_arch (callee_frame); struct type * val_type - = check_typedef (sm->function->type ()->target_type ()); + = check_typedef (sm->function.symbol->type ()->target_type ()); return_value = gdbarch_return_value_as_value (gdbarch, - read_var_value (sm->function, nullptr, + read_var_value (sm->function, callee_frame), val_type, nullptr, nullptr, nullptr); @@ -1916,10 +1916,11 @@ finish_command (const char *arg, int from_tty) gdb_printf (_("Run back to call of ")); else { - if (sm->function != nullptr && TYPE_NO_RETURN (sm->function->type ()) + if (sm->function.symbol != nullptr + && TYPE_NO_RETURN (sm->function.symbol->type ()) && !query (_("warning: Function %s does not return normally.\n" "Try to finish anyway? "), - sm->function->print_name ())) + sm->function.symbol->print_name ())) error (_("Not confirmed.")); gdb_printf (_("Run till exit from ")); } From patchwork Sun Oct 29 23:23:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78712 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 BC28F3861936 for ; Sun, 29 Oct 2023 23:24:44 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 9FA743861927 for ; Sun, 29 Oct 2023 23:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FA743861927 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 9FA743861927 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; cv=none; b=qrmLLcvSQF7nS1gPpRbVCeT22Iqgd7an9m2NeOQ1cNggRHGjRK/43ZfGcuS5UWmZyEcYwOujA+bZ6hxM+1wYDu7hAj6cn+4+IF2g7OngC0W/e2dfMl8Wl+KR89bOlfp3p8TeLJnqHGeZ8XttE+BMEy90LJ6TElxiqhddaPAhm/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; c=relaxed/simple; bh=A2JdQSWnRPUpseoXB2ufXNcgmgV52eXNts0TEIEqMcI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Xo5OKXXZEhl6Pcib0jXHx7J/GBJtmIhA3XYNi7s7hzmiDBS1ozalLox6Q4dIxxgIXyJ4midp6bybPflfupOasNAHmPMQFn0d3a462ySfddUTLBu9OevNYFuSFAhaSEF9MylIrxC6AcNAN+IASXvzvtUfZMhsPXdOW0lE5APAigY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id x5OfqACxM6nOZxF7dqwrfA; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqF6SMwasUxF7cqq23u; Sun, 29 Oct 2023 23:23:08 +0000 X-Authority-Analysis: v=2.4 cv=ZpP+lv3G c=1 sm=1 tr=0 ts=653ee95c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=1Kx2-WmDkH40D3dzqjAA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=HfQSy1hNGsPcJzeRbvkxK5I5nYcTgq1HEC6Yq1RQ9VU=; b=cVB4cGeHMwES+5guaeYirHZNL/ jWiTwohZXwfB0rZdMHiIb846z7TGYWmFGTy9RZDJqVEpPMe7azCtet65OzP9GeJ+BKRdYWakB23Ui oeL0Y8ps0Rcww9+8VDBSHGbXr; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-0K for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:37 -0600 Subject: [PATCH 16/30] Use block_symbol in overload-handling code MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-16-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-0K X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 17 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfArP58j66rClxdZgQfremzquKx0V4HA4xPrh4d72YhJ2j4G2XU5mJ+Kg2a2oAooBhwX5w0CI/8IFTk0eZSNCZWC6hM4XPfT/MkKgCNI04OP0CpPoK0cx NW6d9h8CV1XlEzvxHHabPgwRofqYwQ6plFJ2qa1FmaNu89R5T0+b/tBGLHf2mVs3EY8DrmM8XyRd2QuAvZ4EmXTtLdAVJ7g7e+E= 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_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.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 This changes the overload-handling code to use block_symbol. This is needed to update one of its callers to use the new read_var_value overload. --- gdb/cp-support.c | 46 ++++++++++++++++++++++++++-------------------- gdb/cp-support.h | 6 +++--- gdb/eval.c | 35 ++++++++++++++++++----------------- gdb/infcall.c | 2 +- gdb/valarith.c | 9 ++++----- gdb/valops.c | 34 +++++++++++++++++----------------- gdb/value.h | 4 ++-- 7 files changed, 71 insertions(+), 65 deletions(-) diff --git a/gdb/cp-support.c b/gdb/cp-support.c index e02e859b99a..4fbde37b280 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -57,17 +57,17 @@ static void demangled_name_complaint (const char *name); /* Functions related to overload resolution. */ -static void overload_list_add_symbol (struct symbol *sym, +static void overload_list_add_symbol (block_symbol sym, const char *oload_name, - std::vector *overload_list); + std::vector *overload_list); static void add_symbol_overload_list_using (const char *func_name, const char *the_namespace, - std::vector *overload_list); + std::vector *overload_list); static void add_symbol_overload_list_qualified (const char *func_name, - std::vector *overload_list); + std::vector *overload_list); /* The list of "maint cplus" commands. */ @@ -1210,18 +1210,20 @@ cp_entire_prefix_len (const char *name) OVERLOAD_LIST. */ static void -overload_list_add_symbol (struct symbol *sym, +overload_list_add_symbol (block_symbol bsym, const char *oload_name, - std::vector *overload_list) + std::vector *overload_list) { + symbol *sym = bsym.symbol; + /* If there is no type information, we can't do anything, so skip. */ if (sym->type () == NULL) return; /* skip any symbols that we've already considered. */ - for (symbol *listed_sym : *overload_list) - if (strcmp (sym->linkage_name (), listed_sym->linkage_name ()) == 0) + for (block_symbol listed_sym : *overload_list) + if (strcmp (sym->linkage_name (), listed_sym.symbol->linkage_name ()) == 0) return; /* Get the demangled name without parameters */ @@ -1234,18 +1236,18 @@ overload_list_add_symbol (struct symbol *sym, if (strcmp (sym_name.get (), oload_name) != 0) return; - overload_list->push_back (sym); + overload_list->push_back (bsym); } /* Return a null-terminated list of pointers to function symbols that are named FUNC_NAME and are visible within NAMESPACE. */ -struct std::vector +struct std::vector make_symbol_overload_list (const char *func_name, const char *the_namespace) { const char *name; - std::vector overload_list; + std::vector overload_list; overload_list.reserve (100); @@ -1273,12 +1275,15 @@ make_symbol_overload_list (const char *func_name, static void add_symbol_overload_list_block (const char *name, const struct block *block, - std::vector *overload_list) + std::vector *overload_list) { lookup_name_info lookup_name (name, symbol_name_match_type::FULL); for (struct symbol *sym : block_iterator_range (block, &lookup_name)) - overload_list_add_symbol (sym, name, overload_list); + { + block_symbol bsym { sym, block }; + overload_list_add_symbol (bsym, name, overload_list); + } } /* Adds the function FUNC_NAME from NAMESPACE to the overload set. */ @@ -1286,7 +1291,7 @@ add_symbol_overload_list_block (const char *name, static void add_symbol_overload_list_namespace (const char *func_name, const char *the_namespace, - std::vector *overload_list) + std::vector *overload_list) { const char *name; const struct block *block = NULL; @@ -1322,9 +1327,10 @@ add_symbol_overload_list_namespace (const char *func_name, base types. */ static void -add_symbol_overload_list_adl_namespace (struct type *type, - const char *func_name, - std::vector *overload_list) +add_symbol_overload_list_adl_namespace + (struct type *type, + const char *func_name, + std::vector *overload_list) { char *the_namespace; const char *type_name; @@ -1374,7 +1380,7 @@ add_symbol_overload_list_adl_namespace (struct type *type, void add_symbol_overload_list_adl (gdb::array_view arg_types, const char *func_name, - std::vector *overload_list) + std::vector *overload_list) { for (type *arg_type : arg_types) add_symbol_overload_list_adl_namespace (arg_type, func_name, @@ -1389,7 +1395,7 @@ add_symbol_overload_list_adl (gdb::array_view arg_types, static void add_symbol_overload_list_using (const char *func_name, const char *the_namespace, - std::vector *overload_list) + std::vector *overload_list) { struct using_direct *current; const struct block *block; @@ -1438,7 +1444,7 @@ add_symbol_overload_list_using (const char *func_name, static void add_symbol_overload_list_qualified (const char *func_name, - std::vector *overload_list) + std::vector *overload_list) { const struct block *surrounding_static_block = 0; diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 709dca46df1..7f27120a0fe 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -107,13 +107,13 @@ extern gdb::unique_xmalloc_ptr cp_remove_params extern gdb::unique_xmalloc_ptr cp_remove_params_if_any (const char *demangled_name, bool completion_mode); -extern std::vector make_symbol_overload_list (const char *, - const char *); +extern std::vector make_symbol_overload_list (const char *, + const char *); extern void add_symbol_overload_list_adl (gdb::array_view arg_types, const char *func_name, - std::vector *overload_list); + std::vector *overload_list); extern struct type *cp_lookup_rtti_type (const char *name, const struct block *block); diff --git a/gdb/eval.c b/gdb/eval.c index 9b76d3d5376..ba09599b28a 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -693,15 +693,15 @@ var_value_operation::evaluate_funcall (struct type *expect_type, for (int i = 0; i < args.size (); ++i) argvec[i] = args[i]->evaluate_with_coercion (exp, noside); - struct symbol *symp; + block_symbol symp; find_overload_match (argvec, NULL, NON_METHOD, - NULL, std::get<0> (m_storage).symbol, + NULL, std::get<0> (m_storage), NULL, &symp, NULL, 0, noside); - if (symp->type ()->code () == TYPE_CODE_ERROR) - error_unknown_type (symp->print_name ()); + if (symp.symbol->type ()->code () == TYPE_CODE_ERROR) + error_unknown_type (symp.symbol->print_name ()); value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block, - symp); + symp.symbol); return evaluate_subexp_do_call (exp, noside, callee, argvec, nullptr, expect_type); @@ -722,7 +722,7 @@ scope_operation::evaluate_funcall (struct type *expect_type, const std::string &name = std::get<1> (m_storage); struct type *type = std::get<0> (m_storage); - symbol *function = NULL; + block_symbol function {}; const char *function_name = NULL; std::vector argvec (1 + args.size ()); if (type->code () == TYPE_CODE_NAMESPACE) @@ -730,8 +730,8 @@ scope_operation::evaluate_funcall (struct type *expect_type, function = cp_lookup_symbol_namespace (type->name (), name.c_str (), get_selected_block (0), - VAR_DOMAIN).symbol; - if (function == NULL) + VAR_DOMAIN); + if (function.symbol == nullptr) error (_("No symbol \"%s\" in namespace \"%s\"."), name.c_str (), type->name ()); } @@ -755,7 +755,7 @@ scope_operation::evaluate_funcall (struct type *expect_type, int static_memfuncp; find_overload_match (arg_view, function_name, METHOD, - &argvec[0], nullptr, &callee, nullptr, + &argvec[0], {}, &callee, nullptr, &static_memfuncp, 0, noside); if (!static_memfuncp) { @@ -769,12 +769,12 @@ scope_operation::evaluate_funcall (struct type *expect_type, } else { - symbol *symp; + block_symbol symp; arg_view = arg_view.slice (1); find_overload_match (arg_view, nullptr, NON_METHOD, nullptr, function, nullptr, &symp, nullptr, 1, noside); - callee = value_of_variable (symp, get_selected_block (0)); + callee = value_of_variable (symp.symbol, get_selected_block (0)); } return evaluate_subexp_do_call (exp, noside, callee, arg_view, @@ -914,7 +914,7 @@ structop_base_operation::evaluate_funcall evaluation. */ value *val0 = vals[0]; find_overload_match (arg_view, tstr, METHOD, - &val0, nullptr, &callee, nullptr, + &val0, {}, &callee, nullptr, &static_memfuncp, 0, noside); vals[0] = val0; } @@ -2319,14 +2319,15 @@ adl_func_operation::evaluate (struct type *expect_type, for (int i = 0; i < arg_ops.size (); ++i) args[i] = arg_ops[i]->evaluate_with_coercion (exp, noside); - struct symbol *symp; + block_symbol symp; find_overload_match (args, std::get<0> (m_storage).c_str (), NON_METHOD, - nullptr, nullptr, + nullptr, {}, nullptr, &symp, nullptr, 0, noside); - if (symp->type ()->code () == TYPE_CODE_ERROR) - error_unknown_type (symp->print_name ()); - value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp); + if (symp.symbol->type ()->code () == TYPE_CODE_ERROR) + error_unknown_type (symp.symbol->print_name ()); + value *callee = evaluate_var_value (noside, std::get<1> (m_storage), + symp.symbol); return evaluate_subexp_do_call (exp, noside, callee, args, nullptr, expect_type); diff --git a/gdb/infcall.c b/gdb/infcall.c index a36a5e81b3a..54c14a097bc 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1187,7 +1187,7 @@ call_function_by_hand_dummy (struct value *function, value *cctor_args[2] = { clone_ptr, original_arg }; find_overload_match (gdb::make_array_view (cctor_args, 2), param_type->name (), METHOD, - &clone_ptr, nullptr, ©_ctor, nullptr, + &clone_ptr, {}, ©_ctor, nullptr, nullptr, 0, EVAL_NORMAL); if (copy_ctor == nullptr) diff --git a/gdb/valarith.c b/gdb/valarith.c index f3acf98c98b..5f9ecdf912c 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -338,25 +338,24 @@ static struct value * value_user_defined_cpp_op (gdb::array_view args, char *oper, int *static_memfuncp, enum noside noside) { - - struct symbol *symp = NULL; struct value *valp = NULL; + block_symbol symp; find_overload_match (args, oper, BOTH /* could be method */, &args[0] /* objp */, - NULL /* pass NULL symbol since symbol is unknown */, + {} /* pass NULL symbol since symbol is unknown */, &valp, &symp, static_memfuncp, 0, noside); if (valp) return valp; - if (symp) + if (symp.symbol != nullptr) { /* This is a non member function and does not expect a reference as its first argument rather the explicit structure. */ args[0] = value_ind (args[0]); - return value_of_variable (symp, 0); + return value_of_variable (symp.symbol, symp.block); } error (_("Could not find %s."), oper); diff --git a/gdb/valops.c b/gdb/valops.c index b7ed458a649..9cb9a7147e2 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -57,13 +57,13 @@ static struct value *search_struct_method (const char *, struct value **, static int find_oload_champ_namespace (gdb::array_view args, const char *, const char *, - std::vector *oload_syms, + std::vector *oload_syms, badness_vector *, const int no_adl); static int find_oload_champ_namespace_loop (gdb::array_view args, - const char *, const char *, - int, std::vector *oload_syms, + const char *, const char *, int, + std::vector *oload_syms, badness_vector *, int *, const int no_adl); @@ -71,7 +71,7 @@ static int find_oload_champ (gdb::array_view args, size_t num_fns, fn_field *methods, xmethod_worker_up *xmethods, - symbol **functions, + block_symbol *functions, badness_vector *oload_champ_bv); static int oload_method_static_p (struct fn_field *, int); @@ -2709,8 +2709,8 @@ incomplete_type_hint (gdb::array_view args) int find_overload_match (gdb::array_view args, const char *name, enum oload_search_type method, - struct value **objp, struct symbol *fsym, - struct value **valp, struct symbol **symp, + struct value **objp, block_symbol fsym, + struct value **valp, block_symbol *symp, int *staticp, const int no_adl, const enum noside noside) { @@ -2732,7 +2732,7 @@ find_overload_match (gdb::array_view args, /* For methods, the list of overloaded methods. */ gdb::array_view methods; /* For non-methods, the list of overloaded function symbols. */ - std::vector functions; + std::vector functions; /* For xmethods, the vector of xmethod workers. */ std::vector xmethods; struct type *basetype = NULL; @@ -2875,15 +2875,15 @@ find_overload_match (gdb::array_view args, if (method == BOTH) args[0] = value_ind (args[0]); - if (fsym) + if (fsym.symbol != nullptr) { - qualified_name = fsym->natural_name (); + qualified_name = fsym.symbol->natural_name (); /* If we have a function with a C++ name, try to extract just the function part. Do not try this for non-functions (e.g. function pointers). */ if (qualified_name - && (check_typedef (fsym->type ())->code () + && (check_typedef (fsym.symbol->type ())->code () == TYPE_CODE_FUNC)) { temp_func = cp_func_name (qualified_name); @@ -3059,7 +3059,7 @@ static int find_oload_champ_namespace (gdb::array_view args, const char *func_name, const char *qualified_name, - std::vector *oload_syms, + std::vector *oload_syms, badness_vector *oload_champ_bv, const int no_adl) { @@ -3086,7 +3086,7 @@ find_oload_champ_namespace_loop (gdb::array_view args, const char *func_name, const char *qualified_name, int namespace_len, - std::vector *oload_syms, + std::vector *oload_syms, badness_vector *oload_champ_bv, int *oload_champ, const int no_adl) @@ -3133,7 +3133,7 @@ find_oload_champ_namespace_loop (gdb::array_view args, strncpy (new_namespace, qualified_name, namespace_len); new_namespace[namespace_len] = '\0'; - std::vector new_oload_syms + std::vector new_oload_syms = make_symbol_overload_list (func_name, new_namespace); /* If we have reached the deepest level perform argument @@ -3202,7 +3202,7 @@ find_oload_champ (gdb::array_view args, size_t num_fns, fn_field *methods, xmethod_worker_up *xmethods, - symbol **functions, + block_symbol *functions, badness_vector *oload_champ_bv) { /* A measure of how good an overloaded instance is. */ @@ -3238,14 +3238,14 @@ find_oload_champ (gdb::array_view args, static_offset = oload_method_static_p (methods, ix); } else - nparms = functions[ix]->type ()->num_fields (); + nparms = functions[ix].symbol->type ()->num_fields (); parm_types.reserve (nparms); for (jj = 0; jj < nparms; jj++) { type *t = (methods != NULL ? (TYPE_FN_FIELD_ARGS (methods, ix)[jj].type ()) - : functions[ix]->type ()->field (jj).type ()); + : functions[ix].symbol->type ()->field (jj).type ()); parm_types.push_back (t); } } @@ -3269,7 +3269,7 @@ find_oload_champ (gdb::array_view args, gdb_printf (gdb_stderr, "Overloaded function instance " "%s # of parms %d\n", - functions[ix]->demangled_name (), + functions[ix].symbol->demangled_name (), (int) parm_types.size ()); gdb_printf (gdb_stderr, diff --git a/gdb/value.h b/gdb/value.h index b683cbf5f90..6f0b61a853d 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1294,8 +1294,8 @@ enum oload_search_type { NON_METHOD, METHOD, BOTH }; extern int find_overload_match (gdb::array_view args, const char *name, enum oload_search_type method, - struct value **objp, struct symbol *fsym, - struct value **valp, struct symbol **symp, + struct value **objp, block_symbol fsym, + struct value **valp, block_symbol *symp, int *staticp, const int no_adl, enum noside noside); From patchwork Sun Oct 29 23:23:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78714 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 ADB773875DC1 for ; Sun, 29 Oct 2023 23:24:46 +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 27FE73861929 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 27FE73861929 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 27FE73861929 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=1698621795; cv=none; b=vx9zwHy/SHnKnZpt5Bb8E8qEYExid8x8ec6zTOyNJ5m7Jd3uGU5t/YW7YQIqHLMf1DGRRQnrtgRiQJYfYWKm1OEFXnGtDAsGN6T64GhivGOzZ5hMbj63uhviprZorEBAzNsAYo6XbuOtvbhESnMWYEMM/A7UdVp9K3/UZ1goevY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; c=relaxed/simple; bh=SpEzjTDW4hBluDgMDuik13HVxJqF404+6UwE0rKix4I=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=NIqCDe+rBWtkIwASveJVmCeZ6n87grnQj+29VfU+zWAySgRJocpUzmcVhVLNgHnx0gZ0tRbsIIyx/obW1YUAJvp7mNjzUApT9FL+ghiGHmbdczZY6JtpwcY45gi2CFjXl5tit+V+bFDCX/FpwQj2Q1kjwkdiEfPOmWJ3HOl7jIs= 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 xBx7qo6Lm8HtexF7dqEXeD; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqqutboIDwxF7cqtrF8; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=TP1W9npa c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=eRxpThcnFnfATnHW0x4A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=yb8Hmy9RHuIssnX4ccShrhrWo3DjkAq5USNucNuGFvk=; b=by/QUEhVi2vmED7kkpohbeeDno D438X8X1c8bCPQ/zRWpN1u+proBRw+W4yg6UnxPho6qBeUe+Hiw6/QquwPThOQfpVH6va26++ffxI PjzTdc+ZCu2LyreuX/4vl3kXs; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-0k for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:38 -0600 Subject: [PATCH 17/30] Change evaluate_var_value to accept a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-17-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-0k X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 18 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfEP2uG8lrlDPG7+WBi0aH+MfMKNqhjv/BplLFbIZQV7bp/rnNPORachqDkghq2EjdFz8KmMUsdEZ+gnvCRxHQ88tH2ynooIpkIDMMTn3T+6HQlPXbnCU bTuxWRH7nSp9WqhegmTHmdODOzZ2OhuxoUzNiB/D3t2BTsjVwOIQh1ISl+ftGqCkjCOa61vH75aZlfk86wr/FbA86zR4Ow6FgWg= 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 This change evaluate_var_value to accept a block_symbol, preparing some code to use the new read_var_value overload. --- gdb/ada-lang.c | 4 +--- gdb/eval.c | 20 ++++++++------------ gdb/value.h | 3 +-- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index aeb21e0c15c..8f2fc5410d4 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10828,9 +10828,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type, struct expression *exp, enum noside noside) { - value *val = evaluate_var_value (noside, - std::get<0> (m_storage).block, - std::get<0> (m_storage).symbol); + value *val = evaluate_var_value (noside, std::get<0> (m_storage)); val = ada_value_cast (expect_type, val); diff --git a/gdb/eval.c b/gdb/eval.c index ba09599b28a..0f5e3c18a05 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -517,7 +517,7 @@ type_instance_operation::evaluate (struct type *expect_type, /* Helper for evaluating an OP_VAR_VALUE. */ value * -evaluate_var_value (enum noside noside, const block *blk, symbol *var) +evaluate_var_value (enum noside noside, block_symbol var) { /* JYG: We used to just return value::zero of the symbol type if we're asked to avoid side effects. Otherwise we return @@ -532,7 +532,7 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var) try { - ret = value_of_variable (var, blk); + ret = value_of_variable (var.symbol, var.block); } catch (const gdb_exception_error &except) @@ -540,7 +540,7 @@ evaluate_var_value (enum noside noside, const block *blk, symbol *var) if (noside != EVAL_AVOID_SIDE_EFFECTS) throw; - ret = value::zero (var->type (), not_lval); + ret = value::zero (var.symbol->type (), not_lval); } return ret; @@ -558,7 +558,7 @@ var_value_operation::evaluate (struct type *expect_type, symbol *var = std::get<0> (m_storage).symbol; if (var->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (var->print_name ()); - return evaluate_var_value (noside, std::get<0> (m_storage).block, var); + return evaluate_var_value (noside, std::get<0> (m_storage)); } } /* namespace expr */ @@ -700,8 +700,7 @@ var_value_operation::evaluate_funcall (struct type *expect_type, if (symp.symbol->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp.symbol->print_name ()); - value *callee = evaluate_var_value (noside, std::get<0> (m_storage).block, - symp.symbol); + value *callee = evaluate_var_value (noside, symp); return evaluate_subexp_do_call (exp, noside, callee, argvec, nullptr, expect_type); @@ -1108,7 +1107,7 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp, struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL); if (sym.symbol == NULL) error (_("No symbol \"%s\" in specified context."), var); - return evaluate_var_value (noside, sym.block, sym.symbol); + return evaluate_var_value (noside, sym); } /* Helper function that implements the body of OP_REGISTER. */ @@ -2326,8 +2325,7 @@ adl_func_operation::evaluate (struct type *expect_type, nullptr, &symp, nullptr, 0, noside); if (symp.symbol->type ()->code () == TYPE_CODE_ERROR) error_unknown_type (symp.symbol->print_name ()); - value *callee = evaluate_var_value (noside, std::get<1> (m_storage), - symp.symbol); + value *callee = evaluate_var_value (noside, symp); return evaluate_subexp_do_call (exp, noside, callee, args, nullptr, expect_type); @@ -2854,9 +2852,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type, struct expression *exp, enum noside noside) { - value *val = evaluate_var_value (noside, - std::get<0> (m_storage).block, - std::get<0> (m_storage).symbol); + value *val = evaluate_var_value (noside, std::get<0> (m_storage)); val = value_cast (to_type, val); diff --git a/gdb/value.h b/gdb/value.h index 6f0b61a853d..37c07a41205 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1344,8 +1344,7 @@ extern int using_struct_return (struct gdbarch *gdbarch, struct value *function, struct type *value_type); -extern value *evaluate_var_value (enum noside noside, const block *blk, - symbol *var); +extern value *evaluate_var_value (enum noside noside, block_symbol var); extern value *evaluate_var_msym_value (enum noside noside, struct objfile *objfile, From patchwork Sun Oct 29 23:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78713 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 EEB543875DE1 for ; Sun, 29 Oct 2023 23:24:44 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 976173861934 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 976173861934 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 976173861934 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; cv=none; b=xjX6CkOVdtDr6M76+BkFExV2cgFNTKffj+a74n9QSProhO+Vr7CAhOMGzu/9233GoxCmVTSAXe5/yszGNRrTe/Pd7AaxRN2MIKOsJGfLXD24SVu8DpiIkuDTLP6nslJnFZNplzTn3juX/dHz5ax5Be+v9IZ+z5xsBba2RXRguZE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; c=relaxed/simple; bh=acGl2LIXfvaYtWxTPv9AVEWbEVMUuEWgrqmCYKpJxLw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=AxD0L3D+SlJVvyUMLlv8un4hO1ce8fwFt2EKAwT275+qDVX7Ieksj1RbbsnTQOrcbU3ZsHEwmixjbK4P246lg4NfEjx4leCIqcmApQffsVaQLisBVT7LCHlSsBZ+cyC3g24H8+reIKEphFGGCMRxn6nMzUPlCONHsQPWGFTMebA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id x5Odq0sJ6hqFdxF7dqZuU7; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqy0IOkmEdxF7cqWc91; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=AsL9YcxP c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=WYKp5gSY-ysYaT8eYLwA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=jWtCARlyQErimW8a4e/YPhT5t4wIsxA71uMQ8+X6r6k=; b=cft96/vWRkCtKi2gqzjDpAtkNL CcOvIiVs+BPSYMD4uU/9gRHoq5DiOdEQAXzfsCR/TNrOv/15ejO6q4+hUisqBRcJNoUDFEZOcYHGg TZB9wlYCOhYdEdqCNLup1Q6EP; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-1D for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:39 -0600 Subject: [PATCH 18/30] Change value_of_variable to take a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-18-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-1D X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 19 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfJ7BMR0YRqCY6ze0vQkg6XOGkPhnIS4AzXUv9D9Ij2R/I4ecOMyEnItioHsbCILNcfzPaA0EOTWr9TQaCnyS0Z1xEF9nBqxUGKOyfYEjzLKXfh+xI1cL LAO2zPTj97nTq/WhYlF+ZKFn8IHEs8wzbMof06oHPMWB0GyUfQmi5ogUs3X0hKy8lb5CwOcB1QjMF1pGqlObIUv3A5ElPiO8nEM= 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 This changes value_of_variable to take a block_symbol and to call the new read_var_value overload. --- gdb/ada-lang.c | 2 +- gdb/dwarf2/loc.c | 2 +- gdb/eval.c | 17 +++++++---------- gdb/f-valprint.c | 4 ++-- gdb/python/py-type.c | 2 +- gdb/rust-lang.c | 2 +- gdb/valarith.c | 2 +- gdb/valops.c | 15 ++++++++------- gdb/value.c | 2 +- gdb/value.h | 6 ++---- 10 files changed, 25 insertions(+), 29 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 8f2fc5410d4..1f854940b36 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11389,7 +11389,7 @@ get_var_value (const char *name, const char *err_msg) error (("%s"), err_msg); } - return value_of_variable (syms[0].symbol, syms[0].block); + return value_of_variable (syms[0]); } /* Value of integer variable named NAME in the current environment. diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 17509f81464..fad32cfc27c 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -627,7 +627,7 @@ compute_var_value (const char *name) struct block_symbol sym = lookup_symbol (name, nullptr, VAR_DOMAIN, nullptr); if (sym.symbol != nullptr) - return value_of_variable (sym.symbol, sym.block); + return value_of_variable (sym); return nullptr; } diff --git a/gdb/eval.c b/gdb/eval.c index 0f5e3c18a05..5b40eed6799 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -532,7 +532,7 @@ evaluate_var_value (enum noside noside, block_symbol var) try { - ret = value_of_variable (var.symbol, var.block); + ret = value_of_variable (var); } catch (const gdb_exception_error &except) @@ -773,7 +773,7 @@ scope_operation::evaluate_funcall (struct type *expect_type, find_overload_match (arg_view, nullptr, NON_METHOD, nullptr, function, nullptr, &symp, nullptr, 1, noside); - callee = value_of_variable (symp.symbol, get_selected_block (0)); + callee = value_of_variable (symp); } return evaluate_subexp_do_call (exp, noside, callee, arg_view, @@ -2028,17 +2028,15 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp, addr = value_as_long (ret); if (addr) { - struct symbol *sym = NULL; - /* The address might point to a function descriptor; resolve it to the actual code address instead. */ addr = gdbarch_convert_from_func_ptr_addr (exp->gdbarch, addr, current_inferior ()->top_target ()); /* Is it a high_level symbol? */ - sym = find_pc_function (addr).symbol; - if (sym != NULL) - method = value_of_variable (sym, 0); + block_symbol sym = find_pc_function (addr); + if (sym.symbol != nullptr) + method = value_of_variable (sym); } /* If we found a method with symbol information, check to see @@ -2668,7 +2666,7 @@ var_value_operation::evaluate_for_address (struct expression *exp, return value::zero (type, not_lval); } else - return address_of_variable (var, std::get<0> (m_storage).block); + return address_of_variable (std::get<0> (m_storage)); } value * @@ -2681,8 +2679,7 @@ var_value_operation::evaluate_with_coercion (struct expression *exp, && !type->is_vector () && CAST_IS_CONVERSION (exp->language_defn)) { - struct value *val = address_of_variable (var, - std::get<0> (m_storage).block); + struct value *val = address_of_variable (std::get<0> (m_storage)); return value_cast (lookup_pointer_type (type->target_type ()), val); } return evaluate (nullptr, exp, noside); diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 2b7dafc4de3..5cafb5137e0 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -556,7 +556,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream, if (sym.symbol == nullptr) error (_("failed to find symbol for name list component %s"), field_name); - field = value_of_variable (sym.symbol, sym.block); + field = value_of_variable (sym); } else field = value_field (val, index); @@ -657,7 +657,7 @@ info_common_command_for_block (const struct block *block, const char *comname, try { - val = value_of_variable (common->contents[index], block); + val = value_of_variable ({ common->contents[index], block }); value_print (val, gdb_stdout, &opts); } diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index bfaa6d24d94..3c8b7f6c8b6 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -1065,7 +1065,7 @@ typy_template_argument (PyObject *self, PyObject *args) try { scoped_value_mark free_values; - struct value *val = value_of_variable (sym, block); + struct value *val = value_of_variable ({ sym, block }); result = value_to_value_object (val); } catch (const gdb_exception &except) diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index aa106b44bd9..841ca74137b 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -1574,7 +1574,7 @@ rust_structop::evaluate_funcall (struct type *expect_type, if (fn_type->field (0).type ()->code () == TYPE_CODE_PTR) args[0] = value_addr (args[0]); - value *function = address_of_variable (sym.symbol, block); + value *function = address_of_variable (sym); for (int i = 0; i < ops.size (); ++i) args[i + 1] = ops[i]->evaluate (nullptr, exp, noside); diff --git a/gdb/valarith.c b/gdb/valarith.c index 5f9ecdf912c..de77c757b04 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -355,7 +355,7 @@ value_user_defined_cpp_op (gdb::array_view args, char *oper, expect a reference as its first argument rather the explicit structure. */ args[0] = value_ind (args[0]); - return value_of_variable (symp.symbol, symp.block); + return value_of_variable (symp); } error (_("Could not find %s."), oper); diff --git a/gdb/valops.c b/gdb/valops.c index 9cb9a7147e2..07cc66b2a8d 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -130,7 +130,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) if (objf_p) *objf_p = sym.symbol->objfile (); - return value_of_variable (sym.symbol, sym.block); + return value_of_variable (sym); } else { @@ -1383,26 +1383,27 @@ value_repeat (struct value *arg1, int count) } struct value * -value_of_variable (struct symbol *var, const struct block *b) +value_of_variable (block_symbol var) { frame_info_ptr frame = NULL; - if (symbol_read_needs_frame (var)) + if (symbol_read_needs_frame (var.symbol)) frame = get_selected_frame (_("No frame selected.")); - return read_var_value (var, b, frame); + return read_var_value (var, frame); } struct value * -address_of_variable (struct symbol *var, const struct block *b) +address_of_variable (block_symbol bvar) { + symbol *var = bvar.symbol; struct type *type = var->type (); struct value *val; /* Evaluate it first; if the result is a memory address, we're fine. Lazy evaluation pays off here. */ - val = value_of_variable (var, b); + val = value_of_variable (bvar); type = val->type (); if ((val->lval () == lval_memory && val->lazy ()) @@ -3830,7 +3831,7 @@ value_maybe_namespace_elt (const struct type *curtype, && (sym.symbol->aclass () == LOC_TYPEDEF)) result = value::allocate (sym.symbol->type ()); else - result = value_of_variable (sym.symbol, sym.block); + result = value_of_variable (sym); if (want_address) result = value_addr (result); diff --git a/gdb/value.c b/gdb/value.c index 17b7c53d052..4fd77b774f6 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2897,7 +2897,7 @@ value_static_field (struct type *type, int fieldno) retval = value_at_lazy (field_type, msym.value_address ()); } else - retval = value_of_variable (sym.symbol, sym.block); + retval = value_of_variable (sym); break; } default: diff --git a/gdb/value.h b/gdb/value.h index 37c07a41205..7cb830110fc 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1117,11 +1117,9 @@ extern struct value *value_from_register (struct type *type, int regnum, extern CORE_ADDR address_from_register (int regnum, frame_info_ptr frame); -extern struct value *value_of_variable (struct symbol *var, - const struct block *b); +extern struct value *value_of_variable (block_symbol var); -extern struct value *address_of_variable (struct symbol *var, - const struct block *b); +extern struct value *address_of_variable (block_symbol var); extern struct value *value_of_register (int regnum, frame_info_ptr frame); From patchwork Sun Oct 29 23:23:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78717 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 996BF3831E1D for ; Sun, 29 Oct 2023 23:25:02 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 9B82E3861936 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B82E3861936 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 9B82E3861936 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; cv=none; b=i7AtN6+5IQheIy2VkekcvKtM7f1u87gUAYASza4/r6/J4/nhy2m7IfoB0XLb/GgJivp314cRY1WBdGE3EFWtwSqA6sb9x/QX478tTpnRcGbDFxmvOUU3+2JL8ZBaR4wxLw8jUb4uE3jntSEcV97luGNHEgn/sQPLcH6IpQFl0eE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; c=relaxed/simple; bh=FhklEKR4gi35PvUI+dq2r6E2JEyaRQKCmanPh4iWXDc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=KsN/SIFKAvlMBR6U+xetBCSDhrQgXjky1n4jPPKBBIL7/qr17dIhxB2xyPuT4ooXb9B9bYbUqPM2drDkRjY9CBym3P7MR4mouYCs4ac68c5J5iIJI3uWba/BZLIAUK+x4mhpOmT/a2uRsyDBgjh/cUI70Cs7lKBf5inr4H+etQ4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6003a.ext.cloudfilter.net ([10.0.30.151]) by cmsmtp with ESMTPS id x8gAq1GZJhqFdxF7dqZuU9; Sun, 29 Oct 2023 23:23:09 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqJcfSRqxCxF7cqwDwj; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=IY2U5Ema c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=zMMbdkV51knYF0lJCw0A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=jM6DCd68ONcyHipwLBjwge6Z2g3ZYg8IGT9HgotbGK4=; b=bzbW9kdf7RU+m19nTWXBiv51ek Ad6M515uvIlcasdZB2tV1mIgMZs9SRFamlVo+1BMRWcGxm2qVDFbatdKGVeFlm9vzKykqEB5GNqvI rSCidYPP+3uU4tn+VSfQGMGpr; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-1g for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:40 -0600 Subject: [PATCH 19/30] Return a block_symbol from get_frame_function MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-19-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-1g X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 20 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCYECl7A8G9VtTR9WvKCEzQTmDDvpWmOE89rJ8fwW0MONnRybnWwIR76dDGaMDYwm1Djg9WA0slSHrorzrUYK8HIQKg1AkLoBpsPFYP6d5qSmdbD4TLF Wy5UyQQyNuKEAN1yswa/yNd58YAuedlkFlEVkRI/9gTBnl0t4e6FR24WRSE6F6MqOW5vIF11hK4fT4XqTiG5jxtfkr0+H2PN994= 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 This changes get_frame_function to return a block_symbol, allowing updates in other places. Like some earlier patches, this change is the direction the code should go anyway -- the return value will eventually carry an objfile along with it. --- gdb/blockframe.c | 6 +++--- gdb/breakpoint.c | 2 +- gdb/findvar.c | 2 +- gdb/frame.c | 2 +- gdb/frame.h | 3 ++- gdb/infcmd.c | 4 ++-- gdb/infrun.c | 4 ++-- gdb/inline-frame.c | 2 +- gdb/skip.c | 2 +- gdb/stack.c | 8 ++++---- 10 files changed, 18 insertions(+), 17 deletions(-) diff --git a/gdb/blockframe.c b/gdb/blockframe.c index 981094803ed..3977ecd6229 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -114,18 +114,18 @@ get_pc_function_start (CORE_ADDR pc) /* Return the symbol for the function executing in frame FRAME. */ -struct symbol * +block_symbol get_frame_function (frame_info_ptr frame) { const struct block *bl = get_frame_block (frame, 0); if (bl == NULL) - return NULL; + return {}; while (bl->function () == NULL && bl->superblock () != NULL) bl = bl->superblock (); - return bl->function (); + return { bl->function (), bl }; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 60ba22c3257..311d21f02c5 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5287,7 +5287,7 @@ watchpoint_check (bpstat *bs) { struct symbol *function; - function = get_frame_function (fr); + function = get_frame_function (fr).symbol; if (function == NULL || !function->value_block ()->contains (b->exp_valid_block)) within_current_scope = false; diff --git a/gdb/findvar.c b/gdb/findvar.c index 909dca65532..f3be783ec24 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -408,7 +408,7 @@ follow_static_link (frame_info_ptr frame, in. */ for (; frame != NULL; frame = get_prev_frame (frame)) { - struct symbol *framefunc = get_frame_function (frame); + struct symbol *framefunc = get_frame_function (frame).symbol; /* Stacks can be quite deep: give the user a chance to stop this. */ QUIT; diff --git a/gdb/frame.c b/gdb/frame.c index 7077016ccba..315b94e4447 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2833,7 +2833,7 @@ find_frame_sal (frame_info_ptr frame) function, which can not be inferred from get_frame_pc. */ next_frame = get_next_frame (frame); if (next_frame) - sym = get_frame_function (next_frame); + sym = get_frame_function (next_frame).symbol; else sym = inline_skipped_symbol (inferior_thread ()); diff --git a/gdb/frame.h b/gdb/frame.h index 1d7422cac32..0f1640c4a68 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -69,6 +69,7 @@ */ +#include "block-symbol.h" #include "cli/cli-option.h" #include "frame-id.h" #include "gdbsupport/common-debug.h" @@ -856,7 +857,7 @@ extern const struct block *get_frame_block (frame_info_ptr, extern const struct block *get_selected_block (CORE_ADDR *addr_in_block); -extern struct symbol *get_frame_function (frame_info_ptr); +extern block_symbol get_frame_function (frame_info_ptr); extern CORE_ADDR get_pc_function_start (CORE_ADDR); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 03e54438686..2e9d913c41c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -957,7 +957,7 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) frame = get_current_frame (); sal = find_frame_sal (frame); - sym = get_frame_function (frame); + sym = get_frame_function (frame).symbol; if (sym != nullptr) fn = sym->print_name (); @@ -1085,7 +1085,7 @@ jump_command (const char *arg, int from_tty) resolve_sal_pc (&sal); /* May error out. */ /* See if we are trying to jump to another function. */ - fn = get_frame_function (get_current_frame ()); + fn = get_frame_function (get_current_frame ()).symbol; sfn = find_pc_sect_containing_function (sal.pc, find_pc_mapped_section (sal.pc)); if (fn != nullptr && sfn != fn) diff --git a/gdb/infrun.c b/gdb/infrun.c index 2a004690e67..3c85cb5f481 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4846,7 +4846,7 @@ inline_frame_is_marked_for_skip (bool prev_frame, struct thread_info *tp) break; sal = find_frame_sal (frame); - sym = get_frame_function (frame); + sym = get_frame_function (frame).symbol; if (sym != nullptr) fn = sym->print_name (); @@ -8390,7 +8390,7 @@ check_exception_resume (struct execution_control_state *ecs, return; } - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (!func) return; diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c index 80765d5cca5..48ada3597bf 100644 --- a/gdb/inline-frame.c +++ b/gdb/inline-frame.c @@ -179,7 +179,7 @@ inline_frame_this_id (frame_info_ptr this_frame, which generates DW_AT_entry_pc for inlined functions when possible. If this attribute is available, we should use it in the frame ID (and eventually, to set breakpoints). */ - func = get_frame_function (this_frame); + func = get_frame_function (this_frame).symbol; gdb_assert (func != NULL); (*this_id).code_addr = func->value_block ()->entry_pc (); (*this_id).artificial_depth++; diff --git a/gdb/skip.c b/gdb/skip.c index 28902a6d326..a11a35314e3 100644 --- a/gdb/skip.c +++ b/gdb/skip.c @@ -205,7 +205,7 @@ skip_function_command (const char *arg, int from_tty) if (arg == NULL) { frame_info_ptr fi = get_selected_frame (_("No default function now.")); - struct symbol *sym = get_frame_function (fi); + struct symbol *sym = get_frame_function (fi).symbol; const char *name = NULL; if (sym != NULL) diff --git a/gdb/stack.c b/gdb/stack.c index 0b35d62f82f..52448ff98a5 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1266,7 +1266,7 @@ find_frame_funname (frame_info_ptr frame, enum language *funlang, if (funcp) *funcp = NULL; - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (func) { const char *print_name = func->print_name (); @@ -1498,7 +1498,7 @@ info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) pc_regname = "pc"; frame_pc_p = get_frame_pc_if_available (fi, &frame_pc); - func = get_frame_function (fi); + func = get_frame_function (fi).symbol; symtab_and_line sal = find_frame_sal (fi); s = sal.symtab; gdb::unique_xmalloc_ptr func_only; @@ -2514,7 +2514,7 @@ print_frame_arg_vars (frame_info_ptr frame, return; } - func = get_frame_function (frame); + func = get_frame_function (frame).symbol; if (func == NULL) { if (!quiet) @@ -2699,7 +2699,7 @@ return_command (const char *retval_exp, int from_tty) std::string query_prefix; thisframe = get_selected_frame ("No selected frame."); - thisfun = get_frame_function (thisframe); + thisfun = get_frame_function (thisframe).symbol; gdbarch = get_frame_arch (thisframe); if (get_frame_type (get_current_frame ()) == INLINE_FRAME) From patchwork Sun Oct 29 23:23:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78718 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 1BFD33831E0D for ; Sun, 29 Oct 2023 23:25:04 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 61F583861931 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61F583861931 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 61F583861931 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; cv=none; b=kyODrmFiY5WZx101c9HvMuImEfhdfTgc8HX363/OlaLFp9dlzIlP3uOJbmPxGLgOUupgzZ+V4hQ+l3zJu6wRkyO96qFMrYHs+LhwxpuZ8/JVvaAseG3VEWFgg/qqZrl+AtlDU+AAxdZ6pnLtwsY+SPO0b8tUi1kJYGq+SQljIgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; c=relaxed/simple; bh=g4oYJLSoVVeOGmMjd74D2TcDi1aiDKR5N8XYwgBwcTg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=vep8WtDrWLyI5wehBMijBgRAZ5zcKpdWqlmZcOOe8SXTzvYdHnkLlJa29/1SmjxpMYA4CHe5+nx62CisafhAf+ZcinuDFwWXVZKVj1uPvtFiMbCH+QDvCpw+mn48MRW3qHXxHsINE4fGuPfIa3ZFoNYatizJYgFQ3vQBQ1K/Pis= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6008a.ext.cloudfilter.net ([10.0.30.227]) by cmsmtp with ESMTPS id weEmqdrptgpyExF7eqEFAI; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqdyYq79UBxF7dqNZaR; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=YqEc+qUX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=5DTYeCrgOUQH4HF58esA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=1fbHp/0Mffv9WFcM/sJJ62Sz8fqgBL5mept36tkgyDU=; b=eiwLwe3SWgm+NVXAEA4u2f6uDR H4fwATCbtNCT75J5oAqVZlNWnNDu5PzsbE0EwFPFVoZwB2IoMKKrb154NzgSOtx0efX2cR06dNs9q UfsX1I3MMJHA7NScQvs5fwYQ5; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-25 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:41 -0600 Subject: [PATCH 20/30] Use read_var_value overload in return_command MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-20-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-25 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 21 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPGp+7Rrbkk8IDK4N8rdjfU9rnwUs6qHxC0gzKJNvckBChI5Ods3PAxuy00HIsLb5YN96XHdlnUK3Rx801mjjj4zDu23krSP1Bm3VFH9xlIPzhQJTTNx yU0AsnRI4e7yN0lLASEiU7yYcV4mmiV+NDSvmajfDAulVxtU1UmoUi6xhA3k7+0GrXjRHJq89HQt/Ngggv/5Wr0CyYohgfnM1fc= 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_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.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 This changes return_command to use the new read_var_value overload. --- gdb/stack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/stack.c b/gdb/stack.c index 52448ff98a5..0fba09a044c 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2699,7 +2699,8 @@ return_command (const char *retval_exp, int from_tty) std::string query_prefix; thisframe = get_selected_frame ("No selected frame."); - thisfun = get_frame_function (thisframe).symbol; + block_symbol b_fun = get_frame_function (thisframe); + thisfun = b_fun.symbol; gdbarch = get_frame_arch (thisframe); if (get_frame_type (get_current_frame ()) == INLINE_FRAME) @@ -2740,7 +2741,7 @@ return_command (const char *retval_exp, int from_tty) return_value->fetch_lazy (); if (thisfun != NULL) - function = read_var_value (thisfun, NULL, thisframe); + function = read_var_value (b_fun, thisframe); rv_conv = RETURN_VALUE_REGISTER_CONVENTION; if (return_type->code () == TYPE_CODE_VOID) From patchwork Sun Oct 29 23:23:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78709 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 CD3BD387542C for ; Sun, 29 Oct 2023 23:24:24 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta040.useast.a.cloudfilter.net (omta040.useast.a.cloudfilter.net [44.202.169.39]) by sourceware.org (Postfix) with ESMTPS id 55674386192C for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55674386192C 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 55674386192C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621794; cv=none; b=tRDibFMSc/mpm/cdOEIaEwNfSxGaNhhhdsjn8ZLqiXK9KXrzgGuii6F/eQ/l+8pWU4OLvLsM0WBn41WIfiTnU52JDwAWNsswWaTe0iN3xSp7YDQwBMvQR8tN+o/4Rdihma2ujZHzUpqP5wy2vRgoSHLtJS0Bh6Syn9WM6I5qQYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621794; c=relaxed/simple; bh=7hZ/4ugcP1f6wBDb6LgX+/mrKNm8hSBwx+QkllCyqiA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=o0fl1zdVdd/achgv5Hg4UQ5KQEZ88fdaSrl39y83T3YNDyiOaFffO6EFIp9Hgz5NZTfx5EdVNPMrHNroemwSLq1rxok7CrBub+uCqPfr/ygQkq4j5LvduBxS5KSh5p9wnxSRAX23Aoy4c8MyfiIEztj1tpkD/Yj6sQ8jThKT+hI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id xElJqBCkF6nOZxF7eqwrfH; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7cqTxz2wuSExF7dqv3P7; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=evvMc6lX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=sVPs-MVso7Ic29TWYLEA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=TrV6ktD6lv/+/OUCZFelICN/Sn4BUdivdJUW4mdjy/8=; b=fgNTqbKEY7AeN6ymA+4caOm3WG ArSKma6RE9os6TgN0PuI4LzKGGRNBljh5M9TaQANuaudUFZJ7Nipqgyyb9Px74+h9Xpu4eHAvZGCy TS2ezIsErWeKR6NstY4LFJbJb; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-2W for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:42 -0600 Subject: [PATCH 21/30] Use read_var_value overload in py-finishbreakpoint.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-21-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-2W X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 22 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDXHShLiGJFiyLxnrDvmlZeozWHZINvW9MJ98VJyzMO6S1Vtr2/pnLG5AH7OT0/GIk0Qx3KyB6yS+ni0Ajns2075uoeIeuPKIzYxqocIi5EuRrZAMpip L/2gqucwHpwc+mE4Nam0yCalsLEDSp0AcYoh2x3CtmyUjngV7hWiFIQ4E5Icm1IC1s6bLaRPZC97xIguzSq+/kCXXqjHlqqM2lc= 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_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.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 This chanseg py-finishbreakpoint.c to use the new read_var_value overload. --- gdb/python/py-finishbreakpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 04fc8c9e8a7..53ba41bd157 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -252,7 +252,8 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) { if (get_frame_pc_if_available (frame, &pc)) { - struct symbol *function = find_pc_function (pc).symbol; + block_symbol b_fun = find_pc_function (pc); + symbol *function = b_fun.symbol; if (function != nullptr) { struct type *ret_type = @@ -264,7 +265,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) scoped_value_mark free_values; /* Ignore Python errors at this stage. */ - value *func_value = read_var_value (function, NULL, frame); + value *func_value = read_var_value (b_fun, frame); self_bpfinish->function_value = value_to_value_object (func_value); PyErr_Clear (); From patchwork Sun Oct 29 23:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78719 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 406C838323E6 for ; Sun, 29 Oct 2023 23:25:05 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id C5FD5386193C for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5FD5386193C 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 C5FD5386193C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; cv=none; b=puw6GQF0i68T8POwPzwaBbRZVB2rN/dH6sdYzuwLZ4gKAosfPBfddSsr/F1jiHzEr7LyRShoEK+3y96qOqBYIerQEo/qkStRqYxLeqD2aufRI0oklNEuGhIEZfMMXonIT76tvDMs90MYrvmDVd3riQC5Tm+Fw1bk006RVVaeE1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621797; c=relaxed/simple; bh=oK5wjt6011Fry+maRtnGYLCCF70nlmXngDeW8br1QZc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=gvqabkLP2MCYMvOMHYYaN0/iJds1E8JMpPLFL4V8x7BLfjdndvu16oj/WaBcq0YqNe1xKApe+9RhHTOTLWtKL9eA/c+4IXPwS/e5gUl9p3j4YuRZkq8l6TIJbKaw8JbPniwQfwh4vGFd8gKqKvGgjVuNwDe3bxySNtyN3vk8cZg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5006a.ext.cloudfilter.net ([10.0.29.179]) by cmsmtp with ESMTPS id wxu9qPoOVKOkLxF7dqQEPk; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dq9c50ULW5xF7dqS5hC; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=Yusc+qUX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=fAIwGuswDSaqnPqpljcA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=/QDZjME9B2Q69knRWj3WbT403HmAZc3pAtTWeJ80r1Q=; b=jhezerGsRqZyMnVp+LejC0pHnU 23HtMogdj3ww91aKzReAfC2/qUAtd0cOB0wl0HyacF1YMjAs21Z1H1WMxHCue698k149e0Oy1xYdn RP2ohWZdiZmI06XIKEhbQUIJm; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7c-0042zY-2v for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:08 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:43 -0600 Subject: [PATCH 22/30] Use read_var_value overload in py-framefilter.c MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-22-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7c-0042zY-2v X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 23 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfJyoyZ9vJXvcJWkuQ3Gj09kgxHigO0dtKJcFrbCIe/TZab4uj9+d1Bki2b62IYUk/WmVF+M9ccv2YGI+nZR/B8i2MiduOvaIXV2fS8rtm1hl/LD2wmPv WOiImzlgUAtULBShrsm5/gkeVto4XZ9m5vSMP0MVG/YMpk5pof2uK1kEjSxTrwYaBqFDKThuR39pCNvUTpIhT76fsOFJn3vhD7I= X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, 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 This changes py-framefilter.c to use the new read_var_value overload. --- gdb/python/py-framefilter.c | 54 ++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index e555dc3d879..07b30a587b1 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -41,24 +41,22 @@ enum mi_print_types MI_PRINT_LOCALS }; -/* Helper function to extract a symbol, a name and a language +/* Helper function to extract a symbol, a name and a language definition from a Python object that conforms to the "Symbol Value" - interface. OBJ is the Python object to extract the values from. - NAME is a pass-through argument where the name of the symbol will - be written. NAME is allocated in this function, but the caller is + interface. OBJ is the Python object to extract the values from. + NAME is a pass-through argument where the name of the symbol will + be written. NAME is allocated in this function, but the caller is responsible for clean up. SYM is a pass-through argument where the - symbol will be written and SYM_BLOCK is a pass-through argument to - write the block where the symbol lies in. In the case of the API - returning a string, this will be set to NULL. LANGUAGE is also a - pass-through argument denoting the language attributed to the - Symbol. In the case of SYM being NULL, this will be set to the - current language. Returns EXT_LANG_BT_ERROR on error with the - appropriate Python exception set, and EXT_LANG_BT_OK on success. */ + symbol will be written. In the case of the API returning a string, + this will be set to NULL. LANGUAGE is also a pass-through argument + denoting the language attributed to the Symbol. In the case of SYM + being NULL, this will be set to the current language. Returns + EXT_LANG_BT_ERROR on error with the appropriate Python exception + set, and EXT_LANG_BT_OK on success. */ static enum ext_lang_bt_status extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, - struct symbol **sym, const struct block **sym_block, - const struct language_defn **language) + block_symbol *sym, const struct language_defn **language) { gdbpy_ref<> result (PyObject_CallMethod (obj, "symbol", NULL)); @@ -79,21 +77,19 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, entirely synthetic symbol/value pairing. In that case, use the current language. */ *language = current_language; - *sym = NULL; - *sym_block = NULL; + *sym = {}; } else { /* This type checks 'result' during the conversion so we just call it unconditionally and check the return. */ - *sym = symbol_object_to_symbol (result.get ()); /* TODO: currently, we have no way to recover the block in which SYMBOL was found, so we have no block to return. Trying to evaluate SYMBOL will yield an incorrect value when it's located in a FRAME and evaluated from another frame (as permitted in nested functions). */ - *sym_block = NULL; + *sym = { symbol_object_to_symbol (result.get ()), nullptr }; - if (*sym == NULL) + if (sym->symbol == NULL) { PyErr_SetString (PyExc_RuntimeError, _("Unexpected value. Expecting a " @@ -103,13 +99,13 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, /* Duplicate the symbol name, so the caller has consistency in garbage collection. */ - name->reset (xstrdup ((*sym)->print_name ())); + name->reset (xstrdup (sym->symbol->print_name ())); /* If a symbol is specified attempt to determine the language from the symbol. If mode is not "auto", then the language has been explicitly set, use that. */ if (language_mode == language_mode_auto) - *language = language_def ((*sym)->language ()); + *language = language_def (sym->symbol->language ()); else *language = current_language; } @@ -443,21 +439,20 @@ enumerate_args (PyObject *iter, { const struct language_defn *language; gdb::unique_xmalloc_ptr sym_name; - struct symbol *sym; - const struct block *sym_block; + block_symbol bsym; struct value *val; enum ext_lang_bt_status success = EXT_LANG_BT_ERROR; - success = extract_sym (item.get (), &sym_name, &sym, &sym_block, - &language); + success = extract_sym (item.get (), &sym_name, &bsym, &language); if (success == EXT_LANG_BT_ERROR) return EXT_LANG_BT_ERROR; + symbol *sym = bsym.symbol; success = extract_value (item.get (), &val); if (success == EXT_LANG_BT_ERROR) return EXT_LANG_BT_ERROR; - if (sym && out->is_mi_like_p () + if (sym != nullptr && out->is_mi_like_p () && ! mi_should_print (sym, MI_PRINT_ARGS)) continue; @@ -559,8 +554,6 @@ enumerate_locals (PyObject *iter, gdb::unique_xmalloc_ptr sym_name; struct value *val; enum ext_lang_bt_status success = EXT_LANG_BT_ERROR; - struct symbol *sym; - const struct block *sym_block; int local_indent = 8 + (8 * indent); gdb::optional tuple; @@ -568,10 +561,11 @@ enumerate_locals (PyObject *iter, if (item == NULL) break; - success = extract_sym (item.get (), &sym_name, &sym, &sym_block, - &language); + block_symbol bsym; + success = extract_sym (item.get (), &sym_name, &bsym, &language); if (success == EXT_LANG_BT_ERROR) return EXT_LANG_BT_ERROR; + symbol *sym = bsym.symbol; success = extract_value (item.get (), &val); if (success == EXT_LANG_BT_ERROR) @@ -583,7 +577,7 @@ enumerate_locals (PyObject *iter, /* If the object did not provide a value, read it. */ if (val == NULL) - val = read_var_value (sym, sym_block, frame); + val = read_var_value (bsym, frame); /* With PRINT_NO_VALUES, MI does not emit a tuple normally as each output contains only one field. The exception is From patchwork Sun Oct 29 23:23:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78721 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 F2BB73831E0B for ; Sun, 29 Oct 2023 23:25:18 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id ED9BB386193E for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ED9BB386193E 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 ED9BB386193E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621799; cv=none; b=wdNzEe6LSF+uWrAMfAzDi589LdtviSU5xzEh+2b0L6FI1TXWbQUo7kKaOob+1wKczeEU+nhI7dTfgFakViU54G8K564DipoabEOwuTsDdW/PrlbOGXZehZ06iSc9PWQg8t5TolJ6SGwfGNtlcJjwBzl4ZZslNlapeBCNnt4Hyxc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621799; c=relaxed/simple; bh=6AeLPtcnSkRylJqPVYinQRiFf6nS5D1sNhOurjzjth8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=nZ3p6/vAbXH2x6zXoFQVKKQK2OJAjgIRKI1pNN+AITFqu0XLw1e/utuWdqO7X5gAA9tNiPtTYPFTs73vAMh1r4t1lG8AsnDyzx9U2gS1GOmpPAmzx5MSqkv8zdPkofrxhUY+jCqac6qfAQdptnJWTtkIK0YIUN9GlUWjA0RS3OI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5006a.ext.cloudfilter.net ([10.0.29.179]) by cmsmtp with ESMTPS id wv5vqrgFQL9AgxF7dqdPrP; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dq9c59ULW5xF7dqS5hM; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=Yusc+qUX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=GHsAFHNieQwiKhYbefIA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=8mFwO+WaSa20YyvLiYG4GBItKcGM/sfAOa6M20Zm4mk=; b=bxVykPSkV7cfEh/+TfZIF+LbOW H18x+XlWkG1z0AhetpWzARN3uO4BN3Bbh6/eLibJerb3NK7iqCDCqS4nhZNZykuAGgkx1L51W2KyT 8xe78H/K/vIGPJn2xcZvIxE8n; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-08 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:44 -0600 Subject: [PATCH 23/30] Use read_var_value overload in Guile MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-23-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-08 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 24 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfJyoyZ9vJXvcJWkuQ3Gj09kgxHigO0dtKJcFrbCIe/TZab4uj9+d1Bki2b62IYUk/WmVF+M9ccv2YGI+nZR/B8i2MiduOvaIXV2fS8rtm1hl/LD2wmPv WOiImzlgUAtULBShrsm5/gkeVto4XZ9m5vSMP0MVG/YMpk5pof2uK1kEjSxTrwYaBqFDKThuR39pCNvUTpIhT76fsOFJn3vhD7I= X-Spam-Status: No, score=-3024.6 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 This changes the Guile layer to store a block_symbol in its symbol wrapper, and then to use the new read_var_value overload. --- gdb/guile/guile-internal.h | 2 +- gdb/guile/scm-block.c | 6 ++-- gdb/guile/scm-frame.c | 9 +++--- gdb/guile/scm-symbol.c | 78 ++++++++++++++++++++++------------------------ 4 files changed, 46 insertions(+), 49 deletions(-) diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h index c0f1410ed7c..e8b59c160cc 100644 --- a/gdb/guile/guile-internal.h +++ b/gdb/guile/guile-internal.h @@ -538,7 +538,7 @@ extern SCM gdbscm_scm_from_host_string (const char *string, size_t len); extern int syscm_is_symbol (SCM scm); -extern SCM syscm_scm_from_symbol (struct symbol *symbol); +extern SCM syscm_scm_from_symbol (block_symbol symbol); extern struct symbol *syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos, const char *func_name); diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index 02b7a48be37..4293a13b81b 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -406,7 +406,7 @@ gdbscm_block_function (SCM self) sym = block->function (); if (sym != NULL) - return syscm_scm_from_symbol (sym); + return syscm_scm_from_symbol ({ sym, block }); return SCM_BOOL_F; } @@ -507,7 +507,7 @@ gdbscm_block_symbols (SCM self) for (struct symbol *sym : block_iterator_range (block)) { - SCM s_scm = syscm_scm_from_symbol (sym); + SCM s_scm = syscm_scm_from_symbol ({ sym, block }); result = scm_cons (s_scm, result); } @@ -658,7 +658,7 @@ gdbscm_block_next_symbol_x (SCM self) if (sym == NULL) return gdbscm_end_of_iteration (); - return syscm_scm_from_symbol (sym); + return syscm_scm_from_symbol ({ sym, block }); } /* (lookup-block address) -> diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c index 74012ffea4f..62a28a39bcf 100644 --- a/gdb/guile/scm-frame.c +++ b/gdb/guile/scm-frame.c @@ -654,7 +654,7 @@ static SCM gdbscm_frame_function (SCM self) { frame_smob *f_smob; - struct symbol *sym = NULL; + block_symbol sym = {}; bool found = false; f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); @@ -666,7 +666,7 @@ gdbscm_frame_function (SCM self) if (frame != NULL) { found = true; - sym = find_pc_function (get_frame_address_in_block (frame)).symbol; + sym = find_pc_function (get_frame_address_in_block (frame)); } } catch (const gdb_exception &except) @@ -681,7 +681,7 @@ gdbscm_frame_function (SCM self) _("")); } - if (sym != NULL) + if (sym.symbol != nullptr) return syscm_scm_from_symbol (sym); return SCM_BOOL_F; @@ -962,7 +962,8 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest) try { - value = read_var_value (var, block, frame_info_ptr (frame)); + // FIXME + value = read_var_value ({ var, block }, frame_info_ptr (frame)); } catch (const gdb_exception &except) { diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c index 1619705f065..f7fc3123dcd 100644 --- a/gdb/guile/scm-symbol.c +++ b/gdb/guile/scm-symbol.c @@ -36,7 +36,7 @@ struct symbol_smob eqable_gdb_smob base; /* The GDB symbol structure this smob is wrapping. */ - struct symbol *symbol; + block_symbol symbol; }; static const char symbol_smob_name[] = "gdb:symbol"; @@ -64,7 +64,7 @@ struct syscm_deleter { symbol_smob *s_smob = (symbol_smob *) *slot; - s_smob->symbol = NULL; + s_smob->symbol = {}; return 1; } @@ -96,7 +96,7 @@ syscm_hash_symbol_smob (const void *p) { const symbol_smob *s_smob = (const symbol_smob *) p; - return htab_hash_pointer (s_smob->symbol); + return htab_hash_pointer (s_smob->symbol.symbol); } /* Helper function to compute equality of symbol_smobs. */ @@ -107,8 +107,8 @@ syscm_eq_symbol_smob (const void *ap, const void *bp) const symbol_smob *a = (const symbol_smob *) ap; const symbol_smob *b = (const symbol_smob *) bp; - return (a->symbol == b->symbol - && a->symbol != NULL); + return (a->symbol.symbol == b->symbol.symbol + && a->symbol.symbol != nullptr); } /* Return the struct symbol pointer -> SCM mapping table. @@ -156,15 +156,15 @@ syscm_free_symbol_smob (SCM self) { symbol_smob *s_smob = (symbol_smob *) SCM_SMOB_DATA (self); - if (s_smob->symbol != NULL) + if (s_smob->symbol.symbol != nullptr) { - htab_t htab = syscm_get_symbol_map (s_smob->symbol); + htab_t htab = syscm_get_symbol_map (s_smob->symbol.symbol); gdbscm_clear_eqable_gsmob_ptr_slot (htab, &s_smob->base); } /* Not necessary, done to catch bugs. */ - s_smob->symbol = NULL; + s_smob->symbol = {}; return 0; } @@ -179,8 +179,8 @@ syscm_print_symbol_smob (SCM self, SCM port, scm_print_state *pstate) if (pstate->writingp) gdbscm_printf (port, "#<%s ", symbol_smob_name); gdbscm_printf (port, "%s", - s_smob->symbol != NULL - ? s_smob->symbol->print_name () + s_smob->symbol.symbol != nullptr + ? s_smob->symbol.symbol->print_name () : ""); if (pstate->writingp) scm_puts (">", port); @@ -200,7 +200,7 @@ syscm_make_symbol_smob (void) scm_gc_malloc (sizeof (symbol_smob), symbol_smob_name); SCM s_scm; - s_smob->symbol = NULL; + s_smob->symbol.symbol = {}; s_scm = scm_new_smob (symbol_smob_tag, (scm_t_bits) s_smob); gdbscm_init_eqable_gsmob (&s_smob->base, s_scm); @@ -227,7 +227,7 @@ gdbscm_symbol_p (SCM scm) object. */ SCM -syscm_scm_from_symbol (struct symbol *symbol) +syscm_scm_from_symbol (block_symbol symbol) { htab_t htab; eqable_gdb_smob **slot; @@ -236,7 +236,7 @@ syscm_scm_from_symbol (struct symbol *symbol) /* If we've already created a gsmob for this symbol, return it. This makes symbols eq?-able. */ - htab = syscm_get_symbol_map (symbol); + htab = syscm_get_symbol_map (symbol.symbol); s_smob_for_lookup.symbol = symbol; slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &s_smob_for_lookup.base); if (*slot != NULL) @@ -279,7 +279,7 @@ syscm_get_symbol_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name) static int syscm_is_valid (symbol_smob *s_smob) { - return s_smob->symbol != NULL; + return s_smob->symbol.symbol != nullptr; } /* Throw a Scheme error if SELF is not a valid symbol smob. @@ -311,7 +311,7 @@ syscm_get_valid_symbol_arg_unsafe (SCM self, int arg_pos, symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, arg_pos, func_name); - return s_smob->symbol; + return s_smob->symbol.symbol; } @@ -337,7 +337,7 @@ gdbscm_symbol_type (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; if (symbol->type () == NULL) return SCM_BOOL_F; @@ -354,7 +354,7 @@ gdbscm_symbol_symtab (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; if (!symbol->is_objfile_owned ()) return SCM_BOOL_F; @@ -368,7 +368,7 @@ gdbscm_symbol_name (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return gdbscm_scm_from_c_string (symbol->natural_name ()); } @@ -380,7 +380,7 @@ gdbscm_symbol_linkage_name (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return gdbscm_scm_from_c_string (symbol->linkage_name ()); } @@ -392,7 +392,7 @@ gdbscm_symbol_print_name (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return gdbscm_scm_from_c_string (symbol->print_name ()); } @@ -404,7 +404,7 @@ gdbscm_symbol_addr_class (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return scm_from_int (symbol->aclass ()); } @@ -416,7 +416,7 @@ gdbscm_symbol_argument_p (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return scm_from_bool (symbol->is_argument ()); } @@ -428,7 +428,7 @@ gdbscm_symbol_constant_p (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; enum address_class theclass; theclass = symbol->aclass (); @@ -443,7 +443,7 @@ gdbscm_symbol_function_p (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; enum address_class theclass; theclass = symbol->aclass (); @@ -458,7 +458,7 @@ gdbscm_symbol_variable_p (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; enum address_class theclass; theclass = symbol->aclass (); @@ -477,7 +477,7 @@ gdbscm_symbol_needs_frame_p (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - struct symbol *symbol = s_smob->symbol; + struct symbol *symbol = s_smob->symbol.symbol; int result = 0; gdbscm_gdb_exception exc {}; @@ -502,7 +502,7 @@ gdbscm_symbol_line (SCM self) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - const struct symbol *symbol = s_smob->symbol; + const struct symbol *symbol = s_smob->symbol.symbol; return scm_from_int (symbol->line ()); } @@ -515,7 +515,7 @@ gdbscm_symbol_value (SCM self, SCM rest) { symbol_smob *s_smob = syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); - struct symbol *symbol = s_smob->symbol; + block_symbol symbol = s_smob->symbol; SCM keywords[] = { frame_keyword, SCM_BOOL_F }; int frame_pos = -1; SCM frame_scm = SCM_BOOL_F; @@ -527,7 +527,7 @@ gdbscm_symbol_value (SCM self, SCM rest) if (!gdbscm_is_false (frame_scm)) f_smob = frscm_get_frame_smob_arg_unsafe (frame_scm, frame_pos, FUNC_NAME); - if (symbol->aclass () == LOC_TYPEDEF) + if (symbol.symbol->aclass () == LOC_TYPEDEF) { gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, _("cannot get the value of a typedef")); @@ -545,14 +545,10 @@ gdbscm_symbol_value (SCM self, SCM rest) error (_("Invalid frame")); } - if (symbol_read_needs_frame (symbol) && frame_info == NULL) + if (symbol_read_needs_frame (symbol.symbol) && frame_info == nullptr) error (_("Symbol requires a frame to compute its value")); - /* TODO: currently, we have no way to recover the block in which SYMBOL - was found, so we have no block to pass to read_var_value. This will - yield an incorrect value when symbol is not local to FRAME_INFO (this - can happen with nested functions). */ - value = read_var_value (symbol, NULL, frame_info); + value = read_var_value (symbol, frame_info); } catch (const gdb_exception &except) { @@ -578,7 +574,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) int domain = VAR_DOMAIN; int block_arg_pos = -1, domain_arg_pos = -1; struct field_of_this_result is_a_field_of_this; - struct symbol *symbol = NULL; + block_symbol symbol = {}; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi", name_scm, &name, rest, @@ -618,7 +614,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) try { symbol = lookup_symbol (name, block, (domain_enum) domain, - &is_a_field_of_this).symbol; + &is_a_field_of_this); } catch (const gdb_exception &ex) { @@ -628,7 +624,7 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest) xfree (name); GDBSCM_HANDLE_GDB_EXCEPTION (except); - if (symbol == NULL) + if (symbol.symbol == nullptr) return SCM_BOOL_F; return scm_list_2 (syscm_scm_from_symbol (symbol), @@ -645,7 +641,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) SCM keywords[] = { domain_keyword, SCM_BOOL_F }; int domain_arg_pos = -1; int domain = VAR_DOMAIN; - struct symbol *symbol = NULL; + block_symbol symbol = {}; gdbscm_gdb_exception except {}; gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i", @@ -654,7 +650,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) try { - symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol; + symbol = lookup_global_symbol (name, NULL, (domain_enum) domain); } catch (const gdb_exception &ex) { @@ -664,7 +660,7 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest) xfree (name); GDBSCM_HANDLE_GDB_EXCEPTION (except); - if (symbol == NULL) + if (symbol.symbol == nullptr) return SCM_BOOL_F; return syscm_scm_from_symbol (symbol); From patchwork Sun Oct 29 23:23:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78722 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 01E0E3830B59 for ; Sun, 29 Oct 2023 23:25:19 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 0A176386193F for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A176386193F 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 0A176386193F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621798; cv=none; b=Wfx8jvPPNNQv1l+OSSqwx0pIAFAOgnk7XP6ruFslLv1jV1X/ngUVreSbinSXLKO3hZ0ZgqKOW74Tbt1+2Jrx/BAHwLhrDtMKdXhPxR+XcWYMayeBLJhCNHURyDrjq7sIdn/ciNQUaL/T6s4fQ17R+wLtj8fYhvIgZ7h8WqE4+q8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621798; c=relaxed/simple; bh=OUTW8NcA9LUGjV22YK1+P9uK1kVNcE+Pi4RS1EV3Nlk=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=l6r5fqezliay0HDVml7bZ3zQhZQ0KAcTOp8XeEQqAzX94v1DaMnieSYLD8OLdFrQZx1wOZ7uWscGIiiVf8dfxx1iQPQd67mYtPI4wBzUcvtcYE9fEQBvuEJeUvmAF8SWtubIdA6ed4ncL9EzjXUU6q9j6Vi4hpZnpPXUGBzFhdo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6007a.ext.cloudfilter.net ([10.0.30.247]) by cmsmtp with ESMTPS id xDPSqtqDxL9AgxF7eqdPrR; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqwSLU5ZLUxF7dqXiQ3; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=S57KfagP c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=DxUNwVNMKNhtkHIqcQsA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=/rEDYZqpntBVnm+2uxeBi+/vOM4/rlNOaPUeuYCL5DI=; b=x9eNjT7uh61giD1NW7I52NqZQg c0jvbNqeE9xzG4YzSH8kpcft9ymn7Viwzo0ZorIzvIPClXbC1yNteKtPs3JoxqAOFBmH5++ZRSNfC oOHHCAiz62Ps+5041ufxI1gMl; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-0d for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:45 -0600 Subject: [PATCH 24/30] Use read_var_value in read_frame_arg and read_frame_local MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-24-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-0d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 25 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfI2qQum9HYYvAwWnv4BVlvS8GX1cqRV8sdonQ1UNEsj0LyR+WzNdt2WoFYhdoYQfCYJgAnAT704akavzFIihtiSDZJeGBs7+CXG1leF83+xUljILGMtZ bXzvH4cNCd0veuxcYwwMQFZTPps+DIBSmCy4SYt+GmQ21lL2Tjjbhbrh0btGQqs17ypjLi+Av5k/0+JEYN8+qg0tWEIBS7F7p6U= X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, 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 This changes read_frame_arg and read_frame_local to take a block_symbol and to use the new read_var_value overload.k --- gdb/frame.h | 6 +++--- gdb/mi/mi-cmd-stack.c | 20 ++++++++++---------- gdb/python/py-framefilter.c | 8 ++++---- gdb/stack.c | 27 ++++++++++++++------------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/gdb/frame.h b/gdb/frame.h index 0f1640c4a68..7c664c7cea8 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -931,7 +931,7 @@ extern frame_print_options user_frame_print_options; struct frame_arg { /* Symbol for this parameter used for example for its name. */ - struct symbol *sym = nullptr; + block_symbol sym = {}; /* Value of the parameter. It is NULL if ERROR is not NULL; if both VAL and ERROR are NULL this parameter's value should not be printed. */ @@ -954,10 +954,10 @@ struct frame_arg }; extern void read_frame_arg (const frame_print_options &fp_opts, - symbol *sym, frame_info_ptr frame, + block_symbol sym, frame_info_ptr frame, struct frame_arg *argp, struct frame_arg *entryargp); -extern void read_frame_local (struct symbol *sym, frame_info_ptr frame, +extern void read_frame_local (block_symbol sym, frame_info_ptr frame, struct frame_arg *argp); extern void info_args_command (const char *, int); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index e473be7d465..9a53bac92e7 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -521,18 +521,18 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, string_file stb; - stb.puts (arg->sym->print_name ()); + stb.puts (arg->sym.symbol->print_name ()); if (arg->entry_kind == print_entry_values_only) stb.puts ("@entry"); uiout->field_stream ("name", stb); - if (what == all && arg->sym->is_argument ()) + if (what == all && arg->sym.symbol->is_argument ()) uiout->field_signed ("arg", 1); if (values == PRINT_SIMPLE_VALUES) { - check_typedef (arg->sym->type ()); - type_print (arg->sym->type (), "", &stb, -1); + check_typedef (arg->sym.symbol->type ()); + type_print (arg->sym.symbol->type (), "", &stb, -1); uiout->field_stream ("type", stb); } @@ -549,7 +549,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, get_no_prettyformat_print_options (&opts); opts.deref_ref = true; common_val_print (arg->val, &stb, 0, &opts, - language_def (arg->sym->language ())); + language_def (arg->sym.symbol->language ())); } catch (const gdb_exception_error &except) { @@ -632,15 +632,15 @@ list_args_or_locals (const frame_print_options &fp_opts, } if (print_me) { - struct symbol *sym2; + block_symbol sym2; struct frame_arg arg, entryarg; if (sym->is_argument ()) sym2 = lookup_symbol_search_name (sym->search_name (), - block, VAR_DOMAIN).symbol; + block, VAR_DOMAIN); else - sym2 = sym; - gdb_assert (sym2 != NULL); + sym2 = { sym, block }; + gdb_assert (sym2.symbol != nullptr); arg.sym = sym2; arg.entry_kind = print_entry_values_no; @@ -650,7 +650,7 @@ list_args_or_locals (const frame_print_options &fp_opts, switch (values) { case PRINT_SIMPLE_VALUES: - if (!mi_simple_type_p (sym2->type ())) + if (!mi_simple_type_p (sym2.symbol->type ())) break; /* FALLTHROUGH */ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index 07b30a587b1..b214e82628f 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -312,7 +312,7 @@ py_print_single_arg (struct ui_out *out, { if (fa->val == NULL && fa->error == NULL) return; - language = language_def (fa->sym->language ()); + language = language_def (fa->sym.symbol->language ()); val = fa->val; } else @@ -340,12 +340,12 @@ py_print_single_arg (struct ui_out *out, { string_file stb; - gdb_puts (fa->sym->print_name (), &stb); + gdb_puts (fa->sym.symbol->print_name (), &stb); if (fa->entry_kind == print_entry_values_compact) { stb.puts ("="); - gdb_puts (fa->sym->print_name (), &stb); + gdb_puts (fa->sym.symbol->print_name (), &stb); } if (fa->entry_kind == print_entry_values_only || fa->entry_kind == print_entry_values_compact) @@ -472,7 +472,7 @@ enumerate_args (PyObject *iter, } read_frame_arg (user_frame_print_options, - sym, frame, &arg, &entryarg); + bsym, frame, &arg, &entryarg); /* The object has not provided a value, so this is a frame argument to be read by GDB. In this case we have to diff --git a/gdb/stack.c b/gdb/stack.c index 0fba09a044c..0bf2b19fad7 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -428,14 +428,14 @@ print_frame_arg (const frame_print_options &fp_opts, annotate_arg_emitter arg_emitter; ui_out_emit_tuple tuple_emitter (uiout, NULL); - gdb_puts (arg->sym->print_name (), &stb); + gdb_puts (arg->sym.symbol->print_name (), &stb); if (arg->entry_kind == print_entry_values_compact) { /* It is OK to provide invalid MI-like stream as with PRINT_ENTRY_VALUE_COMPACT we never use MI. */ stb.puts ("="); - gdb_puts (arg->sym->print_name (), &stb); + gdb_puts (arg->sym.symbol->print_name (), &stb); } if (arg->entry_kind == print_entry_values_only || arg->entry_kind == print_entry_values_compact) @@ -472,7 +472,7 @@ print_frame_arg (const frame_print_options &fp_opts, /* Use the appropriate language to display our symbol, unless the user forced the language to a specific language. */ if (language_mode == language_mode_auto) - language = language_def (arg->sym->language ()); + language = language_def (arg->sym.symbol->language ()); else language = current_language; @@ -503,7 +503,7 @@ print_frame_arg (const frame_print_options &fp_opts, exception. */ void -read_frame_local (struct symbol *sym, frame_info_ptr frame, +read_frame_local (block_symbol sym, frame_info_ptr frame, struct frame_arg *argp) { argp->sym = sym; @@ -512,7 +512,7 @@ read_frame_local (struct symbol *sym, frame_info_ptr frame, try { - argp->val = read_var_value (sym, NULL, frame); + argp->val = read_var_value (sym, frame); } catch (const gdb_exception_error &except) { @@ -525,7 +525,7 @@ read_frame_local (struct symbol *sym, frame_info_ptr frame, void read_frame_arg (const frame_print_options &fp_opts, - symbol *sym, frame_info_ptr frame, + block_symbol bsym, frame_info_ptr frame, struct frame_arg *argp, struct frame_arg *entryargp) { struct value *val = NULL, *entryval = NULL; @@ -537,7 +537,7 @@ read_frame_arg (const frame_print_options &fp_opts, { try { - val = read_var_value (sym, NULL, frame); + val = read_var_value (bsym, frame); } catch (const gdb_exception_error &except) { @@ -546,6 +546,7 @@ read_frame_arg (const frame_print_options &fp_opts, } } + symbol *sym = bsym.symbol; if (SYMBOL_COMPUTED_OPS (sym) != NULL && SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry != NULL && fp_opts.print_entry_values != print_entry_values_no @@ -661,7 +662,7 @@ read_frame_arg (const frame_print_options &fp_opts, try { - val = read_var_value (sym, NULL, frame); + val = read_var_value (bsym, frame); } catch (const gdb_exception_error &except) { @@ -687,7 +688,7 @@ read_frame_arg (const frame_print_options &fp_opts, val_error = NULL; } - argp->sym = sym; + argp->sym = bsym; argp->val = val; argp->error.reset (val_error ? xstrdup (val_error) : NULL); if (!val && !val_error) @@ -702,7 +703,7 @@ read_frame_arg (const frame_print_options &fp_opts, else argp->entry_kind = print_entry_values_no; - entryargp->sym = sym; + entryargp->sym = bsym; entryargp->val = entryval; entryargp->error.reset (entryval_error ? xstrdup (entryval_error) : NULL); if (!entryval && !entryval_error) @@ -871,13 +872,13 @@ print_frame_args (const frame_print_options &fp_opts, if (!print_args) { - arg.sym = sym; + arg.sym = { sym, b }; arg.entry_kind = print_entry_values_no; - entryarg.sym = sym; + entryarg.sym = { sym, b }; entryarg.entry_kind = print_entry_values_no; } else - read_frame_arg (fp_opts, sym, frame, &arg, &entryarg); + read_frame_arg (fp_opts, { sym, b }, frame, &arg, &entryarg); if (arg.entry_kind != print_entry_values_only) print_frame_arg (fp_opts, &arg); From patchwork Sun Oct 29 23:23:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78720 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 A548B3831E17 for ; Sun, 29 Oct 2023 23:25:13 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id A6A793861939 for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6A793861939 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 A6A793861939 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621796; cv=none; b=Y7Dfa2uOYU27rmd9zfZMsov0AICgj2IXic5YZJEnkZerHW+Rn6QWf1VpXJlg5W3UJNJgXPdRkn228DlUu9zNXU/Imyby+im7+mCnlyWIWFIVlkUernrquSF8RBZcBOlyCKS7XyJL+rzvgJosHTOAM//rSb+T4gmUoFm6hjEPL24= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621796; c=relaxed/simple; bh=fgRlSGMoFif+Dy6EvRNrC//EBEBX1Hz/UGvEgw2+PVs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=tPRQriguIm8rUoHdx5WpWjbSVjuJM5YmGQpe7ysP3d/aB5dqz+TbGFiXvamdS5YezAtHjjQ9mxWnVZBp/uaKfnKkY+35/meUBTzlhUm/Bs/3WDvdIUwhH3Iu/BGpEIVSPpSJPbKldjD79qNzvOGaSVcWEHr9447ci/mUq2bETTI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id wroiqbpIAjtZ3xF7fqTyKW; Sun, 29 Oct 2023 23:23:11 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqTxzQwuSExF7dqv3PT; Sun, 29 Oct 2023 23:23:09 +0000 X-Authority-Analysis: v=2.4 cv=evvMc6lX c=1 sm=1 tr=0 ts=653ee95d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=BRfREQrth9rV_OVTpJIA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=fHu9pL51716CVDQb9t5nMeB96JbkBwhUbrMV2e7wxA0=; b=etDA2+Ylkor4EcpTGLm3PvOhGZ Uw9hVb0Ub4cM/YsCrP6MCS5IBLyhPu1q/NItjgI7xKyPifN4bGdhLzkcy96RG6JspHP7EVQIHm3S6 FoVIHwL70p+KySw5M3VautgwT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-14 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:46 -0600 Subject: [PATCH 25/30] Change print_variable_and_value to take a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-25-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-14 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 26 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDXHShLiGJFiyLxnrDvmlZeozWHZINvW9MJ98VJyzMO6S1Vtr2/pnLG5AH7OT0/GIk0Qx3KyB6yS+ni0Ajns2075uoeIeuPKIzYxqocIi5EuRrZAMpip L/2gqucwHpwc+mE4Nam0yCalsLEDSp0AcYoh2x3CtmyUjngV7hWiFIQ4E5Icm1IC1s6bLaRPZC97xIguzSq+/kCXXqjHlqqM2lc= X-Spam-Status: No, score=-3024.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, 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 This changes print_variable_and_value to accept a block_symbol and to use the new read_var_value overload. --- gdb/printcmd.c | 9 +++------ gdb/stack.c | 6 +++++- gdb/value.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index cb7023b1880..886361dff89 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2398,10 +2398,11 @@ clear_dangling_display_expressions (struct objfile *objfile) This function invalidates FRAME. */ void -print_variable_and_value (const char *name, struct symbol *var, +print_variable_and_value (const char *name, block_symbol bvar, frame_info_ptr frame, struct ui_file *stream, int indent) { + symbol *var = bvar.symbol; if (!name) name = var->print_name (); @@ -2414,11 +2415,7 @@ print_variable_and_value (const char *name, struct symbol *var, struct value *val; struct value_print_options opts; - /* READ_VAR_VALUE needs a block in order to deal with non-local - references (i.e. to handle nested functions). In this context, we - print variables that are local to this frame, so we can avoid passing - a block to it. */ - val = read_var_value (var, NULL, frame); + val = read_var_value (bvar, frame); get_user_print_options (&opts); opts.deref_ref = true; common_val_print_checked (val, stream, indent, &opts, current_language); diff --git a/gdb/stack.c b/gdb/stack.c index 0bf2b19fad7..6916df77929 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2268,6 +2268,7 @@ struct print_variable_and_value_data int num_tabs; struct ui_file *stream; int values_printed; + const struct block *block; void operator() (const char *print_name, struct symbol *sym); }; @@ -2296,7 +2297,8 @@ print_variable_and_value_data::operator() (const char *print_name, return; } - print_variable_and_value (print_name, sym, frame, stream, num_tabs); + print_variable_and_value (print_name, { sym, block }, frame, + stream, num_tabs); /* print_variable_and_value invalidates FRAME. */ frame = NULL; @@ -2363,6 +2365,7 @@ print_frame_local_vars (frame_info_ptr frame, cb_data.num_tabs = 4 * num_tabs; cb_data.stream = stream; cb_data.values_printed = 0; + cb_data.block = block; /* Temporarily change the selected frame to the given FRAME. This allows routines that rely on the selected frame instead @@ -2529,6 +2532,7 @@ print_frame_arg_vars (frame_info_ptr frame, cb_data.num_tabs = 0; cb_data.stream = stream; cb_data.values_printed = 0; + cb_data.block = func->value_block (); iterate_over_block_arg_vars (func->value_block (), cb_data); diff --git a/gdb/value.h b/gdb/value.h index 7cb830110fc..81c53536416 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1534,7 +1534,7 @@ extern int val_print_string (struct type *elttype, const char *encoding, const struct value_print_options *options); extern void print_variable_and_value (const char *name, - struct symbol *var, + block_symbol var, frame_info_ptr frame, struct ui_file *stream, int indent); From patchwork Sun Oct 29 23:23:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78716 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 5EEA838323FD for ; Sun, 29 Oct 2023 23:24:58 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 5F62A386192F for ; Sun, 29 Oct 2023 23:23:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F62A386192F 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 5F62A386192F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; cv=none; b=fCTLTSYANDQG8/LUuciLrBFqdMufNevOPZp/YaN9UFH+C1pFBtyX4knl/20Og7WAbzJiD43oW8nTtWQvBIiZZqbhKrDE5IqMw2XDPC/R7vq7a56XHcsRWm6qcjavnLqibuPmVFIkpCYbS5OhQbrvuazzqai+sWRLxocEwBo+PlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621795; c=relaxed/simple; bh=WuAMfLN0g5TeZiiPqh0dpOc3k+CDWmlfAerGjPGQfbI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=DWyF2jjT4LU58E1T+q7CK/dYwuWriprcZV5r8dXRmp4wVspl53AtprQG9xd9qMF8o+hml2kH92LLRPBIsAU9Hwt4wvRW9Kqg1sM24yELUm3J/nFp4LpvMSKcdjphJaby+XAzeo90aKmoGp5uHz3j+UxJ4EWuoIvFqnZSnbw7bxI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5001a.ext.cloudfilter.net ([10.0.29.139]) by cmsmtp with ESMTPS id xC6jqhsMJgpyExF7eqEFAM; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqy0JGkmEdxF7eqWc9f; Sun, 29 Oct 2023 23:23:10 +0000 X-Authority-Analysis: v=2.4 cv=AsL9YcxP c=1 sm=1 tr=0 ts=653ee95e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=hhQC6KFsvGt_RSI_mqIA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=gYgpVUedhz6HkubQwCuS/DwMNonXdNjw9IV4aiU/Nc4=; b=lGmb349WMV8bsn31mAzJrkcfMw 4OSIa3tZwfE8YQE8Y/qzu5eQr1UM2anhRLULEXSJy2XKLAFj54v8Rhqc9HJeTN5Wn6PHmRgJ0N+JZ KUZ+XY/j12/TsCroVAxh3lO8G; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-1V for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:47 -0600 Subject: [PATCH 26/30] Change find_frame_funname to return a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-26-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-1V X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 27 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLNosiGt5TMTWgo53a6YCic7cq3j9vlD9ZULOygyo+bqfF2FvlKNttkOQhJi/63wfaZ+xUNGKd8AVWrVSk1dcUvdms57oqV6yPQboUPl9rkV407rjKek 4C6DI4P0pP/u9VHITtO1DqtR+xXAPNsEmXMmz00HfJDGooM/lBqC2E+vOVv1KiWEcyd9hCM4ZnIsgaceJLt/Wzd9dBph+cdZbSQ= 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_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.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 This changes the out parameter of find_frame_funname to be a block_symbol. This helps a later patch. --- gdb/python/py-frame.c | 4 +++- gdb/python/py-unwind.c | 4 +++- gdb/stack.c | 19 ++++++++++--------- gdb/stack.h | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 1a55e514e39..555354df920 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -316,6 +316,7 @@ frapy_block (PyObject *self, PyObject *args) static PyObject * frapy_function (PyObject *self, PyObject *args) { + block_symbol bsym = {}; struct symbol *sym = NULL; frame_info_ptr frame; @@ -326,7 +327,8 @@ frapy_function (PyObject *self, PyObject *args) FRAPY_REQUIRE_VALID (self, frame); gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &sym); + = find_frame_funname (frame, &funlang, &bsym); + sym = bsym.symbol; } catch (const gdb_exception &except) { diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index ee50c51b531..97035c5a140 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -658,6 +658,7 @@ pending_framepy_function (PyObject *self, PyObject *args) PENDING_FRAMEPY_REQUIRE_VALID (pending_frame); struct symbol *sym = nullptr; + block_symbol bsym = {}; try { @@ -665,7 +666,8 @@ pending_framepy_function (PyObject *self, PyObject *args) frame_info_ptr frame = pending_frame->frame_info; gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &sym); + = find_frame_funname (frame, &funlang, &bsym); + sym = bsym.symbol; } catch (const gdb_exception &except) { diff --git a/gdb/stack.c b/gdb/stack.c index 6916df77929..8b76a1d524d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1258,21 +1258,21 @@ get_last_displayed_sal () gdb::unique_xmalloc_ptr find_frame_funname (frame_info_ptr frame, enum language *funlang, - struct symbol **funcp) + block_symbol *funcp) { - struct symbol *func; + block_symbol func; gdb::unique_xmalloc_ptr funname; *funlang = language_unknown; if (funcp) - *funcp = NULL; + *funcp = {}; - func = get_frame_function (frame).symbol; - if (func) + func = get_frame_function (frame); + if (func.symbol != nullptr) { - const char *print_name = func->print_name (); + const char *print_name = func.symbol->print_name (); - *funlang = func->language (); + *funlang = func.symbol->language (); if (funcp) *funcp = func; if (*funlang == language_cplus) @@ -1319,14 +1319,15 @@ print_frame (const frame_print_options &fp_opts, struct ui_out *uiout = current_uiout; enum language funlang = language_unknown; struct value_print_options opts; - struct symbol *func; CORE_ADDR pc = 0; int pc_p; pc_p = get_frame_pc_if_available (frame, &pc); + block_symbol bfunc; gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &func); + = find_frame_funname (frame, &funlang, &bfunc); + struct symbol *func = bfunc.symbol; annotate_frame_begin (print_level ? frame_relative_level (frame) : 0, gdbarch, pc); diff --git a/gdb/stack.h b/gdb/stack.h index 1b0c2b342a4..616eb9a93d4 100644 --- a/gdb/stack.h +++ b/gdb/stack.h @@ -22,7 +22,7 @@ gdb::unique_xmalloc_ptr find_frame_funname (frame_info_ptr frame, enum language *funlang, - struct symbol **funcp); + block_symbol *funcp); typedef gdb::function_view iterate_over_block_arg_local_vars_cb; From patchwork Sun Oct 29 23:23:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78715 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 91A8138323FA for ; Sun, 29 Oct 2023 23:24:52 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 0FA56386480A for ; Sun, 29 Oct 2023 23:23:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FA56386480A 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 0FA56386480A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621798; cv=none; b=IrQ17njEIU82G6Y+esyz+T74GuOjbKdNGG1YG4aCn4A2lCdXqb6HiBPGBY5g64k1sC07QLGIspaPKcR0639Znrbhzsk7161walY2NVIc4YgAelDyzBWvmrrKXsVQmlPM/Lizj4oZr5LTcvMY/6xXkuE6fFhfU88N/vqGudCrtyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621798; c=relaxed/simple; bh=av5rDW10IPfao6/E6YQbAOrNQH8asWRPMKY278vLCdY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=QNg6F3sgqEKnoCzCgkpEClVX1Gr1iPYCUQ8Sm1fbucKOQBeJf+SjwMaL/GQP8EbRZdacCoEp3Q0h46gTk2C5dckz6CV1ZBGJd5oWtD+OukdFX0v96y0ZPPRhjp32wmFRrNnh3nBJA4Wn1txhhUI6GRJ8Zp4LCF1fQsjYTFV6xrc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6009a.ext.cloudfilter.net ([10.0.30.184]) by cmsmtp with ESMTPS id wpTXq4E3iWcCIxF7eqWTgk; Sun, 29 Oct 2023 23:23:11 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqb5lbOk5SxF7eqGq5f; Sun, 29 Oct 2023 23:23:10 +0000 X-Authority-Analysis: v=2.4 cv=E+DeGIRl c=1 sm=1 tr=0 ts=653ee95e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=P3_9uBmkC6M_FAiY1AAA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=bQqGfMYJD5NzEVbVD7Xjj+sJZS66/VcDBw2wr/pQb4k=; b=tz8Ga4CjtozACblTUkoAMkwqah E0QnFkRXHiUUvPhh+aWrd4/JEphAXHHEe7eq2pbnZagr/p2weNAY2Xu08TtXOTHlaLsyXQz8uhuGh YWRQpXahebJEwOUj51oS+Y6WS; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-21 for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:48 -0600 Subject: [PATCH 27/30] Change btrace_function::sym to a block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-27-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-21 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 28 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDujMSEPN0uz7uMhLM2mJLm5fjaysFvHl9MPoevt1F78IWhBPcqJAlVhNDM2RL61fi1gtEwNHNG7sZBJlSrcLL4BmpveFDi09XjFccTHkwsPrkT8sct9 xkp/ktytqoPbs53TMzLYCAvEylu01qvCONBfOGB0kYTtS6UKIJgSI17kiUh/jy0azS3rdzoTRo3oAzOGVM2itzmXTDWGnsWH7Rk= X-Spam-Status: No, score=-3024.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, 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 This changes btrace_function::sym to be a block_symbol, enabling a later patch. --- gdb/btrace.c | 38 +++++++++++++++++++------------------- gdb/btrace.h | 5 +++-- gdb/python/py-record-btrace.c | 2 +- gdb/record-btrace.c | 8 ++++---- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/gdb/btrace.c b/gdb/btrace.c index ea18daa23e0..66b08dabb64 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -78,7 +78,7 @@ ftrace_print_function_name (const struct btrace_function *bfun) struct symbol *sym; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) return sym->print_name (); @@ -98,7 +98,7 @@ ftrace_print_filename (const struct btrace_function *bfun) struct symbol *sym; const char *filename; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) filename = symtab_to_filename_for_display (sym->symtab ()); @@ -192,7 +192,7 @@ ftrace_function_switched (const struct btrace_function *bfun, struct symbol *sym; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; /* If the minimal symbol changed, we certainly switched functions. */ if (mfun != NULL && msym != NULL @@ -235,7 +235,7 @@ ftrace_function_switched (const struct btrace_function *bfun, static struct btrace_function * ftrace_new_function (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { int level; unsigned int number, insn_offset; @@ -311,7 +311,7 @@ ftrace_fixup_caller (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_call (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { const unsigned int length = btinfo->functions.size (); struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun); @@ -331,7 +331,7 @@ ftrace_new_call (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_tailcall (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { const unsigned int length = btinfo->functions.size (); struct btrace_function *bfun = ftrace_new_function (btinfo, mfun, fun); @@ -414,7 +414,7 @@ ftrace_find_call (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_return (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { struct btrace_function *prev, *bfun, *caller; @@ -424,7 +424,7 @@ ftrace_new_return (struct btrace_thread_info *btinfo, /* It is important to start at PREV's caller. Otherwise, we might find PREV itself, if PREV is a recursive function. */ caller = ftrace_find_call_by_number (btinfo, prev->up); - caller = ftrace_find_caller (btinfo, caller, mfun, fun); + caller = ftrace_find_caller (btinfo, caller, mfun, fun.symbol); if (caller != NULL) { /* The caller of PREV is the preceding btrace function segment in this @@ -496,7 +496,7 @@ ftrace_new_return (struct btrace_thread_info *btinfo, static struct btrace_function * ftrace_new_switch (struct btrace_thread_info *btinfo, struct minimal_symbol *mfun, - struct symbol *fun) + block_symbol fun) { struct btrace_function *prev, *bfun; @@ -524,13 +524,13 @@ ftrace_new_gap (struct btrace_thread_info *btinfo, int errcode, struct btrace_function *bfun; if (btinfo->functions.empty ()) - bfun = ftrace_new_function (btinfo, NULL, NULL); + bfun = ftrace_new_function (btinfo, NULL, {}); else { /* We hijack the previous function segment if it was empty. */ bfun = &btinfo->functions.back (); if (bfun->errcode != 0 || !bfun->insn.empty ()) - bfun = ftrace_new_function (btinfo, NULL, NULL); + bfun = ftrace_new_function (btinfo, NULL, {}); } bfun->errcode = errcode; @@ -550,17 +550,16 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) { struct bound_minimal_symbol bmfun; struct minimal_symbol *mfun; - struct symbol *fun; struct btrace_function *bfun; /* Try to determine the function we're in. We use both types of symbols to avoid surprises when we sometimes get a full symbol and sometimes only a minimal symbol. */ - fun = find_pc_function (pc).symbol; + block_symbol fun = find_pc_function (pc); bmfun = lookup_minimal_symbol_by_pc (pc); mfun = bmfun.minsym; - if (fun == NULL && mfun == NULL) + if (fun.symbol == NULL && mfun == NULL) DEBUG_FTRACE ("no symbol at %s", core_addr_to_string_nz (pc)); /* If we didn't have a function, we create one. */ @@ -629,7 +628,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) { struct btrace_function *caller = ftrace_find_call_by_number (btinfo, bfun->up); - caller = ftrace_find_caller (btinfo, caller, mfun, fun); + caller = ftrace_find_caller (btinfo, caller, mfun, fun.symbol); if (caller != NULL) return ftrace_new_return (btinfo, mfun, fun); } @@ -637,7 +636,8 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) /* If we can't determine the function for PC, we treat a jump at the end of the block as tail call if we're switching functions and as an intra-function branch if we don't. */ - if (start == 0 && ftrace_function_switched (bfun, mfun, fun)) + if (start == 0 && ftrace_function_switched (bfun, mfun, + fun.symbol)) return ftrace_new_tailcall (btinfo, mfun, fun); break; @@ -646,7 +646,7 @@ ftrace_update_function (struct btrace_thread_info *btinfo, CORE_ADDR pc) } /* Check if we're switching functions for some other reason. */ - if (ftrace_function_switched (bfun, mfun, fun)) + if (ftrace_function_switched (bfun, mfun, fun.symbol)) { DEBUG_FTRACE ("switching from %s in %s at %s", ftrace_print_insn_addr (last), @@ -707,7 +707,7 @@ ftrace_match_backtrace (struct btrace_thread_info *btinfo, for (matches = 0; lhs != NULL && rhs != NULL; ++matches) { - if (ftrace_function_switched (lhs, rhs->msym, rhs->sym)) + if (ftrace_function_switched (lhs, rhs->msym, rhs->sym.symbol)) return 0; lhs = ftrace_get_caller (btinfo, lhs); @@ -890,7 +890,7 @@ ftrace_connect_backtrace (struct btrace_thread_info *btinfo, { struct btrace_function *prev, *next; - gdb_assert (!ftrace_function_switched (lhs, rhs->msym, rhs->sym)); + gdb_assert (!ftrace_function_switched (lhs, rhs->msym, rhs->sym.symbol)); /* Connecting LHS and RHS may change the up link. */ prev = lhs; diff --git a/gdb/btrace.h b/gdb/btrace.h index 994af4c459b..9e32ce4da17 100644 --- a/gdb/btrace.h +++ b/gdb/btrace.h @@ -29,6 +29,7 @@ #include "gdbsupport/btrace-common.h" #include "target/waitstatus.h" #include "gdbsupport/enum-flags.h" +#include "block-symbol.h" #if defined (HAVE_LIBIPT) # include @@ -131,7 +132,7 @@ enum btrace_pt_error We do not allow function segments without instructions otherwise. */ struct btrace_function { - btrace_function (struct minimal_symbol *msym_, struct symbol *sym_, + btrace_function (struct minimal_symbol *msym_, block_symbol sym_, unsigned int number_, unsigned int insn_offset_, int level_) : msym (msym_), sym (sym_), insn_offset (insn_offset_), number (number_), level (level_) @@ -140,7 +141,7 @@ struct btrace_function /* The full and minimal symbol for the function. Both may be NULL. */ struct minimal_symbol *msym; - struct symbol *sym; + block_symbol sym; /* The function segment numbers of the previous and next segment belonging to the same function. If a function calls another function, the former will diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index 822ae18e25e..7a51b1f0786 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -341,7 +341,7 @@ recpy_bt_func_symbol (PyObject *self, void *closure) if (func == NULL) return NULL; - if (func->sym == NULL) + if (func->sym.symbol == nullptr) Py_RETURN_NONE; return symbol_to_symbol_object (func->sym); diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index abab79f3132..58017822923 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1069,7 +1069,7 @@ btrace_compute_src_line_range (const struct btrace_function *bfun, begin = INT_MAX; end = INT_MIN; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym == NULL) goto out; @@ -1101,7 +1101,7 @@ btrace_call_history_src_line (struct ui_out *uiout, struct symbol *sym; int begin, end; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym == NULL) return; @@ -1135,7 +1135,7 @@ btrace_get_bfun_name (const struct btrace_function *bfun) return "??"; msym = bfun->msym; - sym = bfun->sym; + sym = bfun->sym.symbol; if (sym != NULL) return sym->print_name (); @@ -1167,7 +1167,7 @@ btrace_call_history (struct ui_out *uiout, struct symbol *sym; bfun = btrace_call_get (&it); - sym = bfun->sym; + sym = bfun->sym.symbol; msym = bfun->msym; /* Print the function index. */ From patchwork Sun Oct 29 23:23:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78723 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 798C93831E0A for ; Sun, 29 Oct 2023 23:25:23 +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 747B0386193A for ; Sun, 29 Oct 2023 23:23:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 747B0386193A 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 747B0386193A 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=1698621800; cv=none; b=Eo2Uu4bitO/QEO0NG5GFsXKLf+5bL5RthV/iD/1wWpFhz1sRBX9vRs5E/erVdOw+K1LeR1GDewemo0TuHzkMchrcU36HBGkQDcKM6E/Bm+7X87yNw1c8dtH+mIXiKe+0bja08KPTstVSmVlmLyV/kDSNiQRlBh8SkczgB0GuQsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621800; c=relaxed/simple; bh=zodlxV7qQb0L1LZY8UnoqOoqUbhsF7BiWeJxuFXCgfo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=aF/k83I0YrlNrvh0IyJ+aEaLGpw3AvJ91fGkDxJBEItyvbpqZuT3QOVijXjrGuZu5YX6zR742pkzutdFyZ8NoTyLeHAaN2WKP84SwHfUgp+laGOGGKPc3WBdWE280jGLc1BvaojJYpMx4tlCO16HUOAQ9tszQKjBF0d9Ofhqx/M= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6009a.ext.cloudfilter.net ([10.0.30.184]) by cmsmtp with ESMTPS id x83rqnfdI8HtexF7eqEXeS; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7dqb5lmOk5SxF7eqGq5p; Sun, 29 Oct 2023 23:23:10 +0000 X-Authority-Analysis: v=2.4 cv=E+DeGIRl c=1 sm=1 tr=0 ts=653ee95e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=fT4md5XmbbeE4dyhzB8A:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=Kq+sHPrs0hjywFBC7MNC8nLIMGwHh7P3BVa19D6VHok=; b=e9h1lmbcSBfBEIbVpueNLKR6di 2R0wNB8B5q/od/zOLZe52Y31GGqOoReUDDk39c6ygeUuwTyy/1usoOJAija7hUjJFxIv1JCJwfIQE ZzNU74jz5NEyA72vFWQ8cCxHV; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-2R for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:49 -0600 Subject: [PATCH 28/30] Use read_var_value overload in Python MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-28-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-2R X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 29 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDujMSEPN0uz7uMhLM2mJLm5fjaysFvHl9MPoevt1F78IWhBPcqJAlVhNDM2RL61fi1gtEwNHNG7sZBJlSrcLL4BmpveFDi09XjFccTHkwsPrkT8sct9 xkp/ktytqoPbs53TMzLYCAvEylu01qvCONBfOGB0kYTtS6UKIJgSI17kiUh/jy0azS3rdzoTRo3oAzOGVM2itzmXTDWGnsWH7Rk= X-Spam-Status: No, score=-3024.6 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 This changes the Python layer to store a block_symbol in its symbol wrapper, and to use the new read_var_value overload. --- gdb/python/py-block.c | 6 +- gdb/python/py-finishbreakpoint.c | 6 +- gdb/python/py-frame.c | 19 +++--- gdb/python/py-framefilter.c | 6 +- gdb/python/py-objfile.c | 16 +++-- gdb/python/py-symbol.c | 143 +++++++++++++++++++-------------------- gdb/python/py-unwind.c | 8 +-- gdb/python/python-internal.h | 4 +- 8 files changed, 100 insertions(+), 108 deletions(-) diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index dd6d6d278a0..48921c38af2 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -156,7 +156,7 @@ blpy_get_function (PyObject *self, void *closure) sym = block->function (); if (sym) - return symbol_to_symbol_object (sym); + return symbol_to_symbol_object ({ sym, block }); Py_RETURN_NONE; } @@ -272,7 +272,7 @@ blpy_getitem (PyObject *self, PyObject *key) for (struct symbol *sym : block_iterator_range (block, &lookup_name)) { /* Just stop at the first match */ - return symbol_to_symbol_object (sym); + return symbol_to_symbol_object ({ sym, block }); } PyErr_SetObject (PyExc_KeyError, key); @@ -376,7 +376,7 @@ blpy_block_syms_iternext (PyObject *self) return NULL; } - return symbol_to_symbol_object (sym); + return symbol_to_symbol_object ({ sym, iter_obj->block }); } static void diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 53ba41bd157..673283ce2c6 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -115,12 +115,12 @@ bpfinishpy_pre_stop_hook (struct gdbpy_breakpoint_object *bp_obj) { scoped_value_mark free_values; - struct symbol *func_symbol = + block_symbol func_symbol = symbol_object_to_symbol (self_finishbp->func_symbol); struct value *function = value_object_to_value (self_finishbp->function_value); struct value *ret = - get_return_value (func_symbol, function); + get_return_value (func_symbol.symbol, function); if (ret) { @@ -271,7 +271,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) PyErr_Clear (); self_bpfinish->func_symbol - = symbol_to_symbol_object (function); + = symbol_to_symbol_object (b_fun); PyErr_Clear (); } } diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 555354df920..d4e3f263d5f 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -316,8 +316,7 @@ frapy_block (PyObject *self, PyObject *args) static PyObject * frapy_function (PyObject *self, PyObject *args) { - block_symbol bsym = {}; - struct symbol *sym = NULL; + block_symbol sym = {}; frame_info_ptr frame; try @@ -327,15 +326,14 @@ frapy_function (PyObject *self, PyObject *args) FRAPY_REQUIRE_VALID (self, frame); gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &bsym); - sym = bsym.symbol; + = find_frame_funname (frame, &funlang, &sym); } catch (const gdb_exception &except) { GDB_PY_HANDLE_EXCEPTION (except); } - if (sym) + if (sym.symbol != nullptr) return symbol_to_symbol_object (sym); Py_RETURN_NONE; @@ -481,8 +479,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) { frame_info_ptr frame; PyObject *sym_obj, *block_obj = NULL; - struct symbol *var = NULL; /* gcc-4.3.2 false warning. */ - const struct block *block = NULL; + block_symbol var; static const char *keywords[] = { "variable", "block", nullptr }; if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "O|O!", keywords, @@ -500,6 +497,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) if (!var_name) return NULL; + const struct block *block = NULL; if (block_obj != nullptr) { /* This call should only fail if the type of BLOCK_OBJ is wrong, @@ -517,8 +515,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) if (!block) block = get_frame_block (frame, NULL); lookup_sym = lookup_symbol (var_name.get (), block, VAR_DOMAIN, NULL); - var = lookup_sym.symbol; - block = lookup_sym.block; + var = lookup_sym; } catch (const gdb_exception &except) { @@ -526,7 +523,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) return NULL; } - if (!var) + if (var.symbol == nullptr) { PyErr_Format (PyExc_ValueError, _("Variable '%s' not found."), var_name.get ()); @@ -548,7 +545,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) FRAPY_REQUIRE_VALID (self, frame); scoped_value_mark free_values; - struct value *val = read_var_value (var, block, frame); + struct value *val = read_var_value (var, frame); result = value_to_value_object (val); } catch (const gdb_exception &except) diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c index b214e82628f..b2f2d81d4de 100644 --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c @@ -83,11 +83,7 @@ extract_sym (PyObject *obj, gdb::unique_xmalloc_ptr *name, { /* This type checks 'result' during the conversion so we just call it unconditionally and check the return. */ - /* TODO: currently, we have no way to recover the block in which SYMBOL - was found, so we have no block to return. Trying to evaluate SYMBOL - will yield an incorrect value when it's located in a FRAME and - evaluated from another frame (as permitted in nested functions). */ - *sym = { symbol_object_to_symbol (result.get ()), nullptr }; + *sym = symbol_object_to_symbol (result.get ()); if (sym->symbol == NULL) { diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index bb5d0d92aba..ee0a262e0fb 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -479,9 +479,11 @@ objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) try { - struct symbol *sym = lookup_global_symbol_from_objfile - (obj->objfile, GLOBAL_BLOCK, symbol_name, (domain_enum) domain).symbol; - if (sym == nullptr) + block_symbol sym + = lookup_global_symbol_from_objfile (obj->objfile, GLOBAL_BLOCK, + symbol_name, + (domain_enum) domain); + if (sym.symbol == nullptr) Py_RETURN_NONE; return symbol_to_symbol_object (sym); @@ -513,9 +515,11 @@ objfpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) try { - struct symbol *sym = lookup_global_symbol_from_objfile - (obj->objfile, STATIC_BLOCK, symbol_name, (domain_enum) domain).symbol; - if (sym == nullptr) + block_symbol sym + = lookup_global_symbol_from_objfile (obj->objfile, STATIC_BLOCK, + symbol_name, + (domain_enum) domain); + if (sym.symbol == nullptr) Py_RETURN_NONE; return symbol_to_symbol_object (sym); diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 99724cfc95b..b802a7fdb45 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -29,7 +29,7 @@ struct symbol_object { PyObject_HEAD /* The GDB symbol structure this object is wrapping. */ - struct symbol *symbol; + block_symbol symbol; /* A symbol object is associated with an objfile, so keep track with doubly-linked list, rooted in the objfile. This lets us invalidate the underlying struct symbol when the objfile is @@ -40,10 +40,10 @@ struct symbol_object { /* Require a valid symbol. All access to symbol_object->symbol should be gated by this call. */ -#define SYMPY_REQUIRE_VALID(symbol_obj, symbol) \ +#define SYMPY_REQUIRE_VALID(symbol_obj, val) \ do { \ - symbol = symbol_object_to_symbol (symbol_obj); \ - if (symbol == NULL) \ + val = symbol_object_to_symbol (symbol_obj); \ + if (val.symbol == NULL) \ { \ PyErr_SetString (PyExc_RuntimeError, \ _("Symbol is invalid.")); \ @@ -60,7 +60,7 @@ struct symbol_object_deleter { symbol_object *next = obj->next; - obj->symbol = NULL; + obj->symbol = {}; obj->next = NULL; obj->prev = NULL; @@ -76,11 +76,11 @@ static PyObject * sympy_str (PyObject *self) { PyObject *result; - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - result = PyUnicode_FromString (symbol->print_name ()); + result = PyUnicode_FromString (symbol.symbol->print_name ()); return result; } @@ -88,56 +88,56 @@ sympy_str (PyObject *self) static PyObject * sympy_get_type (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - if (symbol->type () == NULL) + if (symbol.symbol->type () == NULL) { Py_INCREF (Py_None); return Py_None; } - return type_to_type_object (symbol->type ()); + return type_to_type_object (symbol.symbol->type ()); } static PyObject * sympy_get_symtab (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - if (!symbol->is_objfile_owned ()) + if (!symbol.symbol->is_objfile_owned ()) Py_RETURN_NONE; - return symtab_to_symtab_object (symbol->symtab ()); + return symtab_to_symtab_object (symbol.symbol->symtab ()); } static PyObject * sympy_get_name (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - return PyUnicode_FromString (symbol->natural_name ()); + return PyUnicode_FromString (symbol.symbol->natural_name ()); } static PyObject * sympy_get_linkage_name (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - return PyUnicode_FromString (symbol->linkage_name ()); + return PyUnicode_FromString (symbol.symbol->linkage_name ()); } static PyObject * sympy_get_print_name (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); @@ -147,32 +147,32 @@ sympy_get_print_name (PyObject *self, void *closure) static PyObject * sympy_get_addr_class (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - return gdb_py_object_from_longest (symbol->aclass ()).release (); + return gdb_py_object_from_longest (symbol.symbol->aclass ()).release (); } static PyObject * sympy_is_argument (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - return PyBool_FromLong (symbol->is_argument ()); + return PyBool_FromLong (symbol.symbol->is_argument ()); } static PyObject * sympy_is_constant (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; enum address_class theclass; SYMPY_REQUIRE_VALID (self, symbol); - theclass = symbol->aclass (); + theclass = symbol.symbol->aclass (); return PyBool_FromLong (theclass == LOC_CONST || theclass == LOC_CONST_BYTES); } @@ -180,12 +180,12 @@ sympy_is_constant (PyObject *self, void *closure) static PyObject * sympy_is_function (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; enum address_class theclass; SYMPY_REQUIRE_VALID (self, symbol); - theclass = symbol->aclass (); + theclass = symbol.symbol->aclass (); return PyBool_FromLong (theclass == LOC_BLOCK); } @@ -193,14 +193,14 @@ sympy_is_function (PyObject *self, void *closure) static PyObject * sympy_is_variable (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; enum address_class theclass; SYMPY_REQUIRE_VALID (self, symbol); - theclass = symbol->aclass (); + theclass = symbol.symbol->aclass (); - return PyBool_FromLong (!symbol->is_argument () + return PyBool_FromLong (!symbol.symbol->is_argument () && (theclass == LOC_LOCAL || theclass == LOC_REGISTER || theclass == LOC_STATIC || theclass == LOC_COMPUTED || theclass == LOC_OPTIMIZED_OUT)); @@ -212,14 +212,14 @@ sympy_is_variable (PyObject *self, void *closure) static PyObject * sympy_needs_frame (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; int result = 0; SYMPY_REQUIRE_VALID (self, symbol); try { - result = symbol_read_needs_frame (symbol); + result = symbol_read_needs_frame (symbol.symbol); } catch (const gdb_exception &except) { @@ -237,11 +237,11 @@ sympy_needs_frame (PyObject *self, void *closure) static PyObject * sympy_line (PyObject *self, void *closure) { - struct symbol *symbol = NULL; + block_symbol symbol; SYMPY_REQUIRE_VALID (self, symbol); - return gdb_py_object_from_longest (symbol->line ()).release (); + return gdb_py_object_from_longest (symbol.symbol->line ()).release (); } /* Implementation of gdb.Symbol.is_valid (self) -> Boolean. @@ -250,10 +250,10 @@ sympy_line (PyObject *self, void *closure) static PyObject * sympy_is_valid (PyObject *self, PyObject *args) { - struct symbol *symbol = NULL; + block_symbol symbol; symbol = symbol_object_to_symbol (self); - if (symbol == NULL) + if (symbol.symbol == NULL) Py_RETURN_FALSE; Py_RETURN_TRUE; @@ -265,7 +265,7 @@ sympy_is_valid (PyObject *self, PyObject *args) static PyObject * sympy_value (PyObject *self, PyObject *args) { - struct symbol *symbol = NULL; + block_symbol symbol; frame_info_ptr frame_info = NULL; PyObject *frame_obj = NULL; @@ -279,7 +279,7 @@ sympy_value (PyObject *self, PyObject *args) } SYMPY_REQUIRE_VALID (self, symbol); - if (symbol->aclass () == LOC_TYPEDEF) + if (symbol.symbol->aclass () == LOC_TYPEDEF) { PyErr_SetString (PyExc_TypeError, "cannot get the value of a typedef"); return NULL; @@ -295,15 +295,11 @@ sympy_value (PyObject *self, PyObject *args) error (_("invalid frame")); } - if (symbol_read_needs_frame (symbol) && frame_info == NULL) + if (symbol_read_needs_frame (symbol.symbol) && frame_info == NULL) error (_("symbol requires a frame to compute its value")); - /* TODO: currently, we have no way to recover the block in which SYMBOL - was found, so we have no block to pass to read_var_value. This will - yield an incorrect value when symbol is not local to FRAME_INFO (this - can happen with nested functions). */ scoped_value_mark free_values; - struct value *value = read_var_value (symbol, NULL, frame_info); + struct value *value = read_var_value (symbol, frame_info); result = value_to_value_object (value); } catch (const gdb_exception &except) @@ -320,14 +316,14 @@ sympy_value (PyObject *self, PyObject *args) with the life-cycle of the object file associated with this symbol, if needed. */ static void -set_symbol (symbol_object *obj, struct symbol *symbol) +set_symbol (symbol_object *obj, block_symbol symbol) { obj->symbol = symbol; obj->prev = NULL; - if (symbol->is_objfile_owned () - && symbol->symtab () != NULL) + if (symbol.symbol->is_objfile_owned () + && symbol.symbol->symtab () != NULL) { - struct objfile *objfile = symbol->objfile (); + struct objfile *objfile = symbol.symbol->objfile (); obj->next = sympy_objfile_data_key.get (objfile); if (obj->next) @@ -341,7 +337,7 @@ set_symbol (symbol_object *obj, struct symbol *symbol) /* Create a new symbol object (gdb.Symbol) that encapsulates the struct symbol object from GDB. */ PyObject * -symbol_to_symbol_object (struct symbol *sym) +symbol_to_symbol_object (block_symbol sym) { symbol_object *sym_obj; @@ -353,11 +349,11 @@ symbol_to_symbol_object (struct symbol *sym) } /* Return the symbol that is wrapped by this symbol object. */ -struct symbol * +block_symbol symbol_object_to_symbol (PyObject *obj) { if (! PyObject_TypeCheck (obj, &symbol_object_type)) - return NULL; + return {}; return ((symbol_object *) obj)->symbol; } @@ -368,13 +364,14 @@ sympy_dealloc (PyObject *obj) if (sym_obj->prev) sym_obj->prev->next = sym_obj->next; - else if (sym_obj->symbol != NULL - && sym_obj->symbol->is_objfile_owned () - && sym_obj->symbol->symtab () != NULL) - sympy_objfile_data_key.set (sym_obj->symbol->objfile (), sym_obj->next); + else if (sym_obj->symbol.symbol != NULL + && sym_obj->symbol.symbol->is_objfile_owned () + && sym_obj->symbol.symbol->symtab () != NULL) + sympy_objfile_data_key.set (sym_obj->symbol.symbol->objfile (), + sym_obj->next); if (sym_obj->next) sym_obj->next->prev = sym_obj->prev; - sym_obj->symbol = NULL; + sym_obj->symbol = {}; Py_TYPE (obj)->tp_free (obj); } @@ -384,11 +381,11 @@ static PyObject * sympy_repr (PyObject *self) { const auto symbol = symbol_object_to_symbol (self); - if (symbol == nullptr) + if (symbol.symbol == nullptr) return PyUnicode_FromFormat ("<%s (invalid)>", Py_TYPE (self)->tp_name); return PyUnicode_FromFormat ("<%s print_name=%s>", Py_TYPE (self)->tp_name, - symbol->print_name ()); + symbol.symbol->print_name ()); } /* Implementation of @@ -404,7 +401,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) struct field_of_this_result is_a_field_of_this; const char *name; static const char *keywords[] = { "name", "block", "domain", NULL }; - struct symbol *symbol = NULL; + block_symbol symbol; PyObject *block_obj = NULL, *sym_obj, *bool_obj; const struct block *block = NULL; @@ -433,7 +430,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) try { symbol = lookup_symbol (name, block, (domain_enum) domain, - &is_a_field_of_this).symbol; + &is_a_field_of_this); } catch (const gdb_exception &except) { @@ -444,7 +441,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) if (ret_tuple == NULL) return NULL; - if (symbol) + if (symbol.symbol != nullptr) { sym_obj = symbol_to_symbol_object (symbol); if (!sym_obj) @@ -472,7 +469,7 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) int domain = VAR_DOMAIN; const char *name; static const char *keywords[] = { "name", "domain", NULL }; - struct symbol *symbol = NULL; + block_symbol symbol; PyObject *sym_obj; if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name, @@ -481,14 +478,14 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) try { - symbol = lookup_global_symbol (name, NULL, (domain_enum) domain).symbol; + symbol = lookup_global_symbol (name, NULL, (domain_enum) domain); } catch (const gdb_exception &except) { GDB_PY_HANDLE_EXCEPTION (except); } - if (symbol) + if (symbol.symbol != nullptr) { sym_obj = symbol_to_symbol_object (symbol); if (!sym_obj) @@ -512,7 +509,7 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) const char *name; int domain = VAR_DOMAIN; static const char *keywords[] = { "name", "domain", NULL }; - struct symbol *symbol = NULL; + block_symbol symbol = {}; PyObject *sym_obj; if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|i", keywords, &name, @@ -543,19 +540,18 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) try { if (block != nullptr) - symbol - = lookup_symbol_in_static_block (name, block, - (domain_enum) domain).symbol; + symbol = lookup_symbol_in_static_block (name, block, + (domain_enum) domain); - if (symbol == nullptr) - symbol = lookup_static_symbol (name, (domain_enum) domain).symbol; + if (symbol.symbol == nullptr) + symbol = lookup_static_symbol (name, (domain_enum) domain); } catch (const gdb_exception &except) { GDB_PY_HANDLE_EXCEPTION (except); } - if (symbol) + if (symbol.symbol != nullptr) { sym_obj = symbol_to_symbol_object (symbol); if (!sym_obj) @@ -612,10 +608,11 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw) if (block != nullptr) { - symbol *symbol = lookup_symbol_in_static_block - (name, block, (domain_enum) domain).symbol; + block_symbol symbol + = lookup_symbol_in_static_block (name, block, + (domain_enum) domain); - if (symbol != nullptr) + if (symbol.symbol != nullptr) { PyObject *sym_obj = symbol_to_symbol_object (symbol); diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 97035c5a140..7229ac86889 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -657,8 +657,7 @@ pending_framepy_function (PyObject *self, PyObject *args) PENDING_FRAMEPY_REQUIRE_VALID (pending_frame); - struct symbol *sym = nullptr; - block_symbol bsym = {}; + block_symbol sym = {}; try { @@ -666,15 +665,14 @@ pending_framepy_function (PyObject *self, PyObject *args) frame_info_ptr frame = pending_frame->frame_info; gdb::unique_xmalloc_ptr funname - = find_frame_funname (frame, &funlang, &bsym); - sym = bsym.symbol; + = find_frame_funname (frame, &funlang, &sym); } catch (const gdb_exception &except) { GDB_PY_HANDLE_EXCEPTION (except); } - if (sym != nullptr) + if (sym.symbol != nullptr) return symbol_to_symbol_object (sym); Py_RETURN_NONE; diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 847bed84dfe..a4c392085a6 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -435,7 +435,7 @@ PyObject *gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *symtab_and_line_to_sal_object (struct symtab_and_line sal); PyObject *symtab_to_symtab_object (struct symtab *symtab); -PyObject *symbol_to_symbol_object (struct symbol *sym); +PyObject *symbol_to_symbol_object (block_symbol sym); PyObject *block_to_block_object (const struct block *block, struct objfile *objfile); PyObject *value_to_value_object (struct value *v); @@ -474,7 +474,7 @@ gdbpy_ref<> target_to_connection_object (process_stratum_target *target); PyObject *gdbpy_connections (PyObject *self, PyObject *args); const struct block *block_object_to_block (PyObject *obj); -struct symbol *symbol_object_to_symbol (PyObject *obj); +block_symbol symbol_object_to_symbol (PyObject *obj); struct value *value_object_to_value (PyObject *self); struct value *convert_value_from_python (PyObject *obj); struct type *type_object_to_type (PyObject *obj); From patchwork Sun Oct 29 23:23:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78724 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 2A0D2387546D for ; Sun, 29 Oct 2023 23:25:34 +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 ABD203864821 for ; Sun, 29 Oct 2023 23:23:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABD203864821 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 ABD203864821 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=1698621798; cv=none; b=ARxBFW7lVy8bZpYdCiOl5Udpw4bKvZv2qP066Fo5cRYWbc90D2J8tEmCvFtK5Zp85i2o481cYRpFQLqkk8mFCG2nixpDB5JVDplf2UAwVdK7b2knPPuxHYuFySWMN2trCXWdOVPaoJTT+C8q/Qr6Mq1cE5MuhrdihRLxcLemEAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698621798; c=relaxed/simple; bh=pjyN9HvWR/WwlPkWontErlzGvYqKflAFhKnl2d4OD5U=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=P62zMU18LS1tkGhfm28HvuA5f6WH14K9/KAkt642Sjff9zNMcD72lf/hzP1xXRhT556WPvDHUJDS/nPfFQ1bWARf/ndOh4/Gc1FBMGzZMB6yRqXyUabG9L4ZeRrpcfhBpj8SofW3XYXPxFmcUQDdrVk3KJCq8kH5VgQuVAMCb7Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5007a.ext.cloudfilter.net ([10.0.29.141]) by cmsmtp with ESMTPS id x2aRqn1ZM8HtexF7eqEXeT; Sun, 29 Oct 2023 23:23:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xF7eq09uw6uHPxF7eq1an0; Sun, 29 Oct 2023 23:23:10 +0000 X-Authority-Analysis: v=2.4 cv=TuH1ORbh c=1 sm=1 tr=0 ts=653ee95e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=fQDgp5fGvWKkbtXdODQA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=twDZqhksYQsI+BOjVAT69+tJnBzrlVCgeqA0qNmiVuU=; b=RgvCqk0HF1UmY1VS4ZwhcXfR2U /CvkA+nue7Rg3MTTFxyuSon0pCXFtxwO1TexNnga935mXY4KykwSZsVg6UqxaIUm0bpUjRAMgm1tU eWveEnGyWJB6yMNIlofhbzIQj; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7d-0042zY-2z for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:09 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:50 -0600 Subject: [PATCH 29/30] Remove the old read_var_value MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-29-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7d-0042zY-2z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 X-Source-Auth: tom+tromey.com X-Email-Count: 30 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfHfZ+cv5HzPAAzoH4u7MXqjfs1EdkH8tfg2z40QUTh7/whSPP3XRIO38tEzMLF/sD9TmD5rTwfEk1OLDIdcE2XvkXiGloMccXtzdOPg0Egv5yZkuvQgv uKs8jGyzIxnrtI8qW9pTbEX3g72F+P2BrL3e2aqmS2sUTvomlXuexBFCdxXc/bkiwKce969VcX1dYs0WalSNSxSZ6/OcJRNRiIo= X-Spam-Status: No, score=-3024.6 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 This removes the old, original read_var_value. It is no longer called. --- gdb/findvar.c | 13 ------------- gdb/value.h | 4 ---- 2 files changed, 17 deletions(-) diff --git a/gdb/findvar.c b/gdb/findvar.c index f3be783ec24..4282d85425a 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -783,19 +783,6 @@ language_defn::read_var_value (struct symbol *var, /* Calls VAR's language read_var_value hook with the given arguments. */ -struct value * -read_var_value (struct symbol *var, const struct block *var_block, - frame_info_ptr frame) -{ - const struct language_defn *lang = language_def (var->language ()); - - gdb_assert (lang != NULL); - - return lang->read_var_value (var, var_block, frame); -} - -/* Calls VAR's language read_var_value hook with the given arguments. */ - struct value * read_var_value (block_symbol var, frame_info_ptr frame) { diff --git a/gdb/value.h b/gdb/value.h index 81c53536416..7072dce9782 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1134,10 +1134,6 @@ extern enum symbol_needs_kind symbol_read_needs (struct symbol *); extern int symbol_read_needs_frame (struct symbol *); -extern struct value *read_var_value (struct symbol *var, - const struct block *var_block, - frame_info_ptr frame); - extern struct value *read_var_value (block_symbol var, frame_info_ptr frame); From patchwork Sun Oct 29 23:23:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 78725 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 AFFCE3861923 for ; Mon, 30 Oct 2023 00:21:54 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 52A1D385697B for ; Mon, 30 Oct 2023 00:21:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52A1D385697B 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 52A1D385697B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698625294; cv=none; b=EFwTsjEasto7ceTUHSJBatwZ3Z/dIHd0+8POdHS2XZL3+/W1zFSKIxKZNYoI1Aqu6NpkdoxNT3BowoH207Me/2o3N08KS5qqACz4N5aTgLv8sd+Ghi/FTKHJL86ilYFBfNQ7C/MWOTfsSqVuF0XXGbMM7lLeAreWYUXUQsvkgjY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698625294; c=relaxed/simple; bh=xercNUNMmZaW3xfKliPJr27ANIh+ZQsguM9dZKtAQOs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=RFtzhWwhk1GosczFAHPEYyMeeJdp2wUWzNCbUaNf8NWbfEYT3qPmwzsktEG1nHbsKgJEp1dR4y7BdMWA2yUZivPQ1FgTc1zegoOYV5T+yRfZUCw3UXqqkYQstErwEN61jLgGTXs7mqGARm2V56n+UVATMcBHQll+sz/+x+oCOaM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id x2aTq5nElWcCIxG23qWdyl; Mon, 30 Oct 2023 00:21:28 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id xG23qFmJnwasUxG23qqXGc; Mon, 30 Oct 2023 00:21:27 +0000 X-Authority-Analysis: v=2.4 cv=ZpP+lv3G c=1 sm=1 tr=0 ts=653ef707 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=A3__3NFg9PEdqGV-UCIA:9 a=QEXdDO2ut3YA:10 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=rKfaiRNmYMOVpszcVRspoGWOoiHaGShMJ8wd54gnrkk=; b=RvSl23rrdLQwd9hKB45pAnRgRk ohrGczZDy2DJuBIL8kJGUPWriYBf+Cpu0z/QdN0CHuEwibrIfTEYTOCU3qo2r7BZACpD+RX6voz6/ 36qcjJT/023N9AzXQbEJP6VcB; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:56344 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1qxF7e-0042zY-0D for gdb-patches@sourceware.org; Sun, 29 Oct 2023 17:23:10 -0600 From: Tom Tromey Date: Sun, 29 Oct 2023 17:23:51 -0600 Subject: [PATCH 30/30] Change language_defn::read_var_value to accept block_symbol MIME-Version: 1.0 Message-Id: <20231029-split-objfile-2023-bound-sym-october-v1-30-612531df2734@tromey.com> References: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> In-Reply-To: <20231029-split-objfile-2023-bound-sym-october-v1-0-612531df2734@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.4 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: 1qxF7e-0042zY-0D X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net ([192.168.0.21]) [97.122.77.73]:56344 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: MS4xfH+zjFP2vosORlUL6mZh2xbdOCAP3y0hy42EzM43eObCGaqzBvFOXIX4bo2eN2y0l41urfx5Qen3mXMD2pXQ6ISowyxt0zBUePOY4P9rpXwS2x4I56KB hfH0ZYBIdjcqycNZtY0r8CAPtbhjFBJYH688pOQRt6vUw09NeqoIsqS0wdOmfAZOcDzAw+j6SkWq/AMI6aqSZ4fY7Gxd4brb++Y= X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, 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 This changes language_defn::read_var_value to accept a block_symbol, and to call block_symbol::address. --- gdb/ada-lang.c | 9 ++++----- gdb/findvar.c | 17 ++++++++--------- gdb/language.h | 14 ++++---------- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 1f854940b36..69a57641c42 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13406,8 +13406,7 @@ class ada_language : public language_defn /* Implement the "read_var_value" language_defn method for Ada. */ - struct value *read_var_value (struct symbol *var, - const struct block *var_block, + struct value *read_var_value (block_symbol var, frame_info_ptr frame) const override { /* The only case where default_read_var_value is not sufficient @@ -13415,13 +13414,13 @@ class ada_language : public language_defn if (frame != nullptr) { const struct block *frame_block = get_frame_block (frame, NULL); - if (frame_block != nullptr && ada_is_renaming_symbol (var)) - return ada_read_renaming_var_value (var, frame_block); + if (frame_block != nullptr && ada_is_renaming_symbol (var.symbol)) + return ada_read_renaming_var_value (var.symbol, frame_block); } /* This is a typical case where we expect the default_read_var_value function to work. */ - return language_defn::read_var_value (var, var_block, frame); + return language_defn::read_var_value (var, frame); } /* See language.h. */ diff --git a/gdb/findvar.c b/gdb/findvar.c index 4282d85425a..359024e931b 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -549,11 +549,10 @@ get_hosting_frame (struct symbol *var, const struct block *var_block, /* See language.h. */ struct value * -language_defn::read_var_value (struct symbol *var, - const struct block *var_block, - frame_info_ptr frame) const +language_defn::read_var_value (block_symbol bvar, frame_info_ptr frame) const { struct value *v; + symbol *var = bvar.symbol; struct type *type = var->type (); CORE_ADDR addr; enum symbol_needs_kind sym_need; @@ -572,7 +571,7 @@ language_defn::read_var_value (struct symbol *var, error (_("Cannot read `%s' without registers"), var->print_name ()); if (frame != NULL) - frame = get_hosting_frame (var, var_block, frame); + frame = get_hosting_frame (var, bvar.block, frame); if (SYMBOL_COMPUTED_OPS (var) != NULL) return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame); @@ -598,11 +597,11 @@ language_defn::read_var_value (struct symbol *var, if (overlay_debugging) { struct objfile *var_objfile = var->objfile (); - addr = symbol_overlayed_address (var->value_address (), + addr = symbol_overlayed_address (bvar.address (), var->obj_section (var_objfile)); } else - addr = var->value_address (); + addr = bvar.address (); /* First convert the CORE_ADDR to a function pointer type, this ensures the gdbarch knows what type of pointer we are @@ -635,10 +634,10 @@ language_defn::read_var_value (struct symbol *var, case LOC_STATIC: if (overlay_debugging) addr - = symbol_overlayed_address (var->value_address (), + = symbol_overlayed_address (bvar.address (), var->obj_section (var->objfile ())); else - addr = var->value_address (); + addr = bvar.address (); break; case LOC_ARG: @@ -790,7 +789,7 @@ read_var_value (block_symbol var, frame_info_ptr frame) gdb_assert (lang != NULL); - return lang->read_var_value (var.symbol, var.block, frame); + return lang->read_var_value (var, frame); } /* Install default attributes for register values. */ diff --git a/gdb/language.h b/gdb/language.h index 6ee8f6160e1..ede720ef7c8 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -308,19 +308,13 @@ struct language_defn struct ui_file *stream, const value_print_options *options) const; - /* Given a symbol VAR, the corresponding block VAR_BLOCK (if any) and a - stack frame id FRAME, read the value of the variable and return (pointer - to a) struct value containing the value. - - VAR_BLOCK is needed if there's a possibility for VAR to be outside - FRAME. This is what happens if FRAME correspond to a nested function - and VAR is defined in the outer function. If callers know that VAR is - located in FRAME or is global/static, NULL can be passed as VAR_BLOCK. + /* Given a block_symbol VAR and a stack frame id FRAME, read the + value of the variable and return (pointer to a) struct value + containing the value. Throw an error if the variable cannot be found. */ - virtual struct value *read_var_value (struct symbol *var, - const struct block *var_block, + virtual struct value *read_var_value (block_symbol var, frame_info_ptr frame) const; /* Return information about whether TYPE should be passed