From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy4-pub.mail.unifiedlayer.com (gproxy4-pub.mail.unifiedlayer.com [69.89.23.142]) by sourceware.org (Postfix) with ESMTPS id 7392A3858D1E for ; Wed, 2 Aug 2023 20:18:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7392A3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway6.mail.pro1.eigbox.com (Postfix) with ESMTP id C307B10044F58 for ; Wed, 2 Aug 2023 20:18:07 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id RIIJqXOKtsBigRIIJqrAX9; Wed, 02 Aug 2023 20:18:07 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=Ub+U9IeN c=1 sm=1 tr=0 ts=64cab9ff a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=UttIx32zK-AA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=CCpqsmhAAAAA:8 a=QyXUC8HyAAAA:8 a=syeisKafBS__Z6P9FiwA:9 a=atKgkdIoenIA:10:uccc_2email_address a=ul9cdbp4aOFLsgKbc677:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: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=q0hmWyByjSw7N9kKXvebBrmgt/t6LbHDqIBxwNUGEwA=; b=wV9bNO/FNPfM94jo8WjmtqI3Td 1Fr9lYoYCO471li5JL33MwmAmzY1whUfWmpSs5vR6TkvVNsB/0x2kb4Ev/9Sw8LOSMZ7hRKsLqeXX YOuds+Xv3uT1oifQS7q52WjDr; Received: from 75-166-148-59.hlrn.qwest.net ([75.166.148.59]:41210 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qRIIJ-002qvb-0z; Wed, 02 Aug 2023 14:18:07 -0600 From: Tom Tromey To: Abdul Basit Ijaz via Gdb-patches Cc: Abdul Basit Ijaz , JiniSusan.George@amd.com, tom@tromey.com, eliz@gnu.org, blarsen@redhat.com, Nils-Christian Kempke Subject: Re: [PATCH v4 2/4] gdb/symtab: add lookup for trampoline functions References: <20230801224744.24433-1-abdul.b.ijaz@intel.com> <20230801224744.24433-3-abdul.b.ijaz@intel.com> X-Attribution: Tom Date: Wed, 02 Aug 2023 14:18:06 -0600 In-Reply-To: <20230801224744.24433-3-abdul.b.ijaz@intel.com> (Abdul Basit Ijaz via Gdb-patches's message of "Wed, 2 Aug 2023 00:47:42 +0200") Message-ID: <87pm45ci69.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 75.166.148.59 X-Source-L: No X-Exim-ID: 1qRIIJ-002qvb-0z X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-148-59.hlrn.qwest.net (murgatroyd) [75.166.148.59]:41210 X-Source-Auth: tom+tromey.com X-Email-Count: 13 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3018.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Abdul" == Abdul Basit Ijaz via Gdb-patches writes: Abdul> From: Nils-Christian Kempke Abdul> In order to query information about the DW_AT_trampoline tag for Abdul> subroutines and inlined subroutines, two function were added to symtab. Thanks for the patch. Abdul> +CORE_ADDR Abdul> +find_function_trampoline_target (CORE_ADDR pc) Abdul> +{ ... Abdul> + else if (trampoline->target_kind () == TRAMPOLINE_TARGET_PHYSADDR) Abdul> + { Abdul> + /* If the function symbol containing this trampoline target has Abdul> + been relocated we assume the target_address also needs relocation. Abdul> + If it has not been relocated the offset should be zero. */ Abdul> + target_address Abdul> + = (trampoline->target_physaddr () Abdul> + + sym->objfile ()->section_offsets[sym->section_index ()]); First, I'm all in favor of storing unrelocated addresses in data structures and then relocating them at point of use. However, in this case, I think the stored address is already relocated. >From the previous patch: + unrelocated_addr target_addr_reloc = attr->as_address (); + CORE_ADDR target_addr + = cu->per_objfile->relocate (target_addr_reloc); + target_addr = gdbarch_adjust_dwarf2_addr (objfile->arch (), + target_addr); + TYPE_TRAMPOLINE_TARGET (ftype)->set_target_physaddr (target_addr); ... this brings up another issue, though -- if a relocated address is stored, then it must be relocated by objfile_relocate. So perhaps storing the unrelocated address here really would be better. This can be done using 'adjust' rather than 'relocate' in the first patch, and by using the unrelocated_addr type rather than CORE_ADDR for storage. Tom