From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23941 invoked by alias); 8 Aug 2004 16:57:43 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 23933 invoked from network); 8 Aug 2004 16:57:42 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 8 Aug 2004 16:57:42 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i78Gvge3002407 for ; Sun, 8 Aug 2004 12:57:42 -0400 Received: from localhost.redhat.com (porkchop.devel.redhat.com [172.16.58.2]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i78Gvaa02803; Sun, 8 Aug 2004 12:57:37 -0400 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 480E52B9D; Sun, 8 Aug 2004 12:57:30 -0400 (EDT) Message-ID: <41165B7A.4010601@gnu.org> Date: Sun, 08 Aug 2004 16:57:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040801 MIME-Version: 1.0 To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA/mips] Fix crash trying to print long double float References: <20040806181603.GQ1203@gnat.com> <20040806203243.GV1192@gnat.com> <411518CB.5060104@gnu.org> <20040807180927.GA1192@gnat.com> <41151DF9.5000706@gnu.org> <20040808065934.GG1192@gnat.com> In-Reply-To: <20040808065934.GG1192@gnat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00261.txt.bz2 > How's this? > > 2004-08-08 Joel Brobecker > > * 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