From bf5c0d644899aa224fcac5eb0b5dff2002d6448c Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Fri, 29 Oct 1993 18:16:33 +0000 Subject: * defs.h, findvar.c (extract_floating, store_floating): New functions. * Move SWAP_TARGET_AND_HOST from defs.h to findvar.c because it is now used only by extract_floating and store_floating. * valprint.c (print_floating): Use unsigned arithmetic. Use extract_unsigned_integer instead of SWAP_TARGET_AND_HOST. Change sizeof (float) to 4 and sizeof (double) to 8 (those are always the relevant sizes for this code, which is in #ifdef IEEE_FLOAT). * values.c (unpack_long, unpack_double, value_from_double), valarith.c (value_binop), stabsread.c (define_symbol): Use extract_floating and store_floating instead of SWAP_TARGET_AND_HOST. * config/m68k/tm-m68k.h, config/i960/tm-i960.h (REGISTER_CONVERT_*): Use extract_floating and store_floating. * config/m88k/tm-m88k.h: Add comments (it should be doing the same). * i386-tdep.c (i386_extract_return_value), * remote-nindy.c (nindy_store_registers): Use store_floating. --- gdb/stabsread.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gdb/stabsread.c') diff --git a/gdb/stabsread.c b/gdb/stabsread.c index f2d671c..71a806e 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -613,11 +613,13 @@ define_symbol (valu, string, desc, type, objfile) double d = atof (p); char *dbl_valu; + /* FIXME-if-picky-about-floating-accuracy: Should be using + target arithmetic to get the value. real.c in GCC + probably has the necessary code. */ + /* FIXME: lookup_fundamental_type is a hack. We should be creating a type especially for the type of float constants. - Problem is, what type should it be? We currently have to - read this in host floating point format, but what type - represents a host format "double"? + Problem is, what type should it be? Also, what should the name of this type be? Should we be using 'S' constants (see stabs.texinfo) instead? */ @@ -625,11 +627,9 @@ define_symbol (valu, string, desc, type, objfile) SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile, FT_DBL_PREC_FLOAT); dbl_valu = (char *) - obstack_alloc (&objfile -> symbol_obstack, sizeof (double)); - memcpy (dbl_valu, &d, sizeof (double)); - /* Put it in target byte order, but it's still in host - floating point format. */ - SWAP_TARGET_AND_HOST (dbl_valu, sizeof (double)); + obstack_alloc (&objfile -> symbol_obstack, + TYPE_LENGTH (SYMBOL_TYPE (sym))); + store_floating (dbl_valu, TYPE_LENGTH (SYMBOL_TYPE (sym))); SYMBOL_VALUE_BYTES (sym) = dbl_valu; SYMBOL_CLASS (sym) = LOC_CONST_BYTES; } -- cgit v1.1