From patchwork Sun Nov 5 18:11: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: 79081 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 BA0F0385C421 for ; Sun, 5 Nov 2023 18:12:15 +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 46CD7385842E for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46CD7385842E 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 46CD7385842E 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=1699207892; cv=none; b=o4phtxcKzczjvEiH97zO69CA1swr2VE0bP5+gl1di7KTjk/wRqiWUku0PT3B3dFciWEDg2dQRIY+KL+jCK4o2+6eovp4Mkug6xRV5Aough/xvdnJivj4PSlq3T/oEUpI0rdnnZSi/jbw/g4X5DFyOGtfROgndB4Dry0CeG5Y8RY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207892; c=relaxed/simple; bh=2WHez4+npPZgKAWRkPcWkgoEkDxIkPZCK+LBw3T0XqE=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=R/KUPJvkYqjJ9LwG0UmiBCFxmITFwP+q+vBTVM3DfzNHylmVm3WLm/HZUWiltaUCpQ6WnKTOPzoFtyZt6KYuNtC+S5sUOyJ2eshE8kfOliaVTLMFfyzoyt9b2jPbGXm8fk+jSo/6CwbdG6fBb9rjYKd4hDmMHGiY7pKVFdevoi4= 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 zK0EqK8O3L9AgzhasqXStm; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zharqjdLqpPpmzharq74gq; Sun, 05 Nov 2023 18:11:29 +0000 X-Authority-Analysis: v=2.4 cv=MJVzJeVl c=1 sm=1 tr=0 ts=6547dad1 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=ZIlpGBiTJ1FFlgxwB0LNJRCBgF /HGq3ND+mnrmsPqAta7uum54aO5nwBDl4CWY4SVsC0kzWzaylGljWYLV6+GmzTivbOj5WbCZNpyqu uFJtHCzSQAaPck/2XtP3BZBPe; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaq-003Y66-2d for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:28 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:39 -0700 Subject: [PATCH v2 01/31] Introduce block-symbol.h MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-1-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaq-003Y66-2d 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]:51014 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: MS4xfPbnXF9TSlI/HFS7vkVVZ5B7sO/TrDNUHjyLa/Vo10nGcza78FTRC7vPeMgTjiRp/GO2ErFR6zaxE4+bpf3mskVzI1vBABr2IIPYRfCVn8cQk6ByZZF+ ktuNHStERtz9cOoU7MUJYbH0xxNoFE4K2Wdg6cHwx9yLAobvcKRSmcMMM8cjkkuBwdmx6xSMz/ApzwmWnWh6bIqCGvst/74hxOY= X-Spam-Status: No, score=-3024.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11: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: 79084 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 9B398385DC3A for ; Sun, 5 Nov 2023 18:12:31 +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 59237385843A for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 59237385843A 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 59237385843A 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=1699207894; cv=none; b=UFH9kGrb30wY8hPz0s9zxi9FPpSUQHtV3xEtG6xKcBmWlXod45JFoSU+m5lyq2h/Ncr0aY4w1bhpK+WGvfpuxKWwLL77NdcHAK9/vuTjXcfyJUkVSKrN3WiYTTKEG+MhxtBn4JpaNcJyLE4+2gg6kFEpbZrNr/tTGstxclRJ7ZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207894; c=relaxed/simple; bh=wgXgZHoRMSQM2YO9CO5eyJCfjtbf45EMnweySePIZi0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=LAYfMi5qqnw6ozRuN0O6pd1HyF5oX20KTePewb141Ht9TMHrWjxjmgIi+EVQjlS5kznQ35ghkuXPY24JRXKpIk1SyWejMqxw1RXd2BrRSYdzhU7zdiRbs6LpsbX8xtpw79Ck72GMtX8F+nHIqyuH/1v6KRO7pdEUFwP6zUl5PiI= 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 zcjTquixjKOkLzhasqKH4Z; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zharq3hbFTiJWzharqpQsg; Sun, 05 Nov 2023 18:11:29 +0000 X-Authority-Analysis: v=2.4 cv=IpgNzZzg c=1 sm=1 tr=0 ts=6547dad1 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=RF9QUljVewnCB7w2ZACAzTTxgTB3E0LYo4FJr8Piwwo=; b=XSZdxNzN0ia9j0xtNLQJ+OB1zH 0lYwxKKnBm6J8EOJAUdYrW+/BuFvcJsfqZSqfDuGluBMx7I8+K3UbEk3gBDO2/RJKJnfZ8dWNisVM ZSNkR/Lnt2Vg6lTLw2bZTqrXT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhar-003Y66-05 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:29 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:40 -0700 Subject: [PATCH v2 02/31] Add block_symbol::address MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-2-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhar-003Y66-05 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]:51014 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: MS4xfOO+jle2IjgnfhtpsE7PEgfCdFrs347UqO3OWqeJIEYaIv1ae2EUhBqYV0uW/Tucjnl2ApGilAfMcCMGSnYJqe9XxI9/ggyc89aKpJEJBpOHFj09uJi6 7eu47Q32vV204ZD8Nxa5CAZFY3yNJcFHY0BF9MCPfKPOGr7TJxx7l5+QZqdfWeTBqmbNgIIeCjIXJB0IHJVceF3rC1bPqmZ1364= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 | 3 +++ gdb/symtab.h | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/gdb/block-symbol.h b/gdb/block-symbol.h index 35bc40c1986..6cb48945dbc 100644 --- a/gdb/block-symbol.h +++ b/gdb/block-symbol.h @@ -34,6 +34,9 @@ struct block_symbol /* If SYMBOL is not NULL, then this is the block in which the symbol is defined. */ const struct block *block; + + /* Return the address of the symbol. */ + CORE_ADDR address () const; }; #endif /* GDB_BLOCK_SYMBOL_H */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 0b3ca3964b6..042f9dd4621 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1522,6 +1522,13 @@ struct symbol : public general_symbol_info, public allocate_on_obstack CORE_ADDR get_maybe_copied_address () const; }; +/* See block-symbol.h. */ +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 Nov 5 18:11: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: 79080 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 F05033856965 for ; Sun, 5 Nov 2023 18:12:02 +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 E63A03858414 for ; Sun, 5 Nov 2023 18:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E63A03858414 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 E63A03858414 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=1699207892; cv=none; b=oKfFmXBNUVLPWCCrNxrkn3D+TG46OHTWlsgKu076FPTXiZTfRtxcGDEwujSbrEiRi3CxYLSipz4Z0ilB3R9r3prAxApGDONRzv2ElCaBIa5VUszG9vinsarPsdymQ39JMornEyL5RyHS/kRGGzHB+5cxfz/fzRQF6cjEMN6YKb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207892; c=relaxed/simple; bh=so/+I7MH+qSgQskQ+J2KH1R9HorhOm66tOYg925Q/yg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=DuFuZK17hW2O6KdAgXMeAb+xsJhH6AucKJWnvbmMXEJM7wFhlqc6VwvsrtKgrbvUQgRJdXuVTuKDxChed5k8VEqM/SBq4NlJg63tb8oa2CWmafRcbwc7RS87UlJ9AhifblUD9NKArYj8xVqLaCk3n0jGk3HWEE5JRIXH5LuGglU= 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 zYWBq9QcegpyEzhasq8ILS; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zharqEMD0wasUzharqUAGK; Sun, 05 Nov 2023 18:11:29 +0000 X-Authority-Analysis: v=2.4 cv=ZpP+lv3G c=1 sm=1 tr=0 ts=6547dad1 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=uIFeOwDY5Y-UjXHJ-BMA: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=cOEFX+49qKGlOVAir/UbSQYgJWpy3jdNW1w2uZhvtjw=; b=ypIUX8EQwqzgIfJWw+X11ovLII 7rrkr5aSExq91vSZL4/4mjJ8OKsHA8R4AfA07hpOGQ7j4oQSbAW6HefTNQO2qW4pf94tH7tYsDnJM HqqlwRhEZs3vvMgtdGWMaJ5zs; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhar-003Y66-0j for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:29 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:41 -0700 Subject: [PATCH v2 03/31] Add bound_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-3-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhar-003Y66-0j 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]:51014 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: MS4xfKsFvINGFPt4x3Jx/6h53scQ8LEnjSpAb7OnI45R5Xi0bT+BzLdLJn09r/sBwRZtJqbtcl5Nop9wH+2CuNOthMd1YD/PuIDC6x4Ntrz2XBsgfBUREq9W CrddEuRVxvURRzyF+S6XdknRLy01Db9DC4hk5auIKXtGMI3HEDpQlJd56yiU6tOwte+k/9agj2H2MOO8VvDsJplv73UCuV8w1pI= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 bound_symbol type, analogous to bound_minimal_symbol. That is, it carries a symbol and an objfile and will eventually be used to relocate an address at point of use when computing a symbol's value. --- gdb/symtab.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gdb/symtab.h b/gdb/symtab.h index 042f9dd4621..a518ed83622 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1522,6 +1522,27 @@ struct symbol : public general_symbol_info, public allocate_on_obstack CORE_ADDR get_maybe_copied_address () const; }; +/* A bound symbol is a symbol that is bound to a particular objfile. + (Currently all symbols are intrinsically bound, but as part of the + objfile-splitting project, eventually they will not have this + backlink.) */ +struct bound_symbol +{ + /* The symbol. Can be NULL. */ + struct symbol *symbol; + + /* The objfile. If SYMBOL is non-NULL, then this must be as well. */ + struct objfile *objfile; + + /* Compute the address of the symbol. */ + CORE_ADDR address () const + { return symbol->value_address (); } + + /* Convenience method to access symbol contents. */ + struct symbol *operator-> () const + { return symbol; } +}; + /* See block-symbol.h. */ inline CORE_ADDR block_symbol::address () const From patchwork Sun Nov 5 18:11: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: 79078 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 BD1503856967 for ; Sun, 5 Nov 2023 18:11:46 +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 E3441385840F for ; Sun, 5 Nov 2023 18:11:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3441385840F 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 E3441385840F 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=1699207892; cv=none; b=d1zvJTlZA6FchzDzK6awiR9rEyOGh1rLgpvYpFgppVFRBWecXyPje7dbwhySVGYqhGguzHX01jRxbr+YH93/O4znO8Bmm7kQLgIXJ8WeWrZuTUx60qUeedMoKj7fF8CgUl/DLKSI6ofGJooQfV8BIsuwkeqdZgEL0i0CzktWYEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207892; c=relaxed/simple; bh=Nht1fDzR4ofSwyGQ9r2PEczWIk9PRSbi2q+HJo2/8oo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Vh/ZouItwJIteG66JoG+c9/eQ17X1v5xDIWeUQVoAiHuycgEVzSrAv5L+fJ42NEuLNp4WLly8MzvwowtGXm1nN9N2/tQS97kyr+DkdreREpXxRCVf59OaTTLdY6ES8m7JhofupLkL7y34JXMdNioPNtXpDCnoIruPY5K5rlNw4I= 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 zbh1q9neugpyEzhasq8ILU; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zharq3hbZTiJWzhasqpQsy; Sun, 05 Nov 2023 18:11:30 +0000 X-Authority-Analysis: v=2.4 cv=IpgNzZzg c=1 sm=1 tr=0 ts=6547dad2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=dLDFelPRowsqZbtQaJqJ2zpQEi qrmJDjgzrB1Zz8t0nCq7W4IDS/RDBQcLA7tYM7ycFuOJIww8Z5eBs4AsPHvypmsEaQBBFQroJmFxf PuMCuMpARGVLhUpSZrq0JX1en; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhar-003Y66-1R for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:29 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:42 -0700 Subject: [PATCH v2 04/31] Easy conversions to use block_symbol::address MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-4-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhar-003Y66-1R 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]:51014 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: MS4xfEAa3eUzkpfjeJEtTBXjXLnM4X3pUA5yhQfJDvZ6FoiOplhDgqnwplDbOWK/zIEWLyMR3k0um4Jjd2Udo+OEp9Zxs/MjeuJM0A5B/20mIVIVKqcg+hk+ OahzxL7+Ztw3cZlkrz5EpgY8NMBdNY50NLroLOVvCza28bdDWIKd8UeMxw4QaOjMon//kLzyyxINFxRVWz3JEQRN5BUYxSA8GyY= 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11: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: 79083 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 55421385696A for ; Sun, 5 Nov 2023 18:12:26 +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 AEA73385802F for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AEA73385802F 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 AEA73385802F 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=1699207894; cv=none; b=My2wFlaAa9I9nOj2oxt7eIFzrOTLVwEBcQFr5MLZdERu6M+2AA4XbWqa/bnZsN3FCxcXosWJq7jK5I3hEZWNWma+M/upsuwWHN301yRMPWDtr1WPcCQGsM2qTIf2UqYBIhbP2B7viR4kcnx4RXYg8rkwCj6BQZG2b+RzgY604eU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207894; c=relaxed/simple; bh=b/oJPlPPNmqDXXZhUAu7e2CGro7Bfjjd7wF8m3YjluY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=NGLxonkl5ATmsBxDnjMdf+/M7+Yvs0/VPSCP6sEIg8u4cYyihY/jEyjlJDpm6yjeaNSqmx+Cm0imyh2Ri0hlKJtmwHE9hRlG7dfCUpNN0Zo6Pa6G9v0eHGmDLvk5t7/4qquEv+t+E38SD/Ye1c4sdQWZ7yAXnBJfKejuc7eHlzk= 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 zcrVquk3QKOkLzhasqKH4k; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zharqaKQBOk5SzhasquvxV; Sun, 05 Nov 2023 18:11:30 +0000 X-Authority-Analysis: v=2.4 cv=E+DeGIRl c=1 sm=1 tr=0 ts=6547dad2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=futLM-dUqCR2STnt5NIA: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=tR6h2MiEmcchQQi9KE5ut3bQqvgzU6SxikisZex3Ohg=; b=uzHnyxfNHl740awK+yfSVPUvjj WFDeBrow09rqm3jLcHnineLLY/5e84LVRYmi5OePGME+g7DXJjTH8tg8brXnNxpjWyvYWXY/Kozrb mRCb3Xc8xdLAlwLpugdvJ7quM; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhar-003Y66-27 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:29 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:43 -0700 Subject: [PATCH v2 05/31] Use block_symbol::address in ada-tasks.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-5-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhar-003Y66-27 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]:51014 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: MS4xfDrouv+Mf0MWQ6Tb+3QFO3ngSTFSsMMlGjvxs6qhPMgzc1mAi7sUnLKc+sw7b9BFroMI+3n7DF6FlOPnkeKVxd4tcf92vOEfeLYyBT6Kue/cO0Kd/fq8 IqGa0LvaA1GTXprwjouu3NaTUHkJRYN/IP/3DZ7KTYt0hsdd1e/8hRlLgUW0wJV0Yf1Qt/8Snd6/4TqMFuUni3Tu61ao2BsXokk= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c index 047566e6228..e217fd4b3f4 100644 --- a/gdb/ada-tasks.c +++ b/gdb/ada-tasks.c @@ -914,7 +914,6 @@ static void ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) { struct bound_minimal_symbol msym; - struct symbol *sym; /* Return now if already set. */ if (data->known_tasks_kind != ADA_TASKS_UNKNOWN) @@ -929,12 +928,13 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) data->known_tasks_addr = msym.value_address (); /* 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) + block_symbol sym + = lookup_symbol_in_language (KNOWN_TASKS_NAME, nullptr, VAR_DOMAIN, + language_c, nullptr); + 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; @@ -975,12 +975,13 @@ ada_tasks_inferior_data_sniffer (struct ada_tasks_inferior_data *data) data->known_tasks_addr = msym.value_address (); 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) + block_symbol sym + = lookup_symbol_in_language (KNOWN_TASKS_LIST, nullptr, VAR_DOMAIN, + language_c, nullptr); + 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 Nov 5 18:11: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: 79079 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 1E548385697F for ; Sun, 5 Nov 2023 18:12:00 +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 0A0B73858422 for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A0B73858422 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 0A0B73858422 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=1699207892; cv=none; b=SW6/dDnOZgz+ScYdCmGPBpoD0qDGpTSDsFlB+KY+VPoVsK9bH/vnqq2BGFWFNfoH9q6uS3Rdg72MboZK4jVVsmHZdPdKFihwuKfV5D4Zfn7LjWHECwyahui1DiMac6pJxdxSGtC8b3HVhnS4QlK3s3yW25e4VVpRDySzQwtFNNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207892; c=relaxed/simple; bh=lWlDZU5iDzR/te3jk9ahDtCjp8Uz0sS+3hhnmvO8/CI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=XmSMxXUgHQs6xQRWnKtnVNsnIT7c/ZuhzMUS9FvX3JZguUpNiU1m0/JlVWxc+k3rj+zMaDCxWyy2RGNaGoHjtjJTHL8mF1xC30WtFPYHHZxLfFa5UAmU5iOPQHFy4Syw4QIJn+ruzq/I4yFYxhBCA7mghd7piMLqG0BJq3gV6NY= 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 zetLqe8vE6nOZzhasqqvtL; Sun, 05 Nov 2023 18:11:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhasqkEku5OjYzhasqSHqy; Sun, 05 Nov 2023 18:11:30 +0000 X-Authority-Analysis: v=2.4 cv=ep/Mc6lX c=1 sm=1 tr=0 ts=6547dad2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=xpNYTko0TvMAefNOluBftcHRqnECxBuD0nsy9BvwmGk=; b=CojkYOzrEe5/YGEfVpCosz6CnG ROsC5VadIqcPApyxiGKykm9G+x3xlQtjGM1+kowdND+3AswcSwt4rAHtd55/03qGvj1mhgLXBJ2UP 1scJkpHmytd3ZD7JfRnkFjMr7; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhar-003Y66-2m for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:29 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:44 -0700 Subject: [PATCH v2 06/31] Use block_symbol::address in printcmd.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-6-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhar-003Y66-2m 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]:51014 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: MS4xfGSqJ2ZBzNr7gYnzPhEgL+gKAM5dQyb25RD6367HBDjXAynFDYW5ddZJmMHSoVMk6U0dPnGujS1Mv89im6HZc2AsfWEwhgS6nFYKDmb0Mmm/izCnNkTN e1tBxhseIj6Qay08p1oLrqS8pkHlVdku6odUu6p1cCLKa3ODCmxBG2B5rngGzkFav4hP5NfLwd+NuuVZ1ezUgENowBMa3pNLCic= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 06cc5316eec..2dbaaf0fffe 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1637,7 +1637,6 @@ info_address_command (const char *exp, int from_tty) { struct gdbarch *gdbarch; int regno; - struct symbol *sym; struct bound_minimal_symbol msymbol; long val; struct obj_section *section; @@ -1647,8 +1646,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); + symbol *sym = bsym.symbol; if (sym == NULL) { if (is_a_field_of_this.type != NULL) @@ -1725,7 +1726,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 +1762,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 Nov 5 18:11: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: 79085 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 2B2243861819 for ; Sun, 5 Nov 2023 18:12:34 +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 095F33857BA4 for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 095F33857BA4 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 095F33857BA4 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=1699207894; cv=none; b=hQdHkeLpPlW7O72/yMiMJKyV0IH2M+F7rY4uYYZqtC4OMzZ7TxmujtgIfCP9ntbjMolUiQNh4+aqOK4bOchxW8UaSMhmQ+YVa/2RYkSqAEeJv+Qj64WU1hRBu7AqTQCDdDekW3pOvNxAR4ON0qzC6/7zccWQIXxGgGPcZ+ctVtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207894; c=relaxed/simple; bh=IICmlIFIxxs2dJhS+otQ/0lbzYvyt+o9idfRGagnuC8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=aEeYoPlI9Re7yo6YnpUFR+c+1dZ9gGsgmiddE+PNq0Ihno+EeHv4BsDwbYJ9M3CUNy8TQaGaj3Cq8DrfBtPIQvEumk/bpLzES/JtjADI3hVxvfmEIwuzKqs+HjZge9IzZE35KsnIagN47TShNLACd+cite4O9Pmq0kIT5tWIwvY= 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 zGFxqrrn1KOkLzhatqKH4n; Sun, 05 Nov 2023 18:11:31 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhasqpsIxoIDwzhasqXuPJ; Sun, 05 Nov 2023 18:11:30 +0000 X-Authority-Analysis: v=2.4 cv=TP1W9npa c=1 sm=1 tr=0 ts=6547dad2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=SYnpTgJ_xSHc7HjGPwsA: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=GxSF8SVoBfQMBMEvOdXMlSivkI87NGNdLmQ1Go/iAno=; b=Oa/WCF3yom3QnDPVu7Iu2cZLnj wCsD2gMfod2neNNa4BzBlHoV9sTDyCFOgDqVU+Wjj/QpfT5txffnNfIIUyQJnNIg9TUj7NfS/JPcy Pezwzk58o97lSFZSdv23jAvSH; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhas-003Y66-0F for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:30 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:45 -0700 Subject: [PATCH v2 07/31] Use bound_symbol::address in tracepoint.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-7-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhas-003Y66-0F 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]:51014 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: MS4xfEAa3eUzkpfjeJEtTBXjXLnM4X3pUA5yhQfJDvZ6FoiOplhDgqnwplDbOWK/zIEWLyMR3k0um4Jjd2Udo+OEp9Zxs/MjeuJM0A5B/20mIVIVKqcg+hk+ OahzxL7+Ztw3cZlkrz5EpgY8NMBdNY50NLroLOVvCza28bdDWIKd8UeMxw4QaOjMon//kLzyyxINFxRVWz3JEQRN5BUYxSA8GyY= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 bound_symbol::address. --- gdb/tracepoint.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 2c548688570..6eb40153e24 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -2484,11 +2484,15 @@ info_scope_command (const char *args_in, int from_tty) resolve_sal_pc (&sals[0]); block = block_for_pc (sals[0].pc); + struct objfile *objfile = block->objfile (); + while (block != 0) { QUIT; /* Allow user to bail out with ^C. */ for (struct symbol *sym : block_iterator_range (block)) { + bound_symbol bsym { sym, objfile }; + QUIT; /* Allow user to bail out with ^C. */ if (count == 0) gdb_printf ("Scope for %s:\n", save_args); @@ -2529,7 +2533,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 +2577,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 Nov 5 18:11: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: 79082 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 45A8D385696B for ; Sun, 5 Nov 2023 18:12:18 +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 B25863857B93 for ; Sun, 5 Nov 2023 18:11:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B25863857B93 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 B25863857B93 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=1699207893; cv=none; b=GasVPvLRXpTt6ZngB5z7RqdwKJkN3mpTMyxl/IM4ZUiTYujLmnzP4QrFryCQK076fINdqJPcNdeLWYtQ6dTx+7DWcNY5Y9Ep0UwPOkNaKqrBiAhRlvNWlDjLjmKRPWGiIkL/Msfv+hCmnolhOjTt6iAkuYQQdXbZpt/zzrlRJnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207893; c=relaxed/simple; bh=Or0zeG5wKOpsy+JzP08lBmUJ1AP+X8hzzin41rhkcs8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=en7U/RuohgadcNgbtcrFat8jxK39zO+xpT+uGEOfe5l7zjdzrYXipmmCWv0YTLBn10ONRfcr45YOQ4RIsu/CTG6tmB1plSewL9Q8t4uifUa5PfDYrwxxfauFoQ1tjiVNx7DiBSydKYQvweEzyfJDsmLWO6GR4VpbhqyeKGqeUvU= 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 zENoq6okOgpyEzhatq8ILi; Sun, 05 Nov 2023 18:11:31 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhasqaKQlOk5Szhasquvxv; Sun, 05 Nov 2023 18:11:30 +0000 X-Authority-Analysis: v=2.4 cv=E+DeGIRl c=1 sm=1 tr=0 ts=6547dad2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=TmwTfRWsdxCQHMdIpFMA: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=KWfJW6pv7UaUlG/VsbFIMa/ATDqwjfHDArx10GUT0wA=; b=DfoHoYz5csRxC8jH33wRwMvM4G 5NFQvBWVWrNQdLwQF0XOVQ0hcLX0B5VxyqtkxQWnvL1aq81prpxDXGkAsTWQ4fUFMt4SYSqvUDLhi gm4qY6WGEkqstxJxxLkIXoArl; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhas-003Y66-14 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:30 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:46 -0700 Subject: [PATCH v2 08/31] Use block_symbol::address in tracepoint.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-8-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhas-003Y66-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]:51014 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: MS4xfDrouv+Mf0MWQ6Tb+3QFO3ngSTFSsMMlGjvxs6qhPMgzc1mAi7sUnLKc+sw7b9BFroMI+3n7DF6FlOPnkeKVxd4tcf92vOEfeLYyBT6Kue/cO0Kd/fq8 IqGa0LvaA1GTXprwjouu3NaTUHkJRYN/IP/3DZ7KTYt0hsdd1e/8hRlLgUW0wJV0Yf1Qt/8Snd6/4TqMFuUni3Tu61ao2BsXokk= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 some 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 6eb40153e24..a273ea0a328 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 Nov 5 18:11: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: 79090 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 71AF3385F001 for ; Sun, 5 Nov 2023 18:12:52 +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 D99D73857712 for ; Sun, 5 Nov 2023 18:11:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D99D73857712 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 D99D73857712 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=1699207894; cv=none; b=BioAXH8L07luo2EJYkVo0MZxLrZHl7tJMyjGFzkXEQtZTf0ZrUv/TntLnMEUqBfwfg0L+J66g5372dSzuq5lBHrpBpxryfvHGyufIQhge1XDxRIHIHtlWw6ErCke3P1cVyJZaz5YBOErzb86eG7GxyLyieBl/dTTJNoouvJg5Ho= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207894; c=relaxed/simple; bh=icw4Oe5sGvy+hgQkhyJLyKsBUQdeOF7x0in+hzAdlX4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=sKr4vMw033UlsovafF5ehhJ5fax7QgKlihfbazIwgi19nMKqrHGhNRtmJD3LJl99i4gnTrQXZFvhfZcH+C5wYV340e3Jt147DHQJOOtugyxu7/Vn4laecuhr3UPQD/MjbxNTUDuRot83hz6g/NgDfqwMj4ap4Mm/lqmy9Zeowls= 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 zdpAqHBOt8Htezhauq8aBG; Sun, 05 Nov 2023 18:11:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhatqdCU779UBzhatq1fpL; Sun, 05 Nov 2023 18:11:31 +0000 X-Authority-Analysis: v=2.4 cv=YqEc+qUX c=1 sm=1 tr=0 ts=6547dad3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Vj+q8SrKZe8Fb9W3FYplNXfOU9zXKRg9/r951Qr2eew=; b=yoV7+qekxt7srICF91IkdYlfC7 /YxQunIah0ygQ+8xxjcHgwVaTgyAlkhkw7QwNDY/jqsHKUBU7BdxFWO8nv29t+MkkZW3qlKvFUhtm de7pHXCle0pOWBg0uvfHVBOOD; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhas-003Y66-2p for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:30 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:47 -0700 Subject: [PATCH v2 09/31] Use block_symbol::address in ax-gdb.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-9-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhas-003Y66-2p 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]:51014 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: MS4xfO6AeZtdEOZb8PMfMyrp5A3VWiWv5DxSFw+24cZId+yQoo0gvoODrYZRtaNv+s3NvUpFwKorNW3RtRqExQKmzpqEUL/ltsJKIbYuvsSV22qWgUQnfnZG w7BYoatCaGXLQp/tfWZbYbSgpBRt2SxNzbWJcBXjMr2uxg8WtO6asArvUzi2+rJjPzld1apzsd1JDQpb+z/BMxQy9+50DGZnAc0= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 a273ea0a328..713fb387857 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 Nov 5 18:11: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: 79089 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 E2C9C3850867 for ; Sun, 5 Nov 2023 18:12:49 +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 28DA23857717 for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28DA23857717 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 28DA23857717 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=1699207894; cv=none; b=BtXx/jAxQbeYmIrsSBnvIIW2ilasruayQD7eVRDBWsV8V5zl+MLGCKxIs/TktgEoclM7ALyySOmPvtbrzqpPSktXb3Kq64S5AD3MlT4oQBCUP+5UnYiNOFLJ7nNsowf8MRekNFREbDGVyqurGZcMUyoOaCeX7f6XbRtfW9K+vjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207894; c=relaxed/simple; bh=DPvThK9Hi8lJ3cDNv8l1mdVMIC/SwfsF7LcMAIBkbkQ=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=IgcXBZ7ZvCMFgBKGXTkpJeReqdb/6abki7ltbbiutw8qqZtJ0UDJDGgjvXVVcnkUaPDX9BXVtBOega9F9U4A0hZldfViD8BEHSU8gjVSQ2vKOCnJE/uOhphGsHvBwRx+I+QeHsrpcmaxKVzWC0MrlHNzTyK0ZDEW0Q2sYp90fS0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6006a.ext.cloudfilter.net ([10.0.30.182]) by cmsmtp with ESMTPS id zZYaqLvGIL9AgzhauqXSuD; Sun, 05 Nov 2023 18:11:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhatquCLX1wVhzhatqoHfz; Sun, 05 Nov 2023 18:11:31 +0000 X-Authority-Analysis: v=2.4 cv=ANu0s8gj c=1 sm=1 tr=0 ts=6547dad3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=EWVnquZslu0sQuzByHCWD1zaP/ AQWQEsn4VE/9J8Hgs9/2z/VO6hqpNI7pxYY3KRUjP/u6LOgfiwcTShLyf5IfkxoQYGXuG3zO14euD 549XPSj48fOojUIjKQTzyiuXT; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhat-003Y66-0L for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:31 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:48 -0700 Subject: [PATCH v2 10/31] Use block_symbol::address in linespec.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-10-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhat-003Y66-0L 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]:51014 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: MS4xfBKowoemwiWUqOYbqOeCtLITNp/ZZ+SlzjdFED5sYwg9zk4bcCCwnE9WRVWK3xVTMgdybcwe9tbg+sE+8xnnVPukQKhF+7BBnIhNiYyFsKcOcmx63bqF agT5Y3HN/MQwgKnVIzami+COoC3w6D8gA3bFuQtj0x47uD+tA7RC7xWRxPVHScPq/LlpqBnTBPNUkR+T5JtTTA6FSJ3upSFeOK8= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11: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: 79088 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 7D922385276D for ; Sun, 5 Nov 2023 18:12:47 +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 6C49A385772F for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C49A385772F 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 6C49A385772F 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=1699207896; cv=none; b=QPNNPbI2YlG+AEJ2SZexrws9OU4zip0eA4LriHKyV/9Zv21NkweS8YKtxdzzun+8I3TB8Z+iVOTREdjATQ8ouwE5NSATPb0PyoLzqN/dFxNenD5vMa9KNq9Gw6IxaOpqt4AypxvaOORVTTGBpIyz9IUjYFI0hoO31ygYKxqzGkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207896; c=relaxed/simple; bh=1MgabHZDhuRVdVLry8UW8p1YSoJxORqagpv3tV8bONY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Uce9kN587iRrDHyQr7OPBw/+4WYTmi1YoqXq51vn98jxWUUZ9gvYGUM0bKBV1YCrMpsazCUWR1/hAKtTBTJcaz07ykD8AIM5WEDVT7Z0jqiGPzP5S2X4FK61M2UzQm/Tc7mGZSsFkimCiVexMCNMk67Arn3ynZ2nPIETo1o3D5s= 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 zYhHquDy9KOkLzhauqKH53; Sun, 05 Nov 2023 18:11:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhatqwKfAGYrgzhatqJRl7; Sun, 05 Nov 2023 18:11:32 +0000 X-Authority-Analysis: v=2.4 cv=bYd47cDB c=1 sm=1 tr=0 ts=6547dad4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=qQCp4CSwvVzAQQtHYTcA: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=cts6jI5UdGURHbhasINwaHnsudAKSfy1uvSU7m4VjkA=; b=lOQKts0XHlIgNv9EAtjUGUodjp onC4MbsUm3kokf27wKhE0qGOCGctWW8yJquFl73/+pbzjzmh0qNnftPYNtjs5j1cP1hD+dCFUzQ3j cI3zN40P2LqWM+COSPlR0QFbP; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhat-003Y66-15 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:31 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:49 -0700 Subject: [PATCH v2 11/31] Use block_symbol::address in ada-lang.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-11-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhat-003Y66-15 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]:51014 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: MS4xfLObsXsLepEKDhP91HHrhn6Cu2OgnhTakCg2zrf0mMnUdcpD22whhLiqCxFJ5ZPQzNVV1wCUbkg/Q17vaFFWoZpXeHlQzpHjw7lTbQZwJDGB0v+mkLIj MwKyL7W3fQqFe35ZkWxjoWk0TX5fvZE6HGpHAP6c7OwF2oJo/xnkd973l7a5eJKCWueM5GCxDJqEjhhMD/g5VHYnCuq+vtWOz0Q= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 | 98 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 55 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 3391aaeccb3..03f405778e6 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -108,8 +108,7 @@ static void ada_add_all_symbols (std::vector &, static int is_nonfunction (const std::vector &); static void add_defn_to_vec (std::vector &, - struct symbol *, - const struct block *); + block_symbol); static int possible_user_operator_p (enum exp_opcode, struct value **); @@ -160,8 +159,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 *); @@ -336,12 +333,9 @@ struct cache_entry std::string name; /* The namespace used during the lookup. */ domain_enum domain = UNDEF_DOMAIN; - /* The symbol returned by the lookup, or NULL if no matching symbol - was found. */ - struct symbol *sym = nullptr; - /* The block where the symbol was found, or NULL if no matching - symbol was found. */ - const struct block *block = nullptr; + /* The symbol returned by the lookup. The 'symbol' field will be + NULL if no matching symbol was found. */ + block_symbol sym = {}; }; /* The symbol cache uses this type when searching. */ @@ -4685,8 +4679,7 @@ ada_clear_symbol_cache (program_space *pspace) SYM. Same principle for BLOCK if not NULL. */ static int -lookup_cached_symbol (const char *name, domain_enum domain, - struct symbol **sym, const struct block **block) +lookup_cached_symbol (const char *name, domain_enum domain, block_symbol *sym) { htab_t tab = get_ada_pspace_data (current_program_space); cache_entry_search search; @@ -4699,18 +4692,17 @@ lookup_cached_symbol (const char *name, domain_enum domain, return 0; if (sym != nullptr) *sym = e->sym; - if (block != nullptr) - *block = e->block; return 1; } -/* Assuming that (SYM, BLOCK) is the result of the lookup of NAME +/* Assuming that SYM is the result of the lookup of NAME in domain DOMAIN, save this result in our symbol cache. */ static void -cache_symbol (const char *name, domain_enum domain, struct symbol *sym, - const struct block *block) +cache_symbol (const char *name, domain_enum domain, block_symbol bsym) { + symbol *sym = bsym.symbol; + /* Symbols for builtin types don't have a block. For now don't cache such symbols. */ if (sym != NULL && !sym->is_objfile_owned ()) @@ -4724,7 +4716,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, { const blockvector &bv = *sym->symtab ()->compunit ()->blockvector (); - if (bv.global_block () != block && bv.static_block () != block) + if (bv.global_block () != bsym.block && bv.static_block () != bsym.block) return; } @@ -4739,8 +4731,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym, cache_entry *e = new cache_entry; e->name = name; e->domain = domain; - e->sym = sym; - e->block = block; + e->sym = bsym; *slot = e; } @@ -4768,13 +4759,12 @@ static struct symbol * standard_lookup (const char *name, const struct block *block, domain_enum domain) { - /* Initialize it just to avoid a GCC false warning. */ - struct block_symbol sym = {}; + struct block_symbol sym; - if (lookup_cached_symbol (name, domain, &sym.symbol, NULL)) + if (lookup_cached_symbol (name, domain, &sym)) return sym.symbol; ada_lookup_encoded_symbol (name, block, domain, &sym); - cache_symbol (name, domain, sym.symbol, sym.block); + cache_symbol (name, domain, sym); return sym.symbol; } @@ -4814,12 +4804,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 +4846,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: @@ -4866,8 +4859,7 @@ lesseq_defined_than (struct symbol *sym0, struct symbol *sym1) static void add_defn_to_vec (std::vector &result, - struct symbol *sym, - const struct block *block) + block_symbol info) { /* Do not try to complete stub types, as the debugger is probably already scanning all symbols matching a certain name at the @@ -4880,19 +4872,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); } @@ -5382,13 +5370,12 @@ struct match_data bool match_data::operator() (struct block_symbol *bsym) { - const struct block *block = bsym->block; struct symbol *sym = bsym->symbol; if (sym == NULL) { if (!found_sym && arg_sym != NULL) - add_defn_to_vec (*resultp, arg_sym, block); + add_defn_to_vec (*resultp, { arg_sym, bsym->block }); found_sym = false; arg_sym = NULL; } @@ -5401,7 +5388,7 @@ match_data::operator() (struct block_symbol *bsym) else { found_sym = true; - add_defn_to_vec (*resultp, sym, block); + add_defn_to_vec (*resultp, *bsym); } } return true; @@ -5651,8 +5638,6 @@ ada_add_all_symbols (std::vector &result, int full_search, int *made_global_lookup_p) { - struct symbol *sym; - if (made_global_lookup_p) *made_global_lookup_p = 0; @@ -5687,11 +5672,11 @@ ada_add_all_symbols (std::vector &result, already performed this search before. If we have, then return the same result. */ - if (lookup_cached_symbol (ada_lookup_name (lookup_name), - domain, &sym, &block)) + block_symbol sym; + if (lookup_cached_symbol (ada_lookup_name (lookup_name), domain, &sym)) { - if (sym != NULL) - add_defn_to_vec (result, sym, block); + if (sym.symbol != nullptr) + add_defn_to_vec (result, sym); return; } @@ -5739,11 +5724,10 @@ ada_lookup_symbol_list_worker (const lookup_name_info &lookup_name, remove_extra_symbols (results); if (results.empty () && full_search && syms_from_global_search) - cache_symbol (ada_lookup_name (lookup_name), domain, NULL, NULL); + cache_symbol (ada_lookup_name (lookup_name), domain, {}); if (results.size () == 1 && full_search && syms_from_global_search) - cache_symbol (ada_lookup_name (lookup_name), domain, - results[0].symbol, results[0].block); + cache_symbol (ada_lookup_name (lookup_name), domain, results[0]); remove_irrelevant_renamings (&results, block); return results; @@ -6087,7 +6071,7 @@ ada_add_block_symbols (std::vector &result, else { found_sym = true; - add_defn_to_vec (result, sym, block); + add_defn_to_vec (result, { sym, block }); } } } @@ -6100,7 +6084,7 @@ ada_add_block_symbols (std::vector &result, if (!found_sym && arg_sym != NULL) { - add_defn_to_vec (result, arg_sym, block); + add_defn_to_vec (result, { arg_sym, block }); } if (!lookup_name.ada ().wild_match_p ()) @@ -6136,7 +6120,7 @@ ada_add_block_symbols (std::vector &result, else { found_sym = true; - add_defn_to_vec (result, sym, block); + add_defn_to_vec (result, { sym, block }); } } } @@ -6147,7 +6131,7 @@ ada_add_block_symbols (std::vector &result, They aren't parameters, right? */ if (!found_sym && arg_sym != NULL) { - add_defn_to_vec (result, arg_sym, block); + add_defn_to_vec (result, { arg_sym, block }); } } } @@ -12999,8 +12983,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 +13061,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 Nov 5 18:11: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: 79086 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 C6EB73861859 for ; Sun, 5 Nov 2023 18:12:36 +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 960E73857355 for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 960E73857355 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 960E73857355 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=1699207895; cv=none; b=nsNyqe45jLFaJodj5/LtpqA6LNoJphDb1uGaK8QRKSXuuNn7m/S3cvjO4EHCwK1b6+LqMN333kf6TUU3uiLp7G4ZSVdJAqVP1VVCvkSJEP76kYySj9tQOxnlpIxXykd/MJygmxzwAqCnPwl9ejbSrxVZfb78eA4T6ykq6cCoZxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207895; c=relaxed/simple; bh=wknFCN30dSGT7KRKccQ2kBFI+jyGK4Kwst2cJiFUZ20=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=VTEL1BjKmyGeROf+auYksRWv/BRTfexR4XOPiPu7KH8sCIpkD+y0OfAUyz9KHtw/ZlUmWgnBYcdSXxolnRXcpKpeIr3Xmh58UPCkp7U/P5ApcF2m9pKQfsHtjMTA4IQ7JLnNwQ5hCK/g5IFOsgeev+kSlqrJBMfPUPSFINC9uM0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id zgfTqHWgx8Htezhauq8aBU; Sun, 05 Nov 2023 18:11:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhatqJ1pwNUwRzhauqng4x; Sun, 05 Nov 2023 18:11:32 +0000 X-Authority-Analysis: v=2.4 cv=I852+fsg c=1 sm=1 tr=0 ts=6547dad4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=HylTIHBeEYoZfRM5qxoXUMxO9l+IqcmNRS++prCMWuc=; b=dW6nbtxoRebAlVotXLl+J3jH9y BT/YbmmCBtW4tnmQVTCbPPPsFjkXbvMgaZUBV5SommZ7R417KzLHQiYip/dIhxWl0wALAAaJPkkLp e0cqiC3LDZKB9dkNfWZZifkkm; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhat-003Y66-1k for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:31 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:50 -0700 Subject: [PATCH v2 12/31] Use bound_symbol::address in symmisc.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-12-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhat-003Y66-1k 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]:51014 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: MS4xfH4aX97Kp2t2jUZaRt6rp1eXRgRYWI3Zopr7DpcrBIY11zXA3XiApaXqykDpjBSj43eqgK0qHUoJWdCa/XxtuxAh3wTvKKriKtoSOw0t/16LvhXRiPwd 0FMshZ86RblRatLX/GICdnKwi5QMoySnLoigZLgIYSMiaW+L6CdfRv3rKFK6CPCkA4nkM4lZi7Jscf3Ur1Th8+FHOatj7aaG6x4= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 bound_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..e84dd2ce049 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, bound_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); + bound_symbol bsym { sym, objfile }; + 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, bound_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 Nov 5 18:11: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: 79087 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 D01B338515D6 for ; Sun, 5 Nov 2023 18:12:39 +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 891073857341 for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 891073857341 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 891073857341 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=1699207895; cv=none; b=VOdU5bi1SzzQXSb/0rngavAB1JbBU3aO5IJi0SK7HIy2T2bwaMD/QSZt6gNlkKg6UUrIc0FtzEpGWdIKsw9Uv1oR2t5lxUxu41BjcX6hTIFt/9eBbxbE07eJWjUQOm6SQ2tI72U4hqam/2fyvITCYZSZEoEepYirIx9OmeZA+gg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207895; c=relaxed/simple; bh=g9JbqdJ/76LdF+mVHrVA4nc9eSrhxftb/3IpLH+8MHg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=DCE1DzL61rL7QhvyPZTXX5wqO/1/DgW3Ld7RbbCRveV83WBwoYiNDxoEd+8MEr7NhpQLxy3M+SV12BFyNr3VAV5PuRCEbhMi0mMWCuMzcTQpvJUpcxf//lnBtOKxHBIA22X5geIhv9emX8Yko7OK5vWSv4DzKZ2v5UxHZ5usT+0= 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 zZCvqGdMw8Htezhauq8aBS; Sun, 05 Nov 2023 18:11:32 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhatqdCUn79UBzhauq1fpy; Sun, 05 Nov 2023 18:11:32 +0000 X-Authority-Analysis: v=2.4 cv=YqEc+qUX c=1 sm=1 tr=0 ts=6547dad4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=eTi4H+ihrU/32lBq/ltARM4zaT fTK+aqS5NpXqCSxkGGZLJvdzFsB+0lCF9pywZrCrnnG5TTDJO94R9bFcdWvnMWD34TUo/Tlhqee+h 03GQnzMX4Cjdu7i5tMEZKaY5l; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhat-003Y66-2P for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:31 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:51 -0700 Subject: [PATCH v2 13/31] Introduce read_var_value overload MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-13-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhat-003Y66-2P 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]:51014 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: MS4xfH4aX97Kp2t2jUZaRt6rp1eXRgRYWI3Zopr7DpcrBIY11zXA3XiApaXqykDpjBSj43eqgK0qHUoJWdCa/XxtuxAh3wTvKKriKtoSOw0t/16LvhXRiPwd 0FMshZ86RblRatLX/GICdnKwi5QMoySnLoigZLgIYSMiaW+L6CdfRv3rKFK6CPCkA4nkM4lZi7Jscf3Ur1Th8+FHOatj7aaG6x4= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79098 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 5757338768A5 for ; Sun, 5 Nov 2023 18:13:33 +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 42FBF3856DD0 for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 42FBF3856DD0 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 42FBF3856DD0 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=1699207898; cv=none; b=qOkltMjkTrJEQvRYU7xNKsImP7Fj27haH1Cwjf79w2R0rLQuw47uBKgdez8IHzynwKST1UaDamVshr4DJ9YDN3nusDT7Vp1mOg5v+vQo9/sqVZOFCDAtRYtPBwrJYMISNX8OduIhHeFImjNPCqub9qoBI73kGUsayvVeZQSuKGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207898; c=relaxed/simple; bh=lgQGEoz7NvxqFxhuDrEKagNUa8EjuWeyg9g3+mN4MsA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=nYoypwczOjeHQf0f8lDv5AfmrKTxm0kihvKn9s1x1F0mB8MwkL3pnx3yKbnNklG/3Kj09oeakOEdqXEicZUoU6iJenlPPFUl1vA7nEB2pBp/1kOys6YwxBsMBJ6ndFs5YvFn74ep6D2jdztEy92Z22wmTb1REeFS9vE/yVh9eTM= 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 zFJrqJR5cL9AgzhavqXSuM; Sun, 05 Nov 2023 18:11:33 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhauqGXzgI9guzhauqa274; Sun, 05 Nov 2023 18:11:32 +0000 X-Authority-Analysis: v=2.4 cv=Ds1FRUz+ c=1 sm=1 tr=0 ts=6547dad4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=saZ4Kv/4jx7yuz4+zdVKJS7Gl38iHYM66aU1JAY6GRk=; b=IbmHGXoZAiFTkEoY8b89u3hqmL mDeVJk3CxDsoszH8p7IwyGPu2gn+97ePohBP6yBDaoBe5ooxj3zT8BcNL6Xgq53z9t4LWyn0yn7sx gUT72BUqK3x46Sov4CFZfsPjh; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhat-003Y66-34 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:31 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:52 -0700 Subject: [PATCH v2 14/31] Use read_var_value in gdb/compile MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-14-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhat-003Y66-34 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]:51014 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: MS4xfLRHwrpiWyRaRxJipxcMoV5vCcAePUKu+5ZRYRuDISnFjrAMFWwqxA70XC0xQM3nUzVp4JpqFrwR9P4mKnwbTj7tQ+5ensQbn3oEHBJ0KJOiCtxlP/QH xTNbrWlD+GOMMhaFqCtsLVBLw81gpi0hDPJHU7PADnDPp6JzjCG1KMwUeJ4qJ+ub5zstXuMCslG7aOd7c+UjSfGANeXzD4AXp1s= 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_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 a518ed83622..34ce10f5011 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 Nov 5 18:11:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79099 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 04D703861887 for ; Sun, 5 Nov 2023 18:13:35 +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 291293857029 for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 291293857029 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 291293857029 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=1699207898; cv=none; b=bhIW0zdXbAmvlaNsZ0otrLcoBSjSqQhGAFuId2f25tn7kQeTRXwr7lEU4p2Vad7+vwiElwcuy/85mzd0rv8+SgoG6VJhHKD36N6Ap0M9dUjDXnJCh6lUOq3aPbGV/lC14bGisDb7X9npY/XDKHWTnhK7p9hFaLL3ZyFJ/NFFCX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207898; c=relaxed/simple; bh=PP7hv5ITcg+w6HtKR0wBybZbmw83f1GfNRrgUUriCJo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=tMqy2lt/V6jhGzIulNgC/rLvxDZebyXCwkR/XnkPhBASrYu6pdBIN1dl6fvt/wYuusI6c1pjiuVJY66VdKKg/zdhF0a6zazO8cHcUvR0iLSsWDIKTvRKpCaersOihNWcuBe6qS0lO2dInOYC47icgGa4WmqklMF8+72LJQZFet4= 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 zYeiqGZVH8Htezhavq8aBc; Sun, 05 Nov 2023 18:11:33 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhauqjGRsruMPzhauq56pI; Sun, 05 Nov 2023 18:11:32 +0000 X-Authority-Analysis: v=2.4 cv=ZNHEJF3b c=1 sm=1 tr=0 ts=6547dad4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Mf9NFNu9v2OQcIR0dsubRWYNa2qEspZxtg0dpwMGNbc=; b=G0dxVOzY2S2J2gmVaCTLc+slz7 OJ3345zj8CUei/yR3A9P3Z5zpTejLug1KjnG+G45lKVHtowl1Anrq4pT7ql2cRW7VHF/7QbG61rCk qAAVMXGEojs+b4SqO2/nDHaVf; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhau-003Y66-0T for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:32 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:53 -0700 Subject: [PATCH v2 15/31] Return a block_symbol from find_pc_sect_function MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-15-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhau-003Y66-0T 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]:51014 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: MS4xfB1ngTTRvNs24X9iOJ5Ol4I11zWPqgD8IcY98P7KPsen2AEF5sNIOQGZM7P960XBgglwe7eP7L8qPDIfP7kNGFJ+GpYFjcdBgZLEWeNT7Ex9jR5dY+1H MRTR0F3F/6h//tZ7/RTv73DrHTfVuEfZOdjle4fxma0GaWuf7h/bqmpQ77TZoSmhfpyUwWkoLKmo4tqgQn0RqylUMtngWKdn39c= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 fe09dbcbeee..52ce63afade 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -12862,7 +12862,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 2dbaaf0fffe..57a7af67ffe 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 34ce10f5011..059f7cfe8a7 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -2171,13 +2171,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 713fb387857..2d65f7c7920 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. */ @@ -3623,7 +3623,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 Nov 5 18:11:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79091 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 8D83C386183C for ; Sun, 5 Nov 2023 18:12:57 +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 D78383857006 for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D78383857006 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 D78383857006 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=1699207896; cv=none; b=HcxxBVENF22eQoDWZn40a3QK1nXRy0V4iMNtCE9vVoPqvEZ7lEqvbTVcHuk2rP14QMJyGW68frIAvwrs+oFbO5wznvNYtLlL+ryW6O6d3IXloJZhdWC2t8URyNkUyiLw0PlmFsRVZKqKXnSp6WekvQrZu1mb7IP8KwkOvkzQ3jM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207896; c=relaxed/simple; bh=A7WsxTCBGkWKhymRUz7Alklv2Ufg9ul/oXNiu/KFPPY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=CEO17x/fSz4DRZSkjdRefizzfH5f5l48DkAmAbnCONMUPt9a1dhCDV4Mg2TVLq+hYXQwczexp1aKXfWrxm/4hLXWqnLM3Sh0BourZJ/UQqEgkyVvi6Cj1Q5x8ZWa0NmcUwmbtIpeZmyjSKJeSTEB9m1BMxHfEi+H2VL9z2q2yH4= 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 zYArqaZYHWcCIzhavqQWwG; Sun, 05 Nov 2023 18:11:33 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhauqkL2gF1O4zhavqlfma; Sun, 05 Nov 2023 18:11:33 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=6547dad5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=m45OLx6XZNNlJyjot2yvwBBEYJ 9rx5lldhHK1wCoNBfvldWOQ9vX4pADOB1w3D89CCkTzSLFofFmc9vZV+TP9uck5fxEWgfUiGXdb7E Ycj56H+IorcW7Nmco+EyUEYu2; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhau-003Y66-19 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:32 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:54 -0700 Subject: [PATCH v2 16/31] Use read_var_value overload in finish_command_fsm MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-16-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhau-003Y66-19 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]:51014 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: MS4xfBfdANfYQu1MW2ka8OpMZDwlb65kHwXeXlLU2Y+uxrmssMDFacHIpfx17DnnLEpQsyK5b3EFsULpdjuqcKi0W42ASPPOlACjFTLQAJ7u1RNQrW2br+ve KHDVBdkGWmj5JqW1LbQuCutTHESeMujgyHmB8KgMg/ed4IAhUaUlkp1oMVjGPCL8uaF87pWpkRtjSZUg61jh7zG3j2Fg7m+pmfs= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79095 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 AC5923850867 for ; Sun, 5 Nov 2023 18:13:14 +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 EB511385701B for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB511385701B 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 EB511385701B 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=1699207898; cv=none; b=hGQIYdC93M8+powtOymQ5TuXtvY2U0COXD47tJd0vjS8mZWttNNxcRgO3QEGz8oGMV7wSdOU8c4hEjGRWrG3Y4vD83KCBJWI0S2ATanteG6tPjU2HbYHIgWg6E71LJGGM8dLHVnggeOwPzutsw78kdGjZPtJDdR7tqeq+/g2Ko0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207898; c=relaxed/simple; bh=A2JdQSWnRPUpseoXB2ufXNcgmgV52eXNts0TEIEqMcI=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=ELTnMrVjjt6pwIRNHIYdgdghSJFErIbZXMmCKpC3oQRheFmW7vEAOehL6BujFhv47TyJA4s6lj+hb0xf3VGgJlVzM+plAio+V0UCF3o5JF1mZGRXCAyl1g6fokHVKXHoUJDzWfiWGVvue6rAWdyXapO6w6jEKrUi9aiotHqZRQo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id yyJmq44ODgpyEzhavq8IMC; Sun, 05 Nov 2023 18:11:33 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhauqJ1qmNUwRzhavqng5d; Sun, 05 Nov 2023 18:11:33 +0000 X-Authority-Analysis: v=2.4 cv=I852+fsg c=1 sm=1 tr=0 ts=6547dad5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Q7AjHwhe4Nyv+wDXHu4EsPW407 KCdqtpzQxHYaZNwk7PIPx7b04OVBOWVFUkfXrt/2Q+smgYtxbS4NK7smHtL6MT6NjmbVo+2LWsAXP K6zJZTBwOhgHxbqZBCp/aK6B6; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhau-003Y66-1m for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:32 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:55 -0700 Subject: [PATCH v2 17/31] Use block_symbol in overload-handling code MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-17-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhau-003Y66-1m 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]:51014 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: MS4xfDdkShbImkZvnmL81uIqmw7KiJ4bJlEaIJ+26HjKA+MMCMhTPKAgZ42QByzJ3Detf3ZuJgnFRA3TcUQ9egQo32NQ68/OF7hM67pfhGC5DFakbSNxEjAc 37i2GDLE5UPSsXurmXaJxgiwCrIUYC2WwjVp5Hpm+u7iTctKNqwbrthBiUPN05lqT25JRio9GLnLAE9TiGRQZ9LDir8bjiWiLW0= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:11:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79093 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 4B3CC38618B7 for ; Sun, 5 Nov 2023 18:13:08 +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 C8DE5385735A for ; Sun, 5 Nov 2023 18:11:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C8DE5385735A 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 C8DE5385735A 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=1699207895; cv=none; b=OxW90AYHyp0ORj8loBWg4QUcc7tnTZQfA+i2VivMeDaNWDnYdv4ChEYw2Dt/41ZWBqW0WHCuRjH5pAQdIhecefaCewKwdDFvcNHiTFkf93SQoCYXhgVA6KHH/gW2Pe9ln87I3N/OUMKz9V1VZQit5j05ETNO9dp97L5kexIXVVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207895; c=relaxed/simple; bh=hk8dsyb7/5eFZjI99rFo4wMF+ghyAlvsj0hBGgY6bHo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=U+ZFSSTkZGdevw0RMkhrnq2HlWX33BYfkUS+EBKSd6W0mqzYaPUhv2dq+ci/6IbQYCjMOn8j36IksMje4kxS3cl9etCGNNc297ODlGkMIph/w7vtMU7o/4AdTV5rb05dBz3U7yyb2xjuLS5nAvuRK/uC3zWFQbZdUW7+JKmE6zQ= 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 zdgIqA2txgpyEzhavq8IME; Sun, 05 Nov 2023 18:11:33 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavqkL3CF1O4zhavqlfn0; Sun, 05 Nov 2023 18:11:33 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=6547dad5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=cQdWg+92jPpRx25wXvYWQnapYI4V1SYBzuB3Bx7S/kg=; b=U3GYzLnOgvjQXOdMcIk35iA473 A2/2tPVAB9oT0DhBnVaqsUfYEFQoe9LXfTuehbBF9feIyk22nKk7JFVJMKRgHdTnRe47D8/6spFbs lftjIHXbBKH3scUwJ4Gz3+6uG; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhau-003Y66-2V for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:32 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:56 -0700 Subject: [PATCH v2 18/31] Change evaluate_var_value to accept a block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-18-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhau-003Y66-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]:51014 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: MS4xfBfdANfYQu1MW2ka8OpMZDwlb65kHwXeXlLU2Y+uxrmssMDFacHIpfx17DnnLEpQsyK5b3EFsULpdjuqcKi0W42ASPPOlACjFTLQAJ7u1RNQrW2br+ve KHDVBdkGWmj5JqW1LbQuCutTHESeMujgyHmB8KgMg/ed4IAhUaUlkp1oMVjGPCL8uaF87pWpkRtjSZUg61jh7zG3j2Fg7m+pmfs= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 03f405778e6..ef7864b6770 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10813,9 +10813,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 Nov 5 18:11:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79100 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 3ACE838323EC for ; Sun, 5 Nov 2023 18:13:39 +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 AB64A3856DDA for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB64A3856DDA 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 AB64A3856DDA 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=1699207899; cv=none; b=RgXFrZFW4SSVLN1jdZcv+01kg7wR1TRlHhoZU+PVRm7wR+eu+jTrzZHX1NdGm/T0vYE0NM8HTVZn+Roa7aJBG5fESnQTW8Cc0OqyNFCzeXkQX0/orQoJ9afC4FS36ZxTAJYm7ta/8X4phunbLuTLUnOc3cQNuMZu+NFBVPQcveg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207899; c=relaxed/simple; bh=ULkYEtAmZDzvzoGwWfugzIiVnL5w/MpQu1lt09UxkO0=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rwm6NAGANrWo+vsbH3dE1qxGUZ37nkaioK3mh+jGL6rahFnnK855DFoGaNjn45mLst6xWZpBVWUu9xsfTQOR+Ntmd4jyTSoduE0y39JvkvT9tJnA7xnNYsdDynvjirziPPN+Q0StHiHLKdKPutxmF8WpsuMsBG4TmOWKCtwIhng= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6006a.ext.cloudfilter.net ([10.0.30.182]) by cmsmtp with ESMTPS id zgpCqHXl68Htezhawq8aBg; Sun, 05 Nov 2023 18:11:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavquCMq1wVhzhavqoHh3; Sun, 05 Nov 2023 18:11:33 +0000 X-Authority-Analysis: v=2.4 cv=ANu0s8gj c=1 sm=1 tr=0 ts=6547dad5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=PbwNTN9Lly9O4VCnDwuO1/mj/Gb2LF7s1Pwog6xkFhQ=; b=kkICr5MHg8qsUIh2tAu6OqYzKq JNBYM6ekV21WWSY49VBMiLXXn93eYqVbcxcDl7eUHB8qoY/c5z7IK15X9+8npIcoSj4dYE2MPSX56 uv1hB3HA023L7THLoxMCcnDj4; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhau-003Y66-3B for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:57 -0700 Subject: [PATCH v2 19/31] Change value_of_variable to take a block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-19-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhau-003Y66-3B 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]:51014 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: MS4xfBjI+SbQQW7QsbynRibF/SmxhsD7DChkOw1f3wZaVUCi4KTV7z7I7FFJBll0fJPCaSBIEKSMJJ3fww/PLAeDXfq8AOa34Glz5JgFV6ZIyQvd4ylXc5mo MsBcELX6zJy35yjmxNbWyKe7mxGzOs0vUQDSITqj+qFEw77KgplrW7diUJ5B3gI/UepY/++QXnwgqfIpSrj494Rz8BmT6NKlgEQ= 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, T_SCC_BODY_TEXT_LINE 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 ef7864b6770..6beadad568a 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -11374,7 +11374,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 Nov 5 18:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79103 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 C0C4E385C414 for ; Sun, 5 Nov 2023 18:13:52 +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 173213856943 for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 173213856943 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 173213856943 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=1699207900; cv=none; b=YVjusQNMfzwglhz2YFGas50MFtDwsGAFlLczOmX5May/Wv4mxJiD6YxXMM236ymJ9vyRC28G6qFANAY48G6gYqjvVoZXEIy4EwoA8vIC699mjLn9yfKhXY72910+CKDRSpAovJ/MhQUvR0M/pKw7uzmtu7s67v3qN/pKWG2xHuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207900; c=relaxed/simple; bh=vkdTZBomzVNQwPtpcPKkjZ0d8gDLOXPq9h8saPwwjE4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=an+J3yAiaP+IwuQQm4X/IwM9Yc8t5cfkw1TShI+ah92ArDMiewEnO9nRsn6HFlgAKvS+6PtT+iQMY3ugTgEIWCqj6ERsQPaKBTpUdcwCWTEm9HxPmHZlyIytp05SSKN2sbmHXd6SpjY7ddXpupI4aqF8A596hnDPk581gcCJjA0= 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 zY39qGVO38Htezhawq8aBj; Sun, 05 Nov 2023 18:11:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavqkL3RF1O4zhavqlfnB; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=CcwbWZnl c=1 sm=1 tr=0 ts=6547dad6 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=5OBvBmo47+acEDFxMY9Xq3m5T7Iif1oYPYsh4vFixMY=; b=xZ08U3dIycGruIk9VVQOobOVzP +mXewjVA3HNiJar3pxgCJ61Pjb3g/KOcNpjeg9T/AnMQuzFnmAcrzwWnW362KFkiipMVChCT/h7Mj WqRyMrwYJWQpbu2XUoXEASxi3; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhav-003Y66-0c for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:58 -0700 Subject: [PATCH v2 20/31] Return a block_symbol from get_frame_function MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-20-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhav-003Y66-0c 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]:51014 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: MS4xfEidLy//I2LHt2aprT+9QkF3/XlUJPHZzxkKSict5cxJEVwW6oTlDxciP8gsoQZ51L6Q2qfSMvCWHTc+h8wZd18Zz9LNTYAmgPGhCDIDmoNuH9LWK0Kc 2TbxGBBRUiCHNcCeWxUrzo3I+aZrZhZmdHWUL1RBKrdpEJUQdLs5uxPNEpmALX3qGzouxK/yeIX8IrRTl2haLo5qmTkHD6u1eSA= 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, T_SCC_BODY_TEXT_LINE 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 52ce63afade..e9dd942da4e 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 39dcefa87b8..a2ea7301394 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; @@ -2510,7 +2510,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) @@ -2692,7 +2692,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 Nov 5 18:11:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79092 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 979D0385F022 for ; Sun, 5 Nov 2023 18:13:05 +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 6B7FC3856DD5 for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B7FC3856DD5 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 6B7FC3856DD5 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=1699207896; cv=none; b=ugB+vtAAVnQ3I+UIFERUV0Zvl+5HdTzbXGSwHJtrs/KBztzvcbhoRh2AfcKlk6A3LrPHYJHyXDn/sYewwC4D/Jq1EfSxLbwTr29gHN79pWnLJpHWxe7HQUmFiZHBF+3mijTHXE/r9JvgGD178GIv7+wl9EaShw+yQoUDSPke3MI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207896; c=relaxed/simple; bh=wuOSoAgE9uvBXMcJPkG0oUF2px9EDqP4jtc9t4+KMxo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Xp/DnXa2Mm+Im7DDa0wTQNGFR1uYjN68i5r7rEmDwFyziGjxB3SS9uut6DQrj841NYwoCCYURblUrAJbnb8TtwoQz9fO8JSS/eDE3JOsQhk9LJd9zh6CXU/dxaq/MWQy4FY8Zf/zaRjT/5WM5Vp/W9Utv0MtAJmDO/HM6CD1O5A= 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 zfMkqbUOoWcCIzhawqQWwO; Sun, 05 Nov 2023 18:11:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavqkEnD5OjYzhawqSHt7; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=ep/Mc6lX c=1 sm=1 tr=0 ts=6547dad6 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=ns/4Uv+2DoPHPTEExCyHn855+J0hzG2Nd+3VNvIC9nc=; b=TP2JVCXF0CYHf4M/UV/SRQLDhE 0qd3+a9hVSvz6Z3XYdgnYAE6N5v9NZmQeO+b51L7hr9zEC5zEEUqsACcHokNdIClpq2fCphcRqItq AUPJDzLjApRJVppoeRR/E0Tmw; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhav-003Y66-1G for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:11:59 -0700 Subject: [PATCH v2 21/31] Use read_var_value overload in return_command MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-21-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhav-003Y66-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]:51014 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: MS4xfI65lgmV4ccDMepf90gnyzF/aH926R11kzkTOzel5r6Pi1du38VJ2mDCRw4XVKpQaky6Uz8m8En6qDXLbdX14nA6rQuUF/dciO7Y2WN+EzK4l9QWGqWK DDgfUtTqTjKiXKoGnNsRO9yaD2IyeA3F2P4FKHlXQESw5KREFkCACYS/mtWSEB4h9hhR1Kbnry1cBcVaA3PWGL+pie0GTX9NvLs= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 a2ea7301394..f744baad61a 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2692,7 +2692,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) @@ -2733,7 +2734,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 Nov 5 18:12:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79094 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 1242F385E823 for ; Sun, 5 Nov 2023 18:13:14 +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 C36063856DEA for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C36063856DEA 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 C36063856DEA 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=1699207898; cv=none; b=v5ao1qGqb0n1bf8ZMdwTWcwJbh7oXg6grjS8sP1810bDwGCKNOyTvb6cheuheyrvm8QhRv5jV0y2qigUqkHYp5f/ihIAY7ZIOkTKw7o24sgjXa7zLckhxFiNY9+U0qMT7mvfxWnC/ZBZnXK7SamYXmu/LgJeNyhqrJGrCtdJyO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207898; c=relaxed/simple; bh=7hZ/4ugcP1f6wBDb6LgX+/mrKNm8hSBwx+QkllCyqiA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=M744BzmNLmSJ3Uq0ArSHHNem4uwc3pZXJCzUbrQIBeh3EE9moVV6Emb6PdK03rJ9HV7UfRdaJNu7NzFNtq8ZBM/lZNPCaZzqYRQ3pCfOmPp+KSl5pwBMmiisvUJg/p54qh/+00PgM7Wb+JO9UVon/gHbA5uLC7A2QMwPz6Ozk4c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5003a.ext.cloudfilter.net ([10.0.29.159]) by cmsmtp with ESMTPS id zZiZq922cjtZ3zhayqO07s; Sun, 05 Nov 2023 18:11:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhavqMJO7Zs8Wzhawq2vMb; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=YKGMdDKx c=1 sm=1 tr=0 ts=6547dad6 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=vgVeH0xnEHuLJZZVUvjnfcH+I9 FycnjJW0+bT3J7t8nGZa1Yk4djc0TKqmeyHcZHISRF1+BMxzOAMMRmGQz/Dv+hjEln2+Jo0uDWPSq HPFUxJN3JIqnhrbngSrAHx03k; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhav-003Y66-1u for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:00 -0700 Subject: [PATCH v2 22/31] Use read_var_value overload in py-finishbreakpoint.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-22-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhav-003Y66-1u 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]:51014 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: MS4xfFVOuykq8AnssoBLjV7rKQUDYu1wT8IY1ciGupaH7B6j/5ufYGFeEEItP0dLD4bmhfcRUIQNQqinZUX0pLD/1BCIYmTx+1NZc8we7mlcMTRg73ajECWt ZTonPxoX/twgwZQNOUkKBPMCghL2lj4sqv0S10XiO87uMAsqQTnQh3+mqthwXrQo9dEzFSbVhhs0kVqp9+AUBM3+EZbS5tnuj3Y= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79096 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 8A9993855594 for ; Sun, 5 Nov 2023 18:13:25 +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 BEBF63856DE8 for ; Sun, 5 Nov 2023 18:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BEBF63856DE8 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 BEBF63856DE8 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=1699207897; cv=none; b=IywkaOR7L0FE2T7snuvuclU+w74H9PJ2lIJDTc9AI5ew1OStEiGMbrz0qz/SfBddijxknPvrIkIEIiPVJJbGR958VMmpIwwFVHogvhFvxIDirBO4CyHhYxQePUlKVgbZveV/sDNcWWILbsDcuMVyz1ntdVoeexDKyhGzP7437YI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207897; c=relaxed/simple; bh=oK5wjt6011Fry+maRtnGYLCCF70nlmXngDeW8br1QZc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=PrwRXgQq0FgnWWmxkoDRpiCdqKEWgMrS7UTUGEfAOfWt/ciINd4K0vQCciJOFyTlurFpMccnB/KFlx/97aqN/LTUJiL0B3abojYB51t6fMg89gnV4gXDpvNdcqi+XbFjyr+Aw8URQvxGkLaLHgd44hqcbDtAagwAZj37aF5GCHQ= 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 zh0RqeQxF6nOZzhawqqvu5; Sun, 05 Nov 2023 18:11:34 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawqjdPHpPpmzhawq74jj; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=MJVzJeVl c=1 sm=1 tr=0 ts=6547dad6 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Gnkhxy0rOPfxD8PWgJj2duuy8y whtVU8ZOwY+PDydR+zcSt3/ED0AM7LBYILwHitye5ClTYiyjn4JxRsGtJWil9yzy8VCfGpcNYkNFK o5vVNvYFt6wr7atJmdsyHTTID; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhav-003Y66-2a for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:33 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:01 -0700 Subject: [PATCH v2 23/31] Use read_var_value overload in py-framefilter.c MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-23-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhav-003Y66-2a 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]:51014 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: MS4xfAlVMFKpUOsCIyZKNY1aYhzQr1lWlvnElrGqHoKaAld8+hOBo30DVoFFZCFbFQYFs7z7J6VdDTbluSQQyCMKV6hmolcPNrjh57SYitOp2Y2aN7DR1qlM 9+75KRKZ76gmwiwQk6iGJ+EbrQN3qTn8UQGutpHaSz+b0CBN4p0YGUSOlMCEXEe2cRZ+P5Bbmh2pMSE35r8gnIUhdjUAm2iuXU0= 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79106 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 F074038560AA for ; Sun, 5 Nov 2023 18:14:12 +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 0743F385B527 for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0743F385B527 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 0743F385B527 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=1699207902; cv=none; b=xIQ/55ITIV43UCuvpdA7/xe2PasvmRJ1DhEjjGuN5Fc2WtLG7fe2VMa+XVzFNlMrWH6e3Fl1ecugTf3V3KPQG8akcJB7nTss13SdAI+gdQA9jgueh7vm76X8jhdJ5M9iL2LHWrOBQwXLS4Gz1LNbFHi+v6is5VmJ2lShGD/xFH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207902; c=relaxed/simple; bh=6AeLPtcnSkRylJqPVYinQRiFf6nS5D1sNhOurjzjth8=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=ApQp7q64FoTZcIfo5HQ3cLa12j+4FH+LEgPt+0pWy2J1Xd6FaHIG4CKxwdGnQlzPXEPoP4HN8DJ9+wmiHPeEz+M69hPqrHFgqhSfP7wvBp9RlFiLWBNm3uCM/Tik8rVLOjyAvAdUVWBWzdzs3ai1sxRYNRcegvKGy9zQfx+T+XY= 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 zMoOqSMeIhqFdzhaxqTyR3; Sun, 05 Nov 2023 18:11:35 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawq3hesTiJWzhawqpQvh; Sun, 05 Nov 2023 18:11:34 +0000 X-Authority-Analysis: v=2.4 cv=IpgNzZzg c=1 sm=1 tr=0 ts=6547dad6 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=cw4Y68x0mjw5HnXJa1v1U5d/6G 9IZK/fPJ5lPSXEFdhhrK7OAoLAEDpqhRUdvYnEKF30TlvvDKWMr/SopzZwpmrtA3eIG772Y2AcK63 L8OBEQQLxKiA0/Xvr6uSHzWYK; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaw-003Y66-02 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:02 -0700 Subject: [PATCH v2 24/31] Use read_var_value overload in Guile MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-24-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaw-003Y66-02 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]:51014 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: MS4xfN3xBIoriG7N1ZPBetyG+fC+TBj9VvGnr6zzH/NaQVn2/lI3JAKAwB3qDx+C79UD30q8TtEMXdgefLmOrdYR+BXl/S2bV8ScquJ0OJxM2HoUgyojanm3 db/f9ixaJWq+yY4/wbpHsFcD1cmUNMMTinQCjyKiuhK0+EXvVXmO8nd3XJkOlIUDPS+qVcoZC2mNyHimco9qerxjWbBI9+pwBOo= 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79104 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 EF1C63861826 for ; Sun, 5 Nov 2023 18:13:57 +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 6B9D13856962 for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B9D13856962 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 6B9D13856962 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=1699207900; cv=none; b=TO4OBfKNOGp2wsGAJW04sJU+Hu4lFCge62CUboSIG9XzhUFBS3cElhdiFiyEJKUCzTZIV0hcFkZvQPDBzVrVaKW+NC9dEEWQfuCt8rZXRu6HA1x6KFh0JOE0afg9XItcm46Ou3eOp0WFZBYBPXkLdz/c8S04X+7g130JKU6pVMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207900; c=relaxed/simple; bh=eJiMuJqm0EQQqyh8cav+BdELkyZdYEj2nX+t5+WHD/4=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=vSnBbJwq8IQ73O+wuRtjj6z7fPMcMxsasbxWBPYFGzXHlNBGM/NbOZJSMfzNnZQUeP/LIg7AlREalqOABpoju+ISE9pMto9plcCpAyajbSZGl9YyP2bwIb4mVzWutt83kNGRBUJImaq2Ps5myoSyVLFpHdAqlcL03wT+RfzWfC0= 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 zgXcq9vBvjtZ3zhazqO084; Sun, 05 Nov 2023 18:11:37 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawqjdPhpPpmzhaxq74kC; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=MJVzJeVl c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=KD7ECV0S4CAS/fQ7fPVwnkAR3xw+AHg2ntWERF0CNB4=; b=NKeuOSSZKJpYIy3WdBbirxv+MT VUqx1sfApG6orwCz5FTFfVG26av3ZV15tqb6Jr2LV7lOxgUZ0h0vpnZ5xKhRitN6pyCc9i8IrBoJk r1qpSHC7RDmNqQ6qCRwcYO9tP; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaw-003Y66-12 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:03 -0700 Subject: [PATCH v2 25/31] Use read_var_value in read_frame_arg and read_frame_local MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-25-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaw-003Y66-12 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]:51014 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: MS4xfOReo/8SDPvJBQAevr0BrMNOJSd3wCB0wgCuQ6obh1B5NqJsoV7W5xuodfUwwszYQzOZ8Ch23MLNJ3XGNlHI2LGL0iZA4EuzlpUzvG2WKdeTEkpxWPMU 3Gr2pVBe/XNJ97p4OJKLXw2aaY0UMsrvYL42BD/bEjBm7v0rvjcJM/4/Izz/ggdf0CLLeQtBeecqwbfF26Ck31BuRncwXLlpnpw= 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, T_SCC_BODY_TEXT_LINE 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 f744baad61a..8d72949006c 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 Nov 5 18:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79101 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 3C6173864C69 for ; Sun, 5 Nov 2023 18:13:45 +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 CECD4385697D for ; Sun, 5 Nov 2023 18:11:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CECD4385697D 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 CECD4385697D 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=1699207899; cv=none; b=q5nfvp6rZUIMez9E/F2pP/SIHUKSwoRbVdY6+7WW+wDay2UN9/yll2FwApBK2WpGvi0HTdVZpzqJIOPDm/bIVNnXw8IzDmEO8TzyJqR/8kTo2KRGv7krM/HZj7qL3ArZuPltx+n/y1Cach7pnM1rVXLleDo85cIzLQ50PLmv+XU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207899; c=relaxed/simple; bh=PxLUR/Ibkf7fO5TMfKiLrDSdBtaRg/sE116IoWr/EPs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=ZEeU4vDHm8RydkGp/tLQP+SIHBB91I6a8jkkmLOyDgql+kRz0ysMmczfGQv6hI+WaB27NC/I0knMsoeXzGd6ItjLOfx2gzqb/uwFSpm0GrZx170X9imiHel0C6SGGUUCKNKFBUrYjJCceiuDTyfup7hBGomG71DDnRUoI4hawN0= 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 zaYfquRnjKOkLzhaxqKH5g; Sun, 05 Nov 2023 18:11:35 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawqTFZ6wuSEzhaxqZDs6; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=evvMc6lX c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Tg9cGCaFTKJkzZaYirVe369ZnhQHYvodMfVUgMxOJvM=; b=GJMeXYkERTydAu+r5UBvqoqD8y 4hpoHQFOfofuu+rI5HNeWAld8NIszt/GRFLRMCXhLe6NPfFGaqakrIrj5zyVWTKRuAaH8KWRarG+E SvJfNpYbYxiUu40I4NND2z5vS; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaw-003Y66-1m for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:04 -0700 Subject: [PATCH v2 26/31] Change print_variable_and_value to take a block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-26-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaw-003Y66-1m 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]:51014 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: MS4xfEOKYnD6Gba4nJFtWdeJKXUfJIgObBPFRapHRaySQ9hhyPd6z/Z6ZUv+CnWurTCiQNsKbzo2JSvR1jCHqHYbJLAe9pVdEmT1vYmiTzVOD0so679xlmy1 OVf6yEctWjhE1RN1jh9jRv1NVwHPIWKiljytzy6U/ORQJDhEs30Li+vOGSxEtJNsu0AO4p4LzUBM5TLywyek0OrRhXI0VdhxYkI= 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, T_SCC_BODY_TEXT_LINE 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 57a7af67ffe..afbc4f0eb55 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2395,10 +2395,11 @@ clear_dangling_display_expressions (struct objfile *objfile) before printing the variable name. */ 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 (); @@ -2411,11 +2412,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 8d72949006c..27a932cfcaa 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; @@ -2361,6 +2363,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 @@ -2525,6 +2528,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 Nov 5 18:12:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79097 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 3D07F386074C for ; Sun, 5 Nov 2023 18:13:31 +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 0934B385B528 for ; Sun, 5 Nov 2023 18:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0934B385B528 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 0934B385B528 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=1699207899; cv=none; b=wMaoun2Z2IL/seddFet5M7IgrnJKvdigey7zXALZs03c2wl4YnEwuqTjjJbKDFQOCBQ7Nnaac1l0aloIkfl0IUga2nxyLpTiQ8yuDJrX5T1Z5iD2IfVL8j5gS9G0Z/m872MN5bGq+d9HQ3gcHlpft81D1RYOts1KBExvs8+FeQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207899; c=relaxed/simple; bh=bEvN04T1BnuD2qIHO09bfTz7hy9P9cI1Bu9mCa+E3qc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=qHOweeq9/Z9Hr76iIoSQvyL1ZIFKiBjNpRotVXhcVbAJxlnqIdt+K7e7fHbx/3Qafcz5/DXu7h3YXFAglOYhN1xQePBRpS629GrJ429w9CRIBADxfltChlhNcBP7xnnNiOghtwrDlf4BQyLiDD3nFWqAd1BWm0kZZBTFCKgb15s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id zVExq92ujgpyEzhaxq8IMT; Sun, 05 Nov 2023 18:11:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhawqJ1sHNUwRzhaxqng6v; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=I852+fsg c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=WorQxGvi3Ys2FXJTWLhoE/2LXhHcLb1jTdG7xJCotbo=; b=n699oMt+lz62X3uaN/Vprlylpi 4TBGeQyzij1f+t8GfPWr7rVKyP+ohFzGBNYMIc5b+9S1yeVPIj1Wn02bnYBpDGPowD+icsK2UZ0pT 9ZBADsGPOY7gjP89k4sf7HXlw; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaw-003Y66-2P for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:05 -0700 Subject: [PATCH v2 27/31] Change find_frame_funname to return a block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-27-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaw-003Y66-2P 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]:51014 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: MS4xfDN3DFYQjt1BbWwdQZTQOlvM9WeoeSdCyFV3Boc8lcMVQzOh9uORVbIGwyJQqt3q0xLlDCY9yC6LRpj4k0alOeckK9jjBzkH25lryc7ZFvwWLe3sb4p9 jZJ5f55TnpcXrd6w5jHNbJeBJiVKaT5Pa5cGTx64peTxrYP0cIzYFxeEG9Ij4TAhj9bPp1emIlDQ5YBYK+JDLwAgdx3vlEMBP78= 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, T_SCC_BODY_TEXT_LINE 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 27a932cfcaa..5d7267b7b51 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 Nov 5 18:12:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79102 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 3094F385701B for ; Sun, 5 Nov 2023 18:13:52 +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 781F83856244 for ; Sun, 5 Nov 2023 18:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 781F83856244 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 781F83856244 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=1699207901; cv=none; b=TZ/HChSXQt2JXZJK8Zsu8RFQbYDShQ9WsZC9VVE/HsUqu5rhWq4tnbDi/n2KUYZFFK/3cm/j+tIqPB1f7MuyA3YlVKXvKk4SjIrr1ioG8gSXdL3OtM6paFhiZrGqK/jNljs1sydpzZxCZgc4Ynlnw+NhAoXqzlw9kDqagLNILhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207901; c=relaxed/simple; bh=av5rDW10IPfao6/E6YQbAOrNQH8asWRPMKY278vLCdY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=FfOD7lUc6nhlF1Yx/2AfSsXMDiFRaM7NelZvA0afaUDAdtv7hlnq73hhmmD3lUJ3yEuGhiKeS1juEjCR0LMXt954FRsU9n1eSkTkBD+HQoK34gcGpb2MBCUgFwXMLrEHUY2yI3/MW9mcDe/6ghLKyseBaRghPY89m+pPh5mgwQM= 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 zMoNqspezKOkLzhayqKH5p; Sun, 05 Nov 2023 18:11:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhaxqzAcB6uHPzhaxqfg1k; Sun, 05 Nov 2023 18:11:35 +0000 X-Authority-Analysis: v=2.4 cv=TuH1ORbh c=1 sm=1 tr=0 ts=6547dad7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=jhIGmY0r9NKcVsCRQsN6/HE3Lw BwlOzXlkTyqa5t8v9M/x5Lb4WlUnbUtt63SljM0BykwylbJkeDRHmkYF1SPcBUwXKOMXj0XimWACw MyFUopUWBt9BIRztbA0a9AZ6w; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhaw-003Y66-34 for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:34 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:06 -0700 Subject: [PATCH v2 28/31] Change btrace_function::sym to a block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-28-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhaw-003Y66-34 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]:51014 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: MS4xfFmDkcyl1VGkN+ZdD4xFkQIdPuzRIdgMDwud+3NZSpesTLdKo6tT2FTB/rrkDqzJEpJ73Efvjepeltbn+Hd7uu1CBFtBMI6AUY+DVtCNS+sgqKWVRp9c 1rJO+rep45MK96+5IquZmeWdtFFP2csl6r6Gl9sMMLvRa6GmzYcx89ZvSzeBHFN9KI5Po5ikmh2HNxpfMflH0qy9su6cYyoy9dM= 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79105 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 668D9385DC17 for ; Sun, 5 Nov 2023 18:14:09 +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 55060385B53E for ; Sun, 5 Nov 2023 18:11:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55060385B53E 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 55060385B53E 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=1699207902; cv=none; b=M8CAbztCUWqQP1h/hK3mJTBBsAFDG8wo05KmQuEizDJG020X1APMBJd+gNDMyKiSui9Qh3ZIInMwLYKOWz4nF7tU1eirZ9PiVjhu72xsp/9B5BMNXQPWKHnZroMtLZe4ecEgz4kmDn8FwKO6JoG60myNlTQBNBJoFX9fcUNo1yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699207902; c=relaxed/simple; bh=zodlxV7qQb0L1LZY8UnoqOoqUbhsF7BiWeJxuFXCgfo=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=mYOpT/LEmLwcvskcpRb+CgEPcKzUAbbAi0e17PQ0MlrFg5ab2CEs+ZANqRTy2x/YAGcj140qWE1m0H9TGQLwa2aBv0ZYCgizWuBVOas7pLsiDkzQW25QIRraJYYiN57jtpAJMQP/eO4zPTc/rn49+tEzNGp0ng/qHZyv5HE5aac= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-5003a.ext.cloudfilter.net ([10.0.29.159]) by cmsmtp with ESMTPS id zcjTqb90OWcCIzhayqQWwk; Sun, 05 Nov 2023 18:11:36 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zhaxqMJPMZs8Wzhaxq2vNh; Sun, 05 Nov 2023 18:11:36 +0000 X-Authority-Analysis: v=2.4 cv=YKGMdDKx c=1 sm=1 tr=0 ts=6547dad8 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=AGeAzRHJfjCVJsI2dHCLmI6w2B jr3jk7gsY9YQO0tERYoM0W8c1+MU10FwA51q4WVP/3S8THcFiKp1vWBI6OEdkAWItyDJCoJknvcFQ d/bmnwVedRtJx4OqVP4t9wo2l; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhax-003Y66-0W for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:35 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:07 -0700 Subject: [PATCH v2 29/31] Use read_var_value overload in Python MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-29-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhax-003Y66-0W 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]:51014 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: MS4xfPsZBK8XcvEGpcsatg/60hdd5q98bvVEdUykeseXHX2Qr6CemFwtb6Ob+CZvlrR6ERhWagzVVzeYgjTK/TKy+bUtcH0Bqjs0gawq6CpsfxUaaTMoYKFN gfSjj9YpMVxoG6SIaQn44/whSvGtfLbU0JZFvcLzWCT2bvD4wdCgcYkP+GWVHzYEHEGrVAeWoBlk2nnzXEcY408u+saFkyuJGxw= 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79124 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 F190E3857027 for ; Sun, 5 Nov 2023 19:58:41 +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 57B893858C20 for ; Sun, 5 Nov 2023 19:58:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57B893858C20 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 57B893858C20 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=1699214309; cv=none; b=indWzJJ7qPND+BNB/50eCpqasgqBqpiMm2rcwrAVdPTr3jfk6XiNksOTC9wagtZfOnJXjsKtqx5LdOty7BOpL+TWSatAsfq7EsJWdlkpPmmgiWDu7wQ5SHT42j1dFTuPQwihbX3hE+8LuVIzfw8rNf5VZ7vXDjivrbNlTTO/GUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699214309; c=relaxed/simple; bh=pjyN9HvWR/WwlPkWontErlzGvYqKflAFhKnl2d4OD5U=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=XVEFwbfI+gb4UhENO948+vXvMlrL9HmymbrQOBEvpkUPtNJR4V2C24qUWJNdGZywHWYvGmx6efdgFsaR+dafObslpHYBwxk7Z3cpDIqjx3ViXEeKc0BlN6tcb+8eXTXolk1kwVo+T1bXIg6dZ4BsygB1F7mfYsXFgoyov9+QeKg= 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 zgJwq9tJKjtZ3zjGQqOJiN; Sun, 05 Nov 2023 19:58:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zjGNq0Ikm6uHPzjGNqgd3K; Sun, 05 Nov 2023 19:58:28 +0000 X-Authority-Analysis: v=2.4 cv=TuH1ORbh c=1 sm=1 tr=0 ts=6547f3e4 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA: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=Lip1P3boqsIni+uGgrlpWpzHdl w0+Hw9umSmqvaPr2v12dzJ/EH0Gz9dLITNqs7G1U2PNeyqKzGeXXLcIk2YEAgfKpNBDAN/VeCkq2m SfvKZB2kwcrT7Z+r4KvdzsKzt; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhax-003Y66-1E for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:35 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:08 -0700 Subject: [PATCH v2 30/31] Remove the old read_var_value MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-30-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhax-003Y66-1E 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]:51014 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: MS4xfDrz/CPTMhuLcBDXlA7VbMdwHE84O9j9cSn1D7Ywtp9kuEw9Mja3vvHbQIjbWO+qgnAcjVDT4r41HS+hCHHkZCrp5BRBWK6RxkaZp4e+/GdZgFIPWwTo zD4HHHq4KM/NgG/bEhUTbQ/RqjvVZqkBcE8gKD+s0Kcq1sppRUHDkdQNnu3/FbDZHDifL9VGiACVWeP0/ah2KoKX+AYyRJUncdE= X-Spam-Status: No, score=-3024.4 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, T_SCC_BODY_TEXT_LINE 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 Nov 5 18:12:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 79123 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 01E463856948 for ; Sun, 5 Nov 2023 19:58:09 +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 5748C3858C20 for ; Sun, 5 Nov 2023 19:57:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5748C3858C20 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 5748C3858C20 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=1699214274; cv=none; b=NjPCLY1wHKJZXbFNYzddt+Ac8JreTmc+mC4LOkYEOy6tDsD4VDxksXmF2BK3Nplf9vRs4aL0wIhNkiGojIs9iHAmwniDjdZXztqoxn7ChryN8R4UWJlV6+B3JHTdKYk/12WKxqgAuu/d8ofL46Uxwyae5BX2F9VoWQnJJP2Ic7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699214274; c=relaxed/simple; bh=roDwAUCNogpOS9pC4dDKFZK2s6c/4oAbIP/ab/NSjDA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=Iusq2lU1qBqK7PVU2b7E4hlwvRsFrRSfKRZ9t7I09iZ9JQip6M15vvlCzPADQ/rw95SY2qYBH4pWeu4lH6x/2mwzUZgQjR4+AYPBI53ITQ77ufI3J4oSebJJ0WdWGHi59aIQ9edtaUZNIrXK76HM5mAqXLZbckpV4d8y5Q7XglY= 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 zVEzq92vYgpyEzjFnq8bvG; Sun, 05 Nov 2023 19:57:52 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id zjFnqwsn15ZLUzjFnqCoiC; Sun, 05 Nov 2023 19:57:51 +0000 X-Authority-Analysis: v=2.4 cv=S57KfagP c=1 sm=1 tr=0 ts=6547f3bf a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=Huhfutk92yl2WNji-aoA: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=YWkbbhhjntiqWUt/NVULWZJxsnMs4Npq6CXOQ3TsQtg=; b=CT3dMmewqmYWXCGQhj4bFEkLwn XySrnO2Mhj0wq+R/7XZSCbfAIiAxA6nPf7GIYcvQEDvXJB1OYpVv3ylGkG8egfh/oF4iwPRkDca4e LmW7+J9r21MrZvrP7g6o2M97K; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:51014 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 1qzhax-003Y66-1u for gdb-patches@sourceware.org; Sun, 05 Nov 2023 11:11:35 -0700 From: Tom Tromey Date: Sun, 05 Nov 2023 11:12:09 -0700 Subject: [PATCH v2 31/31] Change language_defn::read_var_value to accept block_symbol MIME-Version: 1.0 Message-Id: <20231105-split-objfile-2023-bound-sym-october-v2-31-dbd2d158bbc3@tromey.com> References: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@tromey.com> In-Reply-To: <20231105-split-objfile-2023-bound-sym-october-v2-0-dbd2d158bbc3@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: 1qzhax-003Y66-1u 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]:51014 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: MS4xfMyAepRXMGfwtpNxQ9i+FeGx9+OYUISShHveN+nmbqh+HsatYAgglJN6QA0WRFB5QVwYftZE0dHjn+b7d3N/D6WAfxvGO0T6ghSIYmAFOD4YJyxfuX4G 66f3CdlqIiARq11YJfqSarZ5BAo0VVHvRnoNFwwksqE/QyvZ7ejQFfqtP7fGQjILqbbBjIHDGJWhvaRRTN050R6eFKEVlKaw8Nw= 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, T_SCC_BODY_TEXT_LINE 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 6beadad568a..ad39f5d496c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -13391,8 +13391,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 @@ -13400,13 +13399,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