From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18376 invoked by alias); 7 Mar 2004 08:07:06 -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 18369 invoked from network); 7 Mar 2004 08:07:05 -0000 Received: from unknown (HELO mx2.redhat.com) (66.187.237.31) by sources.redhat.com with SMTP; 7 Mar 2004 08:07:05 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.11.6/8.11.6) with ESMTP id i277fhG07356 for ; Sun, 7 Mar 2004 02:41:43 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i27873M30088 for ; Sun, 7 Mar 2004 03:07:04 -0500 Received: from dorothy.sfbay.redhat.com (dorothy.sfbay.redhat.com [172.16.24.82]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i2786wR24443 for ; Sun, 7 Mar 2004 00:06:58 -0800 Received: from rth by dorothy.sfbay.redhat.com with local (Exim 3.36 #1 (Debian)) id 1AztJK-0004w6-00 for ; Sun, 07 Mar 2004 00:06:58 -0800 Date: Fri, 19 Mar 2004 00:09:00 -0000 To: gdb-patches@gcc.gnu.org Subject: [rfc] conditional 128-bit long double Message-ID: <20040307080658.GA18878@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Henderson X-SW-Source: 2004-03/txt/msg00132.txt.bz2 I'm somewhere in the middle of transitioning alpha-linux to a 128-bit long double type. I have two interests: one, not crashing when trying to print such a value. Two, doing approximately the right thing for folks on either side of the transition. Drow seemed to think that the following might be close, and that does in fact seem to be true. Note the small inconsistency wrt sizeof here: long double x = 1; main() { return 0; } [dorothy:~] gcc -g z.c -mlong-double-64 -o a.out [dorothy:~] gcc -g z.c -mlong-double-128 -o b.out [dorothy:~] gdb ./a.out (gdb) p x $1 = 1 (gdb) ptype x type = long double (gdb) p sizeof(x) $2 = 8 (gdb) p sizeof(long double) $3 = 16 (gdb) q [dorothy:~] gdb ./b.out (gdb) p x $1 = 1 (gdb) ptype x type = long double (gdb) p sizeof(x) $2 = 16 (gdb) q The only thing that would be better is if gdb could look up long double in the debug info: From a.out: <1>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : long double DW_AT_byte_size : 8 DW_AT_encoding : 4 (float) From b.out: <1>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : long double DW_AT_byte_size : 16 DW_AT_encoding : 4 (float) but I have no idea if one could even think doing such a thing in gdb. I expect to *never* have to handle applications with mismatched types, as I'm planning to bump the libc version number before this is over. Thoughts? r~ * alpha-tdep.c (alpha_gdbarch_init): Set for 128-bit long double. Index: alpha-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/alpha-tdep.c,v retrieving revision 1.127 diff -c -p -d -r1.127 alpha-tdep.c *** alpha-tdep.c 16 Feb 2004 21:49:21 -0000 1.127 --- alpha-tdep.c 7 Mar 2004 07:55:42 -0000 *************** *** 1,6 **** /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. ! Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ! Free Software Foundation, Inc. This file is part of GDB. --- 1,6 ---- /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. ! Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, ! 2004 Free Software Foundation, Inc. This file is part of GDB. *************** alpha_gdbarch_init (struct gdbarch_info *** 1498,1507 **** set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); ! set_gdbarch_long_double_bit (gdbarch, 64); ! set_gdbarch_ptr_bit (gdbarch, 64); /* Register info */ set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS); --- 1498,1514 ---- set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); + set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); ! ! /* Try to cope with -mlong-double-128. When using dwarf2, we hope this ! does the right thing by virtue of the fact that we only get a size ! from the debug info and infer the type from that. We'll have small ! inconsistencies in random places, but that seems better than crashing ! when the gcc option is enabled. */ ! set_gdbarch_long_double_bit (gdbarch, 128); ! set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little); /* Register info */ set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS); From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18376 invoked by alias); 7 Mar 2004 08:07:06 -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 18369 invoked from network); 7 Mar 2004 08:07:05 -0000 Received: from unknown (HELO mx2.redhat.com) (66.187.237.31) by sources.redhat.com with SMTP; 7 Mar 2004 08:07:05 -0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.11.6/8.11.6) with ESMTP id i277fhG07356 for ; Sun, 7 Mar 2004 02:41:43 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i27873M30088 for ; Sun, 7 Mar 2004 03:07:04 -0500 Received: from dorothy.sfbay.redhat.com (dorothy.sfbay.redhat.com [172.16.24.82]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i2786wR24443 for ; Sun, 7 Mar 2004 00:06:58 -0800 Received: from rth by dorothy.sfbay.redhat.com with local (Exim 3.36 #1 (Debian)) id 1AztJK-0004w6-00 for ; Sun, 07 Mar 2004 00:06:58 -0800 Date: Sun, 07 Mar 2004 08:07:00 -0000 To: gdb-patches@gcc.gnu.org Subject: [rfc] conditional 128-bit long double Message-ID: <20040307080658.GA18878@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Henderson X-SW-Source: 2004-03.o/txt/msg00132.txt Message-ID: <20040307080700.x9o4uyIQLCmk2CG2Yq3GWcYc9Enop7jwb4_YubMA-Ko@z> I'm somewhere in the middle of transitioning alpha-linux to a 128-bit long double type. I have two interests: one, not crashing when trying to print such a value. Two, doing approximately the right thing for folks on either side of the transition. Drow seemed to think that the following might be close, and that does in fact seem to be true. Note the small inconsistency wrt sizeof here: long double x = 1; main() { return 0; } [dorothy:~] gcc -g z.c -mlong-double-64 -o a.out [dorothy:~] gcc -g z.c -mlong-double-128 -o b.out [dorothy:~] gdb ./a.out (gdb) p x $1 = 1 (gdb) ptype x type = long double (gdb) p sizeof(x) $2 = 8 (gdb) p sizeof(long double) $3 = 16 (gdb) q [dorothy:~] gdb ./b.out (gdb) p x $1 = 1 (gdb) ptype x type = long double (gdb) p sizeof(x) $2 = 16 (gdb) q The only thing that would be better is if gdb could look up long double in the debug info: From a.out: <1>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : long double DW_AT_byte_size : 8 DW_AT_encoding : 4 (float) From b.out: <1>: Abbrev Number: 3 (DW_TAG_base_type) DW_AT_name : long double DW_AT_byte_size : 16 DW_AT_encoding : 4 (float) but I have no idea if one could even think doing such a thing in gdb. I expect to *never* have to handle applications with mismatched types, as I'm planning to bump the libc version number before this is over. Thoughts? r~ * alpha-tdep.c (alpha_gdbarch_init): Set for 128-bit long double. Index: alpha-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/alpha-tdep.c,v retrieving revision 1.127 diff -c -p -d -r1.127 alpha-tdep.c *** alpha-tdep.c 16 Feb 2004 21:49:21 -0000 1.127 --- alpha-tdep.c 7 Mar 2004 07:55:42 -0000 *************** *** 1,6 **** /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. ! Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ! Free Software Foundation, Inc. This file is part of GDB. --- 1,6 ---- /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. ! Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, ! 2004 Free Software Foundation, Inc. This file is part of GDB. *************** alpha_gdbarch_init (struct gdbarch_info *** 1498,1507 **** set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); ! set_gdbarch_long_double_bit (gdbarch, 64); ! set_gdbarch_ptr_bit (gdbarch, 64); /* Register info */ set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS); --- 1498,1514 ---- set_gdbarch_int_bit (gdbarch, 32); set_gdbarch_long_bit (gdbarch, 64); set_gdbarch_long_long_bit (gdbarch, 64); + set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_float_bit (gdbarch, 32); set_gdbarch_double_bit (gdbarch, 64); ! ! /* Try to cope with -mlong-double-128. When using dwarf2, we hope this ! does the right thing by virtue of the fact that we only get a size ! from the debug info and infer the type from that. We'll have small ! inconsistencies in random places, but that seems better than crashing ! when the gcc option is enabled. */ ! set_gdbarch_long_double_bit (gdbarch, 128); ! set_gdbarch_long_double_format (gdbarch, &floatformat_ia64_quad_little); /* Register info */ set_gdbarch_num_regs (gdbarch, ALPHA_NUM_REGS);