From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13014 invoked by alias); 23 Apr 2007 21:51:25 -0000 Received: (qmail 13006 invoked by uid 22791); 23 Apr 2007 21:51:25 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO brahms.sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 23 Apr 2007 22:51:22 +0100 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0) with ESMTP id l3NLpCaS032384; Mon, 23 Apr 2007 23:51:12 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.0/8.14.0/Submit) id l3NLp9xY012977; Mon, 23 Apr 2007 23:51:09 +0200 (CEST) Date: Mon, 23 Apr 2007 22:43:00 -0000 Message-Id: <200704232151.l3NLp9xY012977@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: luisgpm@linux.vnet.ibm.com CC: gdb-patches@sourceware.org In-reply-to: <1177352366.15414.28.camel@localhost> (message from Luis Machado on Mon, 23 Apr 2007 15:19:26 -0300) Subject: Re: [patch] Detecting and printing 128-bit long double values for GDB 6.6 References: <1177352366.15414.28.camel@localhost> 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: 2007-04/txt/msg00315.txt.bz2 > From: Luis Machado > Date: Mon, 23 Apr 2007 15:19:26 -0300 > > Hi folks, > > Attached is the patch previously written by Pete Carr for correcting the > issue where GDB is unable to print the value of a 128-bit long double > variable. This patch makes GDB recognize that data type and also makes > it print the correct value with its full precision. I refreshed this > patch for GDB 6.6, in case users of this version would like to use it. > > A version of the patch for GDB HEAD is being worked on and will be > submitted soon, since it requires some code changes due to a > modification in the handling of Big endian/Little endian values. > > Best regards, > Luis Some comments that you may want to take into account in the diff you're working on: > Index: gdb/rs6000-tdep.c > =================================================================== > --- gdb/rs6000-tdep.c.orig > +++ gdb/rs6000-tdep.c > @@ -3391,7 +3391,19 @@ rs6000_gdbarch_init (struct gdbarch_info > set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); > set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); > if (sysv_abi) > - set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT); > + { > + int byte_order = gdbarch_byte_order (gdbarch); > + > + if (byte_order == BFD_ENDIAN_BIG) > + set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_big); > + else if (byte_order == BFD_ENDIAN_LITTLE) > + set_gdbarch_long_double_format (gdbarch, &floatformat_ppc64_long_double_little); > + else > + internal_error (__FILE__, __LINE__, > + _("rs6000_gdbarch_init: " > + "bad byte order")); > + set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT); > + } > else > set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); > set_gdbarch_char_signed (gdbarch, 0); This does not only change things for 64-bit powerpc, but also affects 32-bit powerpc. > Index: libiberty/floatformat.c > =================================================================== > --- libiberty/floatformat.c.orig > +++ libiberty/floatformat.c > @@ -106,6 +106,25 @@ const struct floatformat floatformat_iee > floatformat_always_valid > }; > > +/* floatformats for ppc64 long double, big and little endian. */ > +/* The layout is a pair of doubles. Don't use this description to pass */ > +/* information to get_field(). The bit size is the important thing. */ Please format your comments according to the GNU coding standards. > Index: gdb/ppc-linux-tdep.c > =================================================================== > --- gdb/ppc-linux-tdep.c.orig > +++ gdb/ppc-linux-tdep.c > @@ -1036,7 +1036,9 @@ ppc_linux_init_abi (struct gdbarch_info > Linux[sic] Standards Base says that programs that use 'long > double' on PPC GNU/Linux are non-conformant. */ > /* NOTE: cagney/2005-01-25: True for both 32- and 64-bit. */ > +#if 0 > set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); > +#endif > > if (tdep->wordsize == 4) > { Please don't #if 0 bits of code. The code is either right or it is wrong. If it is wrong, it should be removed. And in that case the comment has to be changed too of course.