public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Carl Love <cel@us.ibm.com>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>, cel@us.ibm.com
Subject: RE: [PATCH] PowerPC: fix _Float128 type output string
Date: Mon, 10 Apr 2023 08:43:39 -0700	[thread overview]
Message-ID: <455ad41947bd98f0a6c98cda721d0390416fc163.camel@us.ibm.com> (raw)
In-Reply-To: <20230407145154.5a1c9b4e@f37-zws-nv>

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 <gdb-patches@sourceware.org> 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 


  reply	other threads:[~2023-04-10 15:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 15:28 Carl Love
2023-04-05 20:18 ` Carl Love
2023-04-07 21:51   ` Kevin Buettner
2023-04-10 15:43     ` Carl Love [this message]
2023-04-10 15:46   ` [PATCH ver 2] " Carl Love
2023-04-10 16:01 ` Carl Love
2023-04-13 14:18   ` Tom Tromey
2023-04-13 16:13     ` Carl Love
2023-04-13 16:35       ` Carl Love
2023-04-13 17:12         ` Tom Tromey
2023-04-13 22:08           ` Carl Love
2023-04-17 15:45             ` [PATCH ver 3] " Carl Love
2023-04-18 10:18               ` Ulrich Weigand
2023-04-14 13:44       ` [PATCH ver 2] " Tom Tromey
2023-04-14 15:35         ` Carl Love
2023-04-17 10:26         ` Ulrich Weigand
2023-04-17 20:17           ` Tom Tromey
2023-04-18 10:17             ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=455ad41947bd98f0a6c98cda721d0390416fc163.camel@us.ibm.com \
    --to=cel@us.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).