From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10827 invoked by alias); 9 Aug 2004 05:46:26 -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 10818 invoked from network); 9 Aug 2004 05:46:24 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sourceware.org with SMTP; 9 Aug 2004 05:46:24 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 9F9AB47D91; Sun, 8 Aug 2004 22:46:23 -0700 (PDT) Date: Mon, 09 Aug 2004 05:46:00 -0000 From: Joel Brobecker To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA/mips] Fix crash trying to print long double float Message-ID: <20040809054623.GL1192@gnat.com> 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> <41165B7A.4010601@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="JgQwtEuHJzHdouWu" Content-Disposition: inline In-Reply-To: <41165B7A.4010601@gnu.org> User-Agent: Mutt/1.4i X-SW-Source: 2004-08/txt/msg00292.txt.bz2 --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 493 > >Tested on mips-irix. OK to apply? > > Yes, with these tweaks, commit: Thanks. Here is what I just checked in: 2004-08-08 Joel Brobecker * mips-tdep.c: Include "floatformat.h". (n32n64_floatformat_always_valid): New function. (floatformat_n32n64_long_double_big): New constant. (mips_gdbarch_init): Set size and format of long double for N32 and N64 ABIs. * Makefile.in (mips-tdep.o): Update dependencies. -- Joel --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ld.diff" Content-length: 3471 Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.309 diff -u -p -r1.309 mips-tdep.c --- mips-tdep.c 3 Aug 2004 01:12:43 -0000 1.309 +++ mips-tdep.c 8 Aug 2004 17:26:15 -0000 @@ -54,6 +54,7 @@ #include "frame-base.h" #include "trad-frame.h" #include "infcall.h" +#include "floatformat.h" static const struct objfile_data *mips_pdr_data; @@ -149,6 +150,32 @@ struct gdbarch_tdep const char **mips_processor_reg_names; }; +static int +n32n64_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_n32n64_long_double_big = +{ + floatformat_big, 128, 0, 1, 11, 1023, 2047, 12, 52, + floatformat_intbit_no, + "floatformat_ieee_double_big", + n32n64_floatformat_always_valid +}; + const struct mips_regnum * mips_regnum (struct gdbarch *gdbarch) { @@ -6323,6 +6350,9 @@ mips_gdbarch_init (struct gdbarch_info i set_gdbarch_long_bit (gdbarch, 32); set_gdbarch_ptr_bit (gdbarch, 32); set_gdbarch_long_long_bit (gdbarch, 64); + set_gdbarch_long_double_bit (gdbarch, 128); + set_gdbarch_long_double_format (gdbarch, + &floatformat_n32n64_long_double_big); break; case MIPS_ABI_N64: set_gdbarch_push_dummy_call (gdbarch, mips_n32n64_push_dummy_call); @@ -6333,6 +6363,9 @@ mips_gdbarch_init (struct gdbarch_info i set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); + set_gdbarch_long_double_bit (gdbarch, 128); + set_gdbarch_long_double_format (gdbarch, + &floatformat_n32n64_long_double_big); break; default: internal_error (__FILE__, __LINE__, "unknown ABI in switch"); Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.606 diff -u -p -r1.606 Makefile.in --- Makefile.in 6 Aug 2004 19:14:44 -0000 1.606 +++ Makefile.in 8 Aug 2004 17:26:16 -0000 @@ -2206,7 +2206,8 @@ mips-tdep.o: mips-tdep.c $(defs_h) $(gdb $(target_h) $(arch_utils_h) $(regcache_h) $(osabi_h) $(mips_tdep_h) \ $(block_h) $(reggroups_h) $(opcode_mips_h) $(elf_mips_h) \ $(elf_bfd_h) $(symcat_h) $(sim_regno_h) $(dis_asm_h) \ - $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(infcall_h) + $(frame_unwind_h) $(frame_base_h) $(trad_frame_h) $(infcall_h) \ + $(floatformat_h) mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ $(regcache_h) $(gregset_h) mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ --JgQwtEuHJzHdouWu--