From patchwork Sun Feb 18 01:10:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 85931 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 66B2A3860C39 for ; Sun, 18 Feb 2024 01:14:11 +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 ADE183860743 for ; Sun, 18 Feb 2024 01:10:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADE183860743 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 ADE183860743 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=1708218618; cv=none; b=qjgscBGlj8aw6cWewJ/K1hqIlkjLu4d9XtRz5TtJxJ0GzvYkrb+nBXFMOOXzJKrAKnrGlXQqYRtN5wWCTvb97hrR2BPaar3HWtThSyVrtzSk4SIUDD0x4IedTmBxtSpzfKrN4SgBQ6kGqaLN+1RRKmI5NWaZNP43bZg7LYHWuu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708218618; c=relaxed/simple; bh=ohqCi4huH9l/TObGxRYoz2YiiZVfSqW4AuB3a7KHXWA=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=d+BV9GmHrCkqNe+wA2Lv0RS68P7psK+2OUPeB1J1Ppn7p126J8PWRxI3NmXPZQG5UdUtcl48BLwF6O8jMYE/yxAWGYR0SZWjZaypuRy2DwHh9SPJInE0N8i05/CpB7K0NvtVwTFxZaHdMaW688bVQE1NFYKr5W24jgBQ0lBws68= 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 bOyprcNwnpUFLbVh0rm9ce; Sun, 18 Feb 2024 01:10:06 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id bVh0rvOlVsVJXbVh0r9ogV; Sun, 18 Feb 2024 01:10:06 +0000 X-Authority-Analysis: v=2.4 cv=acLCngot c=1 sm=1 tr=0 ts=65d158ee a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=k7vzHIieQBIA:10 a=Qbun_eYptAEA:10 a=JiCVu4CyO55u8qh7b9UA: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=Xa06npNdE3zMn4N2kvEMUZqaqIdcqiujRRPGU0Mpiro=; b=N6k3OV48gaanLwkjt72OIM4ZhB nnoUwng2kSTnLN67u3JwbKgpqidCh/VGCnkcUaqC88MYVRPuZlr9GePKnhWM5kXBIwP3Q59SVyp7W fupZ+P8qzUjPf6MjJWlG5tyh9; Received: from 71-211-170-195.hlrn.qwest.net ([71.211.170.195]:49770 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 1rbVgz-003IPy-2U for gdb-patches@sourceware.org; Sat, 17 Feb 2024 18:10:05 -0700 From: Tom Tromey Date: Sat, 17 Feb 2024 18:10:08 -0700 Subject: [PATCH 7/7] Fix address comparison in lookup_minimal_symbol_by_pc_section MIME-Version: 1.0 Message-Id: <20240217-dwarf-race-relocate-v1-7-d3d2d908c1e8@tromey.com> References: <20240217-dwarf-race-relocate-v1-0-d3d2d908c1e8@tromey.com> In-Reply-To: <20240217-dwarf-race-relocate-v1-0-d3d2d908c1e8@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: 71.211.170.195 X-Source-L: No X-Exim-ID: 1rbVgz-003IPy-2U X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-170-195.hlrn.qwest.net ([192.168.0.21]) [71.211.170.195]:49770 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: MS4xfIYE7/1Vz7V6PFPq0Lh6UqhHa3TeKWJaAP4C5P0xy9diLQnY0cUgf9VajWRsLa6yRGXl6H7ue1TIu6F16/J75zsDg0IKmNMxrX3zQzj68KR/C3LgVMYp p+YQczp8QLBx19BsSQfhbQhVAikqwf0tTODxBkoyLvbJMRn6sV3qX6NaAI0B5icnmHnqmlGa+4HpeoMFA7PN/jQ+dY3B47Saelg= X-Spam-Status: No, score=-3021.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_VALIDITY_RPBL, 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 I noticed that lookup_minimal_symbol_by_pc_section is comparing unrelocated addresses across objfiles when trying to find the best symbol. However, this seems incorrect to me, as the unrelocated addresses aren't of interest here. This patch changes this code to compare the true addresses instead. This does make me wonder whether this code is necessary at all. --- gdb/minsyms.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 64f085a0314..06a87865c13 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1035,8 +1035,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio table. See if it is the best one overall. */ if (minsym != nullptr && (best.minsym == nullptr - || (best.minsym->unrelocated_address () - < minsym->unrelocated_address ()))) + || best.value_address () < minsym->value_address (objfile))) best = { minsym, objfile }; }