diff options
Diffstat (limited to 'gdb/defs.h')
-rw-r--r-- | gdb/defs.h | 99 |
1 files changed, 97 insertions, 2 deletions
@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DEFS_H #define DEFS_H +#include "config.h" /* Generated by configure */ #include <stdio.h> #include <errno.h> /* System call error return status */ @@ -811,6 +812,8 @@ extern LONGEST extract_signed_integer PARAMS ((void *, int)); extern unsigned LONGEST extract_unsigned_integer PARAMS ((void *, int)); +extern int extract_long_unsigned_integer PARAMS ((void *, int, LONGEST *)); + extern CORE_ADDR extract_address PARAMS ((void *, int)); extern void store_signed_integer PARAMS ((void *, int, LONGEST)); @@ -819,9 +822,101 @@ extern void store_unsigned_integer PARAMS ((void *, int, unsigned LONGEST)); extern void store_address PARAMS ((void *, int, CORE_ADDR)); -extern double extract_floating PARAMS ((void *, int)); +/* Setup definitions for host and target floating point formats. We need to + consider the format for `float', `double', and `long double' for both target + and host. We need to do this so that we know what kind of conversions need + to be done when converting target numbers to and from the hosts DOUBLEST + data type. */ + +/* 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. */ + +extern const struct floatformat floatformat_unknown; + +#if HOST_BYTE_ORDER == BIG_ENDIAN +# ifndef HOST_FLOAT_FORMAT +# define HOST_FLOAT_FORMAT &floatformat_ieee_single_big +# endif +# ifndef HOST_DOUBLE_FORMAT +# define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big +# endif +#else /* LITTLE_ENDIAN */ +# ifndef HOST_FLOAT_FORMAT +# define HOST_FLOAT_FORMAT &floatformat_ieee_single_little +# endif +# ifndef HOST_DOUBLE_FORMAT +# define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little +# endif +#endif + +#ifndef HOST_LONG_DOUBLE_FORMAT +#define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown +#endif + +#ifndef TARGET_BYTE_ORDER_SELECTABLE +# if TARGET_BYTE_ORDER == BIG_ENDIAN +# ifndef TARGET_FLOAT_FORMAT +# define TARGET_FLOAT_FORMAT &floatformat_ieee_single_big +# endif +# ifndef TARGET_DOUBLE_FORMAT +# define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_big +# endif +# else /* LITTLE_ENDIAN */ +# ifndef TARGET_FLOAT_FORMAT +# define TARGET_FLOAT_FORMAT &floatformat_ieee_single_little +# endif +# ifndef TARGET_DOUBLE_FORMAT +# define TARGET_DOUBLE_FORMAT &floatformat_ieee_double_little +# endif +# endif +# ifndef TARGET_LONG_DOUBLE_FORMAT +# define TARGET_LONG_DOUBLE_FORMAT &floatformat_unknown +# endif +#else /* TARGET_BYTE_ORDER_SELECTABLE */ +# ifndef TARGET_FLOAT_FORMAT + Need a definition for target float format +# endif +# ifndef TARGET_DOUBLE_FORMAT + Need a definition for target double format +# endif +# ifndef TARGET_LONG_DOUBLE_FORMAT + Need a definition for target long double format +# endif +#endif + +/* 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 + point values to the widest type supported by the host. + + There are problems however, when the target `long double' is longer than the + host's `long double'. In general, we'll probably reduce the precision of + any such values and print a warning. */ + +#ifdef HAVE_LONG_DOUBLE +typedef long double DOUBLEST; +extern void floatformat_to_long_double PARAMS ((const struct floatformat *, + char *, DOUBLEST *)); +extern void floatformat_from_long_double PARAMS ((const struct floatformat *, + DOUBLEST *, char *)); +#else +typedef double DOUBLEST; +#endif + +/* Pointer to appropriate conversion routine to convert between target floating + point format and DOUBLEST. */ + +extern void +(*floatformat_to_doublest) PARAMS ((const struct floatformat *, + char *, DOUBLEST *)); +extern void +(*floatformat_from_doublest) PARAMS ((const struct floatformat *, + DOUBLEST *, char *)); + +extern DOUBLEST extract_floating PARAMS ((void *, int)); -extern void store_floating PARAMS ((void *, int, double)); +extern void store_floating PARAMS ((void *, int, DOUBLEST)); /* 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. |