Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: gdb-patches@gcc.gnu.org
Subject: [rfc] conditional 128-bit long double
Date: Fri, 19 Mar 2004 00:09:00 -0000	[thread overview]
Message-ID: <20040307080658.GA18878@redhat.com> (raw)

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><a5a>: 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><a5a>: 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);


WARNING: multiple messages have this Message-ID
From: Richard Henderson <rth@redhat.com>
To: gdb-patches@gcc.gnu.org
Subject: [rfc] conditional 128-bit long double
Date: Sun, 07 Mar 2004 08:07:00 -0000	[thread overview]
Message-ID: <20040307080658.GA18878@redhat.com> (raw)
Message-ID: <20040307080700.x9o4uyIQLCmk2CG2Yq3GWcYc9Enop7jwb4_YubMA-Ko@z> (raw)

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><a5a>: 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><a5a>: 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);


             reply	other threads:[~2004-03-07  8:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19  0:09 Richard Henderson [this message]
2004-03-07  8:07 ` Richard Henderson
2004-03-07 20:19 ` Andrew Cagney
2004-03-19  0:09   ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040307080658.GA18878@redhat.com \
    --to=rth@redhat.com \
    --cc=gdb-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox