From: Andrew Cagney <cagney@gnu.org>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/mips] Fix crash trying to print long double float
Date: Sun, 08 Aug 2004 16:57:00 -0000 [thread overview]
Message-ID: <41165B7A.4010601@gnu.org> (raw)
In-Reply-To: <20040808065934.GG1192@gnat.com>
> How's this?
>
> 2004-08-08 Joel Brobecker <brobecker@gnat.com>
>
> * mips-tdep.c (mips_gdbarch_init): Set size of long double
> to 128 bits for N32 and N64 ABIs.
> * mips-irix-tdep.c: Include "floatformat.h".
> (mips_irix_floatformat_always_valid): New function.
> (floatformat_mips_irix_long_double_big): New constant.
> (mips_irix_init_abi): Set the long double floatformat.
>
> Tested on mips-irix. OK to apply?
Yes, with these tweaks, commit:
> set_gdbarch_long_long_bit (gdbarch, 64);
> + set_gdbarch_long_double_bit (gdbarch, 128);
-- Set the long_double_format here (dito for other place), perhaphs
conditional on info.byte_order == BFD_ENDIAN_BIG.
The ..._bit and ..._format methods should really be combined into a
single object. I think that should wait until GDB is written in an OO
lanugage. However, in the mean time we can group them together.
> break;
-- Move this to mips-tdep and, after some thought, call it n32n64.
> +static int
> +mips_irix_floatformat_always_valid (const struct floatformat *fmt,
> + const char *from)
> +{
> + return 1;
> +}
> +
> +/* FIXME: brobecker/2004-08-08: Long Double values are 128 bit long.
> + They are implemented as a pair of 64bit doubles where the high
> + part holds the result of the operation rounded to double, and
> + the low double holds the difference between the exact result and
> + the rounded result. So "high" + "low" contains the result with
> + added precision. Unfortunately, the floatformat structure used
> + by GDB is not powerful enough to describe this format. As a temporary
> + measure, we define a 128bit floatformat that only uses the high part.
> + We lose a bit of precision but that's probably the best we can do
> + for now with the current infrastructure. */
> +
> +static const struct floatformat floatformat_mips_irix_long_double_big =
> +{
> + floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
> + floatformat_intbit_no,
> + "floatformat_ieee_double_big",
> + mips_irix_floatformat_always_valid
> +};
IRIX effectively defines the n32/n64 ABIs. If the other systems differ,
they can override both the _bit and _format in their local -tdep file.
Andrew
next prev parent reply other threads:[~2004-08-08 16:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-06 18:16 Joel Brobecker
2004-08-06 20:24 ` Andrew Cagney
2004-08-06 20:38 ` Joel Brobecker
2004-08-06 21:03 ` Andrew Cagney
2004-08-07 17:18 ` Andrew Cagney
2004-08-06 20:32 ` Joel Brobecker
2004-08-07 18:01 ` Andrew Cagney
2004-08-07 18:09 ` Joel Brobecker
2004-08-07 18:22 ` Andrew Cagney
2004-08-08 6:59 ` Joel Brobecker
2004-08-08 16:57 ` Andrew Cagney [this message]
2004-08-09 5:46 ` Joel Brobecker
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=41165B7A.4010601@gnu.org \
--to=cagney@gnu.org \
--cc=brobecker@gnat.com \
--cc=gdb-patches@sources.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