From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 034D83858C52 for ; Mon, 10 Apr 2023 15:43:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 034D83858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33AFGABK028922 for ; Mon, 10 Apr 2023 15:43:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version : subject; s=pp1; bh=RG8ndJuQvduLzCi0bmpjNN304gdC7oPTKehSfYzchKk=; b=cwz/oP5tJhhbLvjfgFhjmo3M610kgETxF1P9nmSYAjAvozYhrUrbVP15ip4dvKdBTE3W 9RYxXLU5lfowDJIgp+UBSn1kZnJhS8CWPcVVhqLP8jvQXJHpJjnjt7+vM810mmrBpRhp DfQrUzQVKXOUhSyCQqAuWdYDOG7U9uNxFtKEzo/O9OD9LM/vT3BdbycqmdiJNklS8aBm 4bduJSO8r3zBb7cLO2ty9kRMIoYr1EpsUANMGTiKuZ509/Jdc+iR3YoC11gBkqxkKt9/ 3v5onbRwh9/DJXQAgY6utHfkdLZOJYt2f68SvCdeVcZGPWFgS/DqnqiAIyXITu2FnR9K og== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3puje3kp1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 10 Apr 2023 15:43:45 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33AFf8wE029583 for ; Mon, 10 Apr 2023 15:43:44 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3puje3kp1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Apr 2023 15:43:44 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33AFca9v013494; Mon, 10 Apr 2023 15:43:44 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3pu0jhxfhr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Apr 2023 15:43:43 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 33AFhf1g55247296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Apr 2023 15:43:41 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B59D58059; Mon, 10 Apr 2023 15:43:41 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EABF5805B; Mon, 10 Apr 2023 15:43:40 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.150.219]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 10 Apr 2023 15:43:40 +0000 (GMT) Message-ID: <455ad41947bd98f0a6c98cda721d0390416fc163.camel@us.ibm.com> From: Carl Love To: Kevin Buettner , gdb-patches@sourceware.org Cc: Ulrich Weigand , cel@us.ibm.com Date: Mon, 10 Apr 2023 08:43:39 -0700 In-Reply-To: <20230407145154.5a1c9b4e@f37-zws-nv> References: <184c0edcf067acccdf71d4dcdd66447bb5d93d4c.camel@us.ibm.com> <968f45f6bbcdfe2874bf8b03bd33f8e813d50a14.camel@us.ibm.com> <20230407145154.5a1c9b4e@f37-zws-nv> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LIO3MahUQH26zK3Vj2lGzo5zzJ5JWyC- X-Proofpoint-ORIG-GUID: miVHB_QPk0CLhxRO-vPgDHvDWbLSvsMO Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 Subject: RE: [PATCH] PowerPC: fix _Float128 type output string X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-10_10,2023-04-06_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 impostorscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304100133 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2023-04-07 at 14:51 -0700, Kevin Buettner wrote: > Hi Carl, > > On Wed, 05 Apr 2023 13:18:26 -0700 > Carl Love via Gdb-patches wrote: > > > PowerPC: fix _Float128 type output string > > > > PowerPC supports two 128-bit floating point formats, the IBM long > > double > > and IEEE 128-bit float. The issue is the DWARF information does > > not > > distinguish between the two. There have been proposals of how to > > extend > > the DWARF information as discussed in > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104194 > > > > but has not been fully implemented. > > > > GCC introduced the _Float128 internal type as a work around for the > > issue. > > The workaround is not transparent to GDB. The internal _Float128 > > type > > name is printed rather then the user specified long double > > type. This > > patch adds a new gdbarch method to allow PowerPC to detect the GCC > > workaround. The workaround checks for "_Float128" name when > > reading the > > base typedef from the die_info. If the workaround is detected, the > > type > > and format fields from the _Float128 typedef are copied to the long > > double typedef. The same is done for the complex long double > > typedef. > > This approach sounds reasonable to me. > > One nit though... > > > diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c > > index c9208a097bf..fa319e346c0 100644 > > --- a/gdb/dwarf2/read.c > > +++ b/gdb/dwarf2/read.c > > @@ -14702,14 +14702,22 @@ static struct type * > > read_typedef (struct die_info *die, struct dwarf2_cu *cu) > > { > > struct objfile *objfile = cu->per_objfile->objfile; > > - const char *name = NULL; > > - struct type *this_type, *target_type; > > + const char *name = dwarf2_full_name (NULL, die, cu); > > + struct type *this_type; > > + struct gdbarch *gdbarch = objfile->arch (); > > + struct type *target_type = die_type (die, cu); > > + > > + if (gdbarch_dwarf2_omit_typedef_p (gdbarch, target_type, cu- > > >producer, name)) > > + { > > + this_type = copy_type (target_type); > > + this_type->set_name (name); > > + set_die_type (die, this_type, cu); > > + return this_type; > > + } > > I'd like to see a comment before the if statement that you added > above > which explains what's going on. OK, I added the following comment to version 2 of tha patch: + if (gdbarch_dwarf2_omit_typedef_p (gdbarch, target_type, cu->producer, name)) + { + /* The long double is defined as a base type in C. GCC creates a long + double typedef with target-type _Float128 for the long double to + identify it as the IEEE Float128 value. This is a GCC hack since the + DWARF doesn't distinquish between the IBM long double and IEEE + 128-bit float. Replace the GCC workaround for the long double + typedef with the actual type information copied from the target-type + with the correct long double base type name. */ Hopefully that addresses you concern. Thanks. Carl