From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19585 invoked by alias); 1 Jan 2013 14:03:10 -0000 Received: (qmail 19570 invoked by uid 22791); 1 Jan 2013 14:03:09 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 01 Jan 2013 14:02:59 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 06F691C6830 for ; Tue, 1 Jan 2013 09:02:59 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id JN4NgQlD+Nlg for ; Tue, 1 Jan 2013 09:02:58 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8C5AA1C659E for ; Tue, 1 Jan 2013 09:02:58 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 6D6E5C270A; Tue, 1 Jan 2013 18:02:52 +0400 (RET) Date: Tue, 01 Jan 2013 14:03:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: as is: mips-tdep long doubles... Message-ID: <20130101140252.GB19628@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-01/txt/msg00006.txt.bz2 --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 306 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 --UlVJffcvxoiEqYs2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="mips-long-double.diff" Content-length: 1560 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) { --UlVJffcvxoiEqYs2--