From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id BFAD83858D32 for ; Fri, 7 Apr 2023 21:51:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFAD83858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680904317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrc0wtw2xC4tSRCwU3UBTTrruOC8IFVrCPdEM+BoCdU=; b=TM6qYWuc/t4hWLwzZUXYcVwc5G+RZvqS1FforSem7OU2B5zgsMI3FIgPUlfz4BW3er/XX/ IZEDC57O7NTC7F+92+XA/jJM0fCw0RNFQzmOOJphjiNyVPLDtjgt7M8ln57U4Sfr5YRMLd K6KNBRY4g8zKRkwtAxlWC2CyY2OTeL4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-zits7_OLPr6T-ngybw5s-w-1; Fri, 07 Apr 2023 17:51:56 -0400 X-MC-Unique: zits7_OLPr6T-ngybw5s-w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CE9A1C05B0B; Fri, 7 Apr 2023 21:51:56 +0000 (UTC) Received: from f37-zws-nv (unknown [10.2.16.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E7BF492B00; Fri, 7 Apr 2023 21:51:55 +0000 (UTC) Date: Fri, 7 Apr 2023 14:51:54 -0700 From: Kevin Buettner To: Carl Love via Gdb-patches Cc: Carl Love , Ulrich Weigand Subject: Re: [PATCH] PowerPC: fix _Float128 type output string Message-ID: <20230407145154.5a1c9b4e@f37-zws-nv> In-Reply-To: <968f45f6bbcdfe2874bf8b03bd33f8e813d50a14.camel@us.ibm.com> References: <184c0edcf067acccdf71d4dcdd66447bb5d93d4c.camel@us.ibm.com> <968f45f6bbcdfe2874bf8b03bd33f8e813d50a14.camel@us.ibm.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,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: 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. > > - name = dwarf2_full_name (NULL, die, cu); > this_type = type_allocator (objfile).new_type (TYPE_CODE_TYPEDEF, 0, name); > this_type->set_target_is_stub (true); > set_die_type (die, this_type, cu); > - target_type = die_type (die, cu); > if (target_type != this_type) > this_type->set_target_type (target_type); > else