From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6in2CpOQMGSs1SUAWB0awg (envelope-from ) for ; Fri, 07 Apr 2023 17:52:19 -0400 Received: by simark.ca (Postfix, from userid 112) id 20D441E221; Fri, 7 Apr 2023 17:52:19 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=WdneqTa2; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 84FAD1E110 for ; Fri, 7 Apr 2023 17:52:18 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 192EF3858C36 for ; Fri, 7 Apr 2023 21:52:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 192EF3858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680904338; bh=vrc0wtw2xC4tSRCwU3UBTTrruOC8IFVrCPdEM+BoCdU=; h=Date:To:Cc:Subject:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=WdneqTa2hq14uJDAZ0kIoVfZPfu1V2ySPODMG5liB2bQ4rIS4H9LfYUyRXlz85d9o iy13qT6QRT+hsmAqC3sTcHvbfQU6s5CZo6x2aGWB2ZM6hpLtzBS7Uo0P2KVj0Jp9xA 9yBwFnZKmlhp4ZapP0X5k4qImellcT0A5ScWpSLA= 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 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 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-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: , From: Kevin Buettner via Gdb-patches Reply-To: Kevin Buettner Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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