From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: as is: mips-tdep long doubles...
Date: Tue, 01 Jan 2013 14:03:00 -0000 [thread overview]
Message-ID: <20130101140252.GB19628@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
Hello,
Attached is a patch that might be interesting to people who are still
running GDB on mips-irix... As the FIXME suggests, it is not perfect,
but it helps. Since I will probably never find the time to improve it,
I thought I'd just publish the patch here, in case someone could use it
too.
--
Joel
[-- Attachment #2: mips-long-double.diff --]
[-- Type: text/x-diff, Size: 1560 bytes --]
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index c7684f8..89afeb8 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -187,6 +187,38 @@ static unsigned int mips_debug = 0;
struct target_desc *mips_tdesc_gp32;
struct target_desc *mips_tdesc_gp64;
+static int
+n32n64_floatformat_always_valid (const struct floatformat *fmt,
+ const void *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_n32n64_long_double_big =
+{
+ floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52,
+ floatformat_intbit_no,
+ "floatformat_n32n64_long_double_big",
+ n32n64_floatformat_always_valid
+};
+
+static const struct floatformat *floatformats_n32n64_long[BFD_ENDIAN_UNKNOWN] =
+{
+ &floatformat_n32n64_long_double_big,
+ &floatformat_n32n64_long_double_big
+};
+
const struct mips_regnum *
mips_regnum (struct gdbarch *gdbarch)
{
next reply other threads:[~2013-01-01 14:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-01 14:03 Joel Brobecker [this message]
2013-01-01 14:37 ` Joel Brobecker
2013-01-04 18:29 ` Pedro Alves
2013-01-04 19:24 ` Andreas Schwab
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=20130101140252.GB19628@adacore.com \
--to=brobecker@adacore.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