From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qproxy6-pub.mail.unifiedlayer.com (qproxy6-pub.mail.unifiedlayer.com [69.89.23.12]) by sourceware.org (Postfix) with ESMTPS id BD5253857C42 for ; Fri, 15 Apr 2022 16:15:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD5253857C42 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 outbound-ss-820.bluehost.com (outbound-ss-820.bluehost.com [69.89.24.241]) by qproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id BF8BB8032BE3 for ; Fri, 15 Apr 2022 16:15:06 +0000 (UTC) Received: from cmgw15.mail.unifiedlayer.com (unknown [10.0.90.130]) by progateway2.mail.pro1.eigbox.com (Postfix) with ESMTP id 8F342100472BE for ; Fri, 15 Apr 2022 16:14:06 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id fOaEnw3zKkku4fOaEnDa5o; Fri, 15 Apr 2022 16:14:06 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=XPf19StE c=1 sm=1 tr=0 ts=625999ce a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=z0gMJWrwH1QA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=fvdYRwcISqGIxGYFFxIA:9 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=jUVlbcvqPNj+eBq+1677+J15zg+TfKCfZb7i39XBjLo=; b=bMZMOtu440rRTYCoqwmIkWcSyl MHo+lnYPrny8WK3l6ER7uzOTEmfFsbuyEVTd2hVRmugGzmb075yLHVh79kll7O2tezFi+w+FNAzr+ EzCiRWZVKQxi9swNFpjEh/61u; Received: from 71-211-154-204.hlrn.qwest.net ([71.211.154.204]:55562 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nfOaD-004CRe-Mc; Fri, 15 Apr 2022 10:14:05 -0600 From: Tom Tromey To: "Kempke, Nils-Christian via Gdb-patches" Cc: Tom Tromey , "Kempke, Nils-Christian" Subject: Re: [PATCH 2/2] gdb: Resolve dynamic target types of pointers. References: <20220118132626.3786176-1-nils-christian.kempke@intel.com> <20220118132626.3786176-3-nils-christian.kempke@intel.com> <87k0e2tsga.fsf@tromey.com> X-Attribution: Tom Date: Fri, 15 Apr 2022 10:14:04 -0600 In-Reply-To: (Nils-Christian via Gdb-patches Kempke's message of "Thu, 14 Apr 2022 10:22:52 +0000") Message-ID: <87ee1y1fzn.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.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: 71.211.154.204 X-Source-L: No X-Exim-ID: 1nfOaD-004CRe-Mc X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-154-204.hlrn.qwest.net (murgatroyd) [71.211.154.204]:55562 X-Source-Auth: tom+tromey.com X-Email-Count: 6 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3023.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2022 16:15:10 -0000 > Thanks for the feedback. Sorry that it took me so long to reply - the mail > somehow got lost.. No need to apologize! I'm constantly months behind and/or dropping email. >> > + if (type->code () == TYPE_CODE_PTR && is_dynamic_type (type)) >> > + { >> > + CORE_ADDR addr; >> > + if (nullptr != TYPE_DATA_LOCATION (TYPE_TARGET_TYPE (type))) >> > + addr = value_address (val); >> > + else >> > + addr = value_as_address (val); >> >> This seems weird to me. When does value_as_address fail? > This if else has been introduced because of the way ifort/icc describe pointers > vs. gcc/gfortran and icx/ifx. > <1> DW_TAG_variable > <> DW_AT_type: > <> DW_AT_location: (location of the pointer) > <1> DW_TAG_pointer_type > DW_AT_type: > <1> DW_TAG_array_type > <> DW_AT_type: > <> DW_AT_data_location: (location of the array) > <2> DW_TAG_subrange_type > Fortran: > <1> DW_TAG_variable > <> DW_AT_type: > <> DW_AT_location: (location of the pointer) > <1> DW_TAG_array_type > <> DW_AT_type: > <> DW_AT_data_location: (location of the array) > <2> DW_TAG_subrange_type > When printing this pointer to array in gfortran/ifx the pointer print function is > not actually called - since the DWARF does not emit a pointer here. Instead, > the normal array print is invoked which will use the DW_AT_data_location. > So we do not run into this same problem I still do not understand, sorry. For me this looks like two different types. In one situation, the type is a pointer to an array. In the second, it's just an array. So, I would expect them to print differently. Are you saying these should print identically? If so, that's fine -- but then it seems like something to do in the Fortran code, not in c-valprint.c. Maybe in the code the check for TYPE_DATA_LOCATION is a proxy for checking that the pointer is a pointer to a Fortran array? I guess I could understand that, but it doesn't seem like a good approach, because what if some C compiler starts emitting this? >> I'm curious why the code added here is not also needed in f-valprint.c. > The reason here is simply that Fortran does not have this implemented for > Itself. Instead the fortran f_langugage inherits from language_defn (the all > languages base class) which simply delegates the value-print to > c_value_print / so changing it there suffices. If Fortran-specific printing is needed, this will have to change. Tom