mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:51:15 +08:00
* doublest.h (store_floating, extract_floating): Add comment
indicating these functions are deprecated. (extract_typed_floating, store_typed_floating): Declare. * doublest.c: Include "gdbtypes.h". (extract_typed_floating, store_typed_floating): Define. * stabsread.c (define_symbol): Use store_typed_floating. * valarith.c (value_binop): Ditto. * values.c (unpack_long): Use extract_typed_floating. (unpack_double): Ditto.
This commit is contained in:
parent
2f8d8971c6
commit
96d2f608dc
@ -1,3 +1,16 @@
|
||||
2001-09-24 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* doublest.h (store_floating, extract_floating): Add comment
|
||||
indicating these functions are deprecated.
|
||||
(extract_typed_floating, store_typed_floating): Declare.
|
||||
* doublest.c: Include "gdbtypes.h".
|
||||
(extract_typed_floating, store_typed_floating): Define.
|
||||
|
||||
* stabsread.c (define_symbol): Use store_typed_floating.
|
||||
* valarith.c (value_binop): Ditto.
|
||||
* values.c (unpack_long): Use extract_typed_floating.
|
||||
(unpack_double): Ditto.
|
||||
|
||||
2001-09-24 Orjan Friberg <orjanf@axis.com>
|
||||
|
||||
* cris-tdep.c (reg_mode_add_sub_cmp_and_or_move_op): Fetch operand1
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "floatformat.h"
|
||||
#include "gdb_assert.h"
|
||||
#include "gdb_string.h"
|
||||
#include "gdbtypes.h"
|
||||
#include <math.h> /* ldexp */
|
||||
|
||||
/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not
|
||||
@ -606,8 +607,12 @@ floatformat_from_doublest (const struct floatformat *fmt,
|
||||
}
|
||||
|
||||
|
||||
/* Extract/store a floating-point number from a target-order
|
||||
byte-stream at ADDR. Returns the value as type DOUBLEST. */
|
||||
/* Extract/store a target floating-point number from byte-stream at
|
||||
ADDR to/from a DOUBLEST. The LEN is used to select between the
|
||||
pre-defined target type FLOAT, DOUBLE or LONG_DOUBLE. These
|
||||
functions are used when extract/store typed floating() find that
|
||||
the ``struct type'' did not include a FLOATFORMAT (e.g. some symbol
|
||||
table readers and XXX-language support modules). */
|
||||
|
||||
DOUBLEST
|
||||
extract_floating (const void *addr, int len)
|
||||
@ -652,3 +657,34 @@ store_floating (void *addr, int len, DOUBLEST val)
|
||||
error ("Can't deal with a floating point number of %d bytes.", len);
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract/store a floating-point number of format TYPE from a
|
||||
target-ordered byte-stream at ADDR to/from an internal DOUBLEST
|
||||
accroding to its TYPE_FORMAT(). When GDB reads in debug
|
||||
information, it is sometimes only provided with the type name, its
|
||||
length and the fact that it is a float (TYPE_FORMAT() is not set).
|
||||
For such types, the old extract/store floating() functions are
|
||||
used. */
|
||||
|
||||
DOUBLEST
|
||||
extract_typed_floating (const void *addr, const struct type *type)
|
||||
{
|
||||
DOUBLEST retval;
|
||||
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
|
||||
if (TYPE_FLOATFORMAT (type) == NULL)
|
||||
retval = extract_floating (addr, TYPE_LENGTH (type));
|
||||
else
|
||||
floatformat_to_doublest (TYPE_FLOATFORMAT (type), addr, &retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
void
|
||||
store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
|
||||
{
|
||||
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
|
||||
memset (addr, 0, TYPE_LENGTH (type));
|
||||
if (TYPE_FLOATFORMAT (type) == NULL)
|
||||
store_floating (addr, TYPE_LENGTH (type), val);
|
||||
else
|
||||
floatformat_from_doublest (TYPE_FLOATFORMAT (type), &val, addr);
|
||||
}
|
||||
|
@ -61,7 +61,13 @@ extern int floatformat_is_negative (const struct floatformat *, char *);
|
||||
extern int floatformat_is_nan (const struct floatformat *, char *);
|
||||
extern char *floatformat_mantissa (const struct floatformat *, char *);
|
||||
|
||||
extern DOUBLEST extract_floating (const void *in, int);
|
||||
extern void store_floating (void *, int, DOUBLEST);
|
||||
/* Use extract_typed_float() and store_typed_float(). */
|
||||
extern DOUBLEST extract_floating (const void *in, int); /* DEPRECATED */
|
||||
extern void store_floating (void *, int, DOUBLEST); /* DEPRECATED */
|
||||
|
||||
extern DOUBLEST extract_typed_floating (const void *addr,
|
||||
const struct type *type);
|
||||
extern void store_typed_floating (void *addr, const struct type *type,
|
||||
DOUBLEST val);
|
||||
|
||||
#endif
|
||||
|
@ -1491,7 +1491,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
||||
dbl_valu = (char *)
|
||||
obstack_alloc (&objfile->symbol_obstack,
|
||||
TYPE_LENGTH (SYMBOL_TYPE (sym)));
|
||||
store_floating (dbl_valu, TYPE_LENGTH (SYMBOL_TYPE (sym)), d);
|
||||
store_typed_floating (dbl_valu, SYMBOL_TYPE (sym), d);
|
||||
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
|
||||
SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
|
||||
}
|
||||
|
@ -763,8 +763,7 @@ value_binop (value_ptr arg1, value_ptr arg2, enum exp_opcode op)
|
||||
else
|
||||
val = allocate_value (builtin_type_double);
|
||||
|
||||
store_floating (VALUE_CONTENTS_RAW (val), TYPE_LENGTH (VALUE_TYPE (val)),
|
||||
v);
|
||||
store_typed_floating (VALUE_CONTENTS_RAW (val), VALUE_TYPE (val), v);
|
||||
}
|
||||
else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
|
||||
&&
|
||||
|
@ -645,7 +645,7 @@ unpack_long (struct type *type, char *valaddr)
|
||||
return extract_signed_integer (valaddr, len);
|
||||
|
||||
case TYPE_CODE_FLT:
|
||||
return extract_floating (valaddr, len);
|
||||
return extract_typed_floating (valaddr, type);
|
||||
|
||||
case TYPE_CODE_PTR:
|
||||
case TYPE_CODE_REF:
|
||||
@ -689,7 +689,7 @@ unpack_double (struct type *type, char *valaddr, int *invp)
|
||||
return 1.234567891011121314;
|
||||
}
|
||||
#endif
|
||||
return extract_floating (valaddr, len);
|
||||
return extract_typed_floating (valaddr, type);
|
||||
}
|
||||
else if (nosign)
|
||||
{
|
||||
@ -1297,7 +1297,7 @@ value_from_double (struct type *type, DOUBLEST num)
|
||||
|
||||
if (code == TYPE_CODE_FLT)
|
||||
{
|
||||
store_floating (VALUE_CONTENTS_RAW (val), len, num);
|
||||
store_typed_floating (VALUE_CONTENTS_RAW (val), base_type, num);
|
||||
}
|
||||
else
|
||||
error ("Unexpected type encountered for floating constant.");
|
||||
|
Loading…
Reference in New Issue
Block a user