From: Kevin Buettner <kevinb@redhat.com>
To: Carl Love via Gdb-patches <gdb-patches@sourceware.org>
Cc: Carl Love <cel@us.ibm.com>, Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Subject: Re: [PATCH] PowerPC: fix _Float128 type output string
Date: Fri, 7 Apr 2023 14:51:54 -0700 [thread overview]
Message-ID: <20230407145154.5a1c9b4e@f37-zws-nv> (raw)
In-Reply-To: <968f45f6bbcdfe2874bf8b03bd33f8e813d50a14.camel@us.ibm.com>
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.
>
> - 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
next prev parent reply other threads:[~2023-04-07 21:51 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 [this message]
2023-04-10 15:43 ` Carl Love
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=20230407145154.5a1c9b4e@f37-zws-nv \
--to=kevinb@redhat.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=cel@us.ibm.com \
--cc=gdb-patches@sourceware.org \
/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).