Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gcc@gcc.gnu.org, gdb@sourceware.org
Subject: Debugger support for __float128 type?
Date: Wed, 30 Sep 2015 17:33:00 -0000	[thread overview]
Message-ID: <20150930173344.9D78513CC@oc7340732750.ibm.com> (raw)

Hello,

I've been looking into supporting __float128 in the debugger, since we're
now introducing this type on PowerPC.  Initially, I simply wanted to do
whatever GDB does on Intel, but it turns out debugging __float128 doesn't
work on Intel either ...

The most obvious question is, how should the type be represented in
DWARF debug info in the first place?  Currently, GCC generates on i386:

        .uleb128 0x3    # (DIE (0x2d) DW_TAG_base_type)
        .byte   0xc     # DW_AT_byte_size
        .byte   0x4     # DW_AT_encoding
        .long   .LASF0  # DW_AT_name: "long double"

and

        .uleb128 0x3    # (DIE (0x4c) DW_TAG_base_type)
        .byte   0x10    # DW_AT_byte_size
        .byte   0x4     # DW_AT_encoding
        .long   .LASF1  # DW_AT_name: "__float128"

On x86_64, __float128 is encoded the same way, but long double is:

        .uleb128 0x3    # (DIE (0x31) DW_TAG_base_type)
        .byte   0x10    # DW_AT_byte_size
        .byte   0x4     # DW_AT_encoding
        .long   .LASF0  # DW_AT_name: "long double"

Now, GDB doesn't recognize __float128 on either platform, but on i386
it could at least in theory distinguish the two via DW_AT_byte_size.

But on x86_64 (and also on powerpc), long double and __float128 have
the identical DWARF encoding, except for the name.

Looking at the current DWARF standard, it's not really clear how to
make a distinction, either.  The standard has no way to specifiy any
particular floating-point format; the only attributes for a base type
of DW_ATE_float encoding are related to the size.

(For the Intel case, one option might be to represent the fact that
for long double, there only 80 data bits and the rest is padding, via
some combination of the DW_AT_bit_size and DW_AT_bit_offset or
DW_AT_data_bit_offset attributes.  But that wouldn't help for PowerPC
since both long double and __float128 really use 128 data bits,
just different encodings.)

Some options might be:

- Extend the official DWARF standard in some way

- Use a private extension (e.g. from the platform-reserved
  DW_AT_encoding value range)

- Have the debugger just hard-code a special case based
  on the __float128 name 

Am I missing something here?  Any suggestions welcome ...

B.t.w. is there interest in fixing this problem for Intel?  I notice
there is a GDB bug open on the issue, but nothing seems to have happened
so far: https://sourceware.org/bugzilla/show_bug.cgi?id=14857

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


             reply	other threads:[~2015-09-30 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 17:33 Ulrich Weigand [this message]
2015-09-30 20:12 ` Joseph Myers
2015-10-01 17:23   ` Ulrich Weigand
2015-10-01 20:40     ` Joseph Myers
2015-10-02 15:18       ` Ulrich Weigand
2015-10-02 15:41         ` Joseph Myers
2015-10-02 16:01           ` Ulrich Weigand
2015-09-30 22:42 ` Mark Kettenis
2015-10-01  9:46   ` Gabriel Paubert
2015-10-01 16:16   ` Ulrich Weigand
2015-10-02  9:41     ` Jonas Maebe

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=20150930173344.9D78513CC@oc7340732750.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@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