aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-04-11 21:17:45 +0000
committerStu Grossman <grossman@cygnus>1996-04-11 21:17:45 +0000
commita243a22f4359c557c08d4fd962391c9f70287fec (patch)
tree018f21e57d8d9f12db5fe5f608d8536beb5e34e0 /gdb/defs.h
parent024e1779233ad7121b2bf40741cfe21b4047770e (diff)
downloadgdb-a243a22f4359c557c08d4fd962391c9f70287fec.zip
gdb-a243a22f4359c557c08d4fd962391c9f70287fec.tar.gz
gdb-a243a22f4359c557c08d4fd962391c9f70287fec.tar.bz2
* dcache.c: Add prototypes. Make many functions static.
* (dcache_peek dcache_fetch dcache_poke): Make dcache_fetch and dcache_poke call dcache_xfer_memory directly in order to fix problems with turning off dcache. dcache_peek is now unnecessary, so it goes away. * defs.h: Define new macros HOST_{FLOAT DOUBLE LONG_DOUBLE}_FORMAT and TARGET_{FLOAT DOUBLE LONG_DOUBLE}_FORMAT to specify a pointer to a struct floatformat. This allows for better handling of targets whose floating point formats differ from the host by more than just byte order. * (floatformat_to_long_double floatformat_from_long_double): Prototypes for new functions in utils.c. * (floatformat_to_doublest floatformat_from_doublest): Prototypes for pointers to floating point conversion functions. The actual function uses either double or long double if the host supports it. * findvar.c (floatformat_to_doublest floatformat_from_doublest): Initialize to point at correct function depending on HAVE_LONG_DOUBLE. * (extract_floating store_floating): Rewrite. Now, if host fp format is the same as the target, we just do a copy. Otherwise, we call floatformat_{to from}_doublest. * remote-nindy.c (nindy_xfer_inferior_memory): Change param `write' to `should_write'. * utils.c (floatformat_to_long_double floatformat_from_long_double): New routines that implement long double versions of functions in libiberty/floatformat.c. * config/i960/tm-i960.h (TARGET_LONG_DOUBLE_FORMAT): Define this for i960 extended real (80 bit) numbers. * nindy-share/nindy.c (ninMemGet ninMemPut): Return number of bytes actually read or written.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h99
1 files changed, 97 insertions, 2 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 47de9f2..0aaac1d 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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.