Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb-patches@sources.redhat.com
Subject: [patch/rfc] Delete floatformat_unknown
Date: Sun, 03 Feb 2002 22:29:00 -0000	[thread overview]
Message-ID: <3C5E2A3A.70403@cygnus.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Hello,

The idea of doing this change has been kicking around for some time.

At present TARGET_LONG_DOUBLE_FORMAT defaults to floatformat_unknown 
when the target doesn't specify it.  This patch changes things so that 
it defaults to ieee_double and in doing so matches the default value of 
TARGET_LONG_DOUBLE_BIT.

Any target that didn't define it is going get this value defined. 
Playing around with the PPC (which doesn't define this).  I have a 
feeling this is a good move.

Before:

(top-gdb) print (long double)1
$2 = 0
(top-gdb) print (double)1
$3 = 1

after:

(gdb) print (long double)1
$1 = 1
(gdb) print (double)1
$2 = 1

thoughts.  Like IEEE_FLOAT this isn't ment to break things .....

Thoughts?  Probably commit it in about a week.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 5309 bytes --]

2002-02-03  Andrew Cagney  <ac131313@redhat.com>

	* gdbarch.sh (TARGET_LONG_DOUBLE_FORMAT): Default to
	default_double_format.
	* gdbarch.h, gdbarch.c: Re-generate.
	* findvar.c (floatformat_unknown): Delete variable definition.
	* doublest.h (floatformat_unknown): Delete variable declaration.

Index: doublest.h
===================================================================
RCS file: /cvs/src/src/gdb/doublest.h,v
retrieving revision 1.8
diff -p -r1.8 doublest.h
*** doublest.h	2002/01/20 18:05:51	1.8
--- doublest.h	2002/02/04 06:08:37
***************
*** 35,42 ****
  
  #include "floatformat.h"	/* For struct floatformat */
  
- extern const struct floatformat floatformat_unknown;
- 
  /* Use `long double' if the host compiler supports it.  (Note that this is not
     necessarily any longer than `double'.  On SunOS/gcc, it's the same as
     double.)  This is necessary because GDB internally converts all floating
--- 35,40 ----
Index: findvar.c
===================================================================
RCS file: /cvs/src/src/gdb/findvar.c,v
retrieving revision 1.27
diff -p -r1.27 findvar.c
*** findvar.c	2002/01/05 04:30:17	1.27
--- findvar.c	2002/02/04 06:08:38
***************
*** 34,45 ****
  #include "symfile.h"		/* for overlay functions */
  #include "regcache.h"
  
- /* This is used to indicate that we don't know the format of the floating point
-    number.  Typically, this is useful for native ports, where the actual format
-    is irrelevant, since no conversions will be taking place.  */
- 
- const struct floatformat floatformat_unknown;
- 
  /* Basic byte-swapping routines.  GDB has needed these for a long time...
     All extract a target-format integer at ADDR which is LEN bytes long.  */
  
--- 34,39 ----
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.100
diff -p -r1.100 gdbarch.c
*** gdbarch.c	2002/01/20 18:05:51	1.100
--- gdbarch.c	2002/02/04 06:08:52
*************** verify_gdbarch (struct gdbarch *gdbarch)
*** 754,760 ****
    if (gdbarch->double_format == 0)
      gdbarch->double_format = default_double_format (gdbarch);
    if (gdbarch->long_double_format == 0)
!     gdbarch->long_double_format = &floatformat_unknown;
    /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
    /* Skip verify of addr_bits_remove, invalid_p == 0 */
    /* Skip verify of software_single_step, has predicate */
--- 754,760 ----
    if (gdbarch->double_format == 0)
      gdbarch->double_format = default_double_format (gdbarch);
    if (gdbarch->long_double_format == 0)
!     gdbarch->long_double_format = default_double_format (gdbarch);
    /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
    /* Skip verify of addr_bits_remove, invalid_p == 0 */
    /* Skip verify of software_single_step, has predicate */
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.75
diff -p -r1.75 gdbarch.h
*** gdbarch.h	2002/01/20 19:26:48	1.75
--- gdbarch.h	2002/02/04 06:09:09
*************** extern void set_gdbarch_double_format (s
*** 1982,1988 ****
  
  /* Default (value) for non- multi-arch platforms. */
  #if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_FORMAT)
! #define TARGET_LONG_DOUBLE_FORMAT (&floatformat_unknown)
  #endif
  
  extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch);
--- 1982,1988 ----
  
  /* Default (value) for non- multi-arch platforms. */
  #if (!GDB_MULTI_ARCH) && !defined (TARGET_LONG_DOUBLE_FORMAT)
! #define TARGET_LONG_DOUBLE_FORMAT (default_double_format (current_gdbarch))
  #endif
  
  extern const struct floatformat * gdbarch_long_double_format (struct gdbarch *gdbarch);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.105
diff -p -r1.105 gdbarch.sh
*** gdbarch.sh	2002/01/20 19:26:48	1.105
--- gdbarch.sh	2002/02/04 06:09:11
*************** v:2:PARM_BOUNDARY:int:parm_boundary
*** 540,546 ****
  #
  v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)
  v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)
! v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::&floatformat_unknown
  f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::core_addr_identity::0
  # On some machines there are bits in addresses which are not really
  # part of the address, but are used by the kernel, the hardware, etc.
--- 540,546 ----
  #
  v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)
  v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)
! v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (gdbarch)
  f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::core_addr_identity::0
  # On some machines there are bits in addresses which are not really
  # part of the address, but are used by the kernel, the hardware, etc.

             reply	other threads:[~2002-02-04  6:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-03 22:29 Andrew Cagney [this message]
2002-02-09 15:22 ` Andrew Cagney
2002-02-11  8:16   ` Richard Earnshaw
2002-02-11  8:45     ` 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=3C5E2A3A.70403@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=gdb-patches@sources.redhat.com \
    /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