diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-07-29 19:33:22 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-07-29 19:33:22 +0000 |
commit | c35f4ffcade07bba900aa312c2d0c2242113c5d4 (patch) | |
tree | e390333b017573517e5a1a7e3fcb2700c655831b | |
parent | 624a44a3c41144731bebbdbe1c3994ed868951e3 (diff) | |
download | gdb-c35f4ffcade07bba900aa312c2d0c2242113c5d4.zip gdb-c35f4ffcade07bba900aa312c2d0c2242113c5d4.tar.gz gdb-c35f4ffcade07bba900aa312c2d0c2242113c5d4.tar.bz2 |
2004-07-29 Andrew Cagney <cagney@gnu.org>
* config/pa/xm-linux.h: Do not include "floatformat.h".
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros.
* config/i386/xm-i386.h: Do not include "floatformat.h".
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros.
* doublest.c (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT): Delete macros. Use
GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT and
GDB_HOST_LONG_DOUBLE_FORMAT instead.
* configure.in (GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT)
(GDB_HOST_LONG_DOUBLE_FORMAT): Define.
* configure, config.in: Regenerate.
* configure.host (gdb_host_float_format, gdb_host_double_format)
(gdb_host_long_double_format): Set according to the host.
-rw-r--r-- | gdb/ChangeLog | 18 | ||||
-rw-r--r-- | gdb/config.in | 9 | ||||
-rw-r--r-- | gdb/config/i386/xm-i386.h | 6 | ||||
-rw-r--r-- | gdb/config/pa/xm-linux.h | 6 | ||||
-rwxr-xr-x | gdb/configure | 50 | ||||
-rw-r--r-- | gdb/configure.host | 30 | ||||
-rw-r--r-- | gdb/configure.in | 5 | ||||
-rw-r--r-- | gdb/doublest.c | 31 |
8 files changed, 106 insertions, 49 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8269d72..c71f2e9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,23 @@ 2004-07-29 Andrew Cagney <cagney@gnu.org> + * config/pa/xm-linux.h: Do not include "floatformat.h". + (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. + * config/i386/xm-i386.h: Do not include "floatformat.h". + (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. + * doublest.c (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) + (HOST_LONG_DOUBLE_FORMAT): Delete macros. Use + GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT and + GDB_HOST_LONG_DOUBLE_FORMAT instead. + * configure.in (GDB_HOST_FLOAT_FORMAT, GDB_HOST_DOUBLE_FORMAT) + (GDB_HOST_LONG_DOUBLE_FORMAT): Define. + * configure, config.in: Regenerate. + * configure.host (gdb_host_float_format, gdb_host_double_format) + (gdb_host_long_double_format): Set according to the host. + +2004-07-29 Andrew Cagney <cagney@gnu.org> + * Makefile.in (CONFIG_CLEAN): Delete duplicate definition. 2004-07-28 Andrew Cagney <cagney@gnu.org> diff --git a/gdb/config.in b/gdb/config.in index 7da9038..933f3a0 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -540,6 +540,15 @@ /* Define if we can use the tkill syscall. */ #undef HAVE_TKILL_SYSCALL +/* Host float floatformat */ +#undef GDB_HOST_FLOAT_FORMAT + +/* Host double floatformat */ +#undef GDB_HOST_DOUBLE_FORMAT + +/* Host long double floatformat */ +#undef GDB_HOST_LONG_DOUBLE_FORMAT + /* Define to the default OS ABI for this configuration. */ #undef GDB_OSABI_DEFAULT diff --git a/gdb/config/i386/xm-i386.h b/gdb/config/i386/xm-i386.h index de29b26..e4ba146 100644 --- a/gdb/config/i386/xm-i386.h +++ b/gdb/config/i386/xm-i386.h @@ -22,10 +22,4 @@ #ifndef XM_I386_H #define XM_I386_H -#include "floatformat.h" - -#define HOST_FLOAT_FORMAT &floatformat_ieee_single_little -#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little -#define HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext - #endif /* xm-i386.h */ diff --git a/gdb/config/pa/xm-linux.h b/gdb/config/pa/xm-linux.h index ceb6ed2..81847be 100644 --- a/gdb/config/pa/xm-linux.h +++ b/gdb/config/pa/xm-linux.h @@ -22,10 +22,4 @@ #ifndef XM_HPPA_LINUX_H #define XM_HPPA_LINUX_H -#include "floatformat.h" - -#define HOST_FLOAT_FORMAT &floatformat_ieee_single_big -#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big -#define HOST_LONG_DOUBLE_FORMAT &floatformat_ieee_double_big - #endif /* xm-linux.h */ diff --git a/gdb/configure b/gdb/configure index 8b7d2a9..d56de71 100755 --- a/gdb/configure +++ b/gdb/configure @@ -10563,6 +10563,20 @@ fi +# List of host floatformats. +cat >> confdefs.h <<EOF +#define GDB_HOST_FLOAT_FORMAT $gdb_host_float_format +EOF + +cat >> confdefs.h <<EOF +#define GDB_HOST_DOUBLE_FORMAT $gdb_host_double_format +EOF + +cat >> confdefs.h <<EOF +#define GDB_HOST_LONG_DOUBLE_FORMAT $gdb_host_long_double_format +EOF + + # target_subdir is used by the testsuite to find the target libraries. target_subdir= if test "${host}" != "${target}"; then @@ -10636,7 +10650,7 @@ fi # We only build gdbserver automatically if host and target are the same. if test "x$target" = "x$host"; then echo $ac_n "checking whether gdbserver is supported on this host""... $ac_c" 1>&6 -echo "configure:10640: checking whether gdbserver is supported on this host" >&5 +echo "configure:10654: checking whether gdbserver is supported on this host" >&5 if test "x$build_gdbserver" = xyes; then configdirs="$configdirs gdbserver" echo "$ac_t""yes" 1>&6 @@ -10700,12 +10714,12 @@ fi echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:10704: checking for Cygwin environment" >&5 +echo "configure:10718: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10709 "configure" +#line 10723 "configure" #include "confdefs.h" int main() { @@ -10716,7 +10730,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:10720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -10733,19 +10747,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:10737: checking for mingw32 environment" >&5 +echo "configure:10751: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10742 "configure" +#line 10756 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:10749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -10764,7 +10778,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:10768: checking for executable suffix" >&5 +echo "configure:10782: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10774,10 +10788,10 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:10778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:10792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.c | *.C | *.o | *.obj | *.ilk | *.pdb) ;; + *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -10816,7 +10830,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:10820: checking for iconv" >&5 +echo "configure:10834: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -10824,7 +10838,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 10828 "configure" +#line 10842 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10834,7 +10848,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -10846,7 +10860,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS -liconv" cat > conftest.$ac_ext <<EOF -#line 10850 "configure" +#line 10864 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -10856,7 +10870,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:10860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -10877,13 +10891,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:10881: checking for iconv declaration" >&5 +echo "configure:10895: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 10887 "configure" +#line 10901 "configure" #include "confdefs.h" #include <stdlib.h> @@ -10902,7 +10916,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:10906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:10920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else diff --git a/gdb/configure.host b/gdb/configure.host index a2a8d5d..71436bf 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -2,8 +2,11 @@ # invoked from the autoconf generated configure script. # This file sets the following shell variables: -# gdb_host_cpu generic name of host's CPU -# gdb_host name of GDB host definition to use +# gdb_host_cpu generic name of host's CPU +# gdb_host name of GDB host definition to use +# gdb_host_float_format host's float floatformat, or 0 +# gdb_host_double_format host's double floatformat, or 0 +# gdb_host_long_double_format host's long double floatformat, or 0 # Map host cpu into the config cpu subdirectory name. # The default is $host_cpu. @@ -145,3 +148,26 @@ x86_64-*-openbsd*) gdb_host=obsd64 ;; m32r*-*-linux*) gdb_host=linux ;; esac + + + +# Map the host/cpu onto the floatformat correspondong to C's "float", +# "double" and "long double" types. + +case "${host}" in +i[34567]86-*-*) + gdb_host_float_format="&floatformat_ieee_single_little" + gdb_host_double_format="&floatformat_ieee_double_little" + gdb_host_long_double_format="&floatformat_i387_ext" + ;; +hppa*-*-linux*) + gdb_host_float_format="&floatformat_ieee_single_big" + gdb_host_double_format="&floatformat_ieee_double_big" + gdb_host_long_double_format="&floatformat_ieee_double_big" + ;; +*) + gdb_host_float_format=0 + gdb_host_double_format=0 + gdb_host_long_double_format=0 + ;; +esac diff --git a/gdb/configure.in b/gdb/configure.in index ef5f17a..f5f3e98 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -1300,6 +1300,11 @@ AC_SUBST(CONFIG_CLEAN) AC_SUBST(CONFIG_INSTALL) AC_SUBST(CONFIG_UNINSTALL) +# List of host floatformats. +AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat]) +AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat]) +AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat]) + # target_subdir is used by the testsuite to find the target libraries. target_subdir= if test "${host}" != "${target}"; then diff --git a/gdb/doublest.c b/gdb/doublest.c index 3f283e1..10f4dfb 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -91,10 +91,17 @@ get_field (unsigned char *data, enum floatformat_byteorders order, { result |= (unsigned long)*(data + cur_byte) << cur_bitshift; cur_bitshift += FLOATFORMAT_CHAR_BIT; - if (order == floatformat_little || order == floatformat_littlebyte_bigword) - ++cur_byte; - else - --cur_byte; + switch (order) + { + case floatformat_little: + ++cur_byte; + break; + case floatformat_big: + --cur_byte; + break; + case floatformat_littlebyte_bigword: + break; + } } if (len < sizeof(result) * FLOATFORMAT_CHAR_BIT) /* Mask out bits which are not part of the field */ @@ -554,19 +561,9 @@ floatformat_mantissa (const struct floatformat *fmt, char *val) increase precision as necessary. Otherwise, we call the conversion routine and let it do the dirty work. */ -#ifndef HOST_FLOAT_FORMAT -#define HOST_FLOAT_FORMAT 0 -#endif -#ifndef HOST_DOUBLE_FORMAT -#define HOST_DOUBLE_FORMAT 0 -#endif -#ifndef HOST_LONG_DOUBLE_FORMAT -#define HOST_LONG_DOUBLE_FORMAT 0 -#endif - -static const struct floatformat *host_float_format = HOST_FLOAT_FORMAT; -static const struct floatformat *host_double_format = HOST_DOUBLE_FORMAT; -static const struct floatformat *host_long_double_format = HOST_LONG_DOUBLE_FORMAT; +static const struct floatformat *host_float_format = GDB_HOST_FLOAT_FORMAT; +static const struct floatformat *host_double_format = GDB_HOST_DOUBLE_FORMAT; +static const struct floatformat *host_long_double_format = GDB_HOST_LONG_DOUBLE_FORMAT; void floatformat_to_doublest (const struct floatformat *fmt, |