From 75bc7ddf1b1e98d946b1b3c260c56d2d8ebd251e Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 29 Jan 2002 03:08:28 +0000 Subject: [PATCH] * config/vax/tm-vax.h (INVALID_FLOAT): Move macro from here... * vax-tdep.c (INVALID_FLOAT): To here. Document why it is broken. * rs6000-tdep.c (rs6000_do_registers_info): Delete code wrapped in #ifdef INVALID_FLOAT. * infcmd.c (do_registers_info): Ditto. * values.c (unpack_double): Ditto. Add comment. * config/ns32k/tm-umax.h (INVALID_FLOAT): Delete macro that was already commented out. --- gdb/ChangeLog | 13 +++++++++++++ gdb/config/ns32k/tm-umax.h | 15 --------------- gdb/config/vax/tm-vax.h | 5 ----- gdb/infcmd.c | 9 ++------- gdb/rs6000-tdep.c | 9 ++------- gdb/values.c | 23 ++++++++++++++++------- gdb/vax-tdep.c | 18 ++++++++++++++++++ 7 files changed, 51 insertions(+), 41 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9f2daf7b1a9..de8d50be04a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2002-01-28 Andrew Cagney + + * config/vax/tm-vax.h (INVALID_FLOAT): Move macro from here... + * vax-tdep.c (INVALID_FLOAT): To here. Document why it is broken. + + * rs6000-tdep.c (rs6000_do_registers_info): Delete code wrapped in + #ifdef INVALID_FLOAT. + * infcmd.c (do_registers_info): Ditto. + * values.c (unpack_double): Ditto. Add comment. + + * config/ns32k/tm-umax.h (INVALID_FLOAT): Delete macro that was + already commented out. + 2002-01-26 Andreas Schwab * config/m68k/nm-linux.h (FETCH_INFERIOR_REGISTERS): Define. diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h index 9f1fb31eb24..c09f53513d4 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -68,21 +68,6 @@ extern CORE_ADDR umax_skip_prologue (CORE_ADDR); #define DECR_PC_AFTER_BREAK 0 -#if 0 /* Disable until fixed *correctly*. */ -#ifndef INVALID_FLOAT -#ifndef NaN -#include -#endif /* NaN */ - -/* Return 1 if P points to an invalid floating point value. */ -/* Surely wrong for cross-debugging. */ -#define INVALID_FLOAT(p, s) \ - ((s == sizeof (float))? \ - NaF (*(float *) p) : \ - NaD (*(double *) p)) -#endif /* INVALID_FLOAT */ -#endif - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h index 65f8d7048ea..0fe507facff 100644 --- a/gdb/config/vax/tm-vax.h +++ b/gdb/config/vax/tm-vax.h @@ -65,11 +65,6 @@ extern CORE_ADDR vax_skip_prologue (CORE_ADDR); #define DECR_PC_AFTER_BREAK 0 -/* Return 1 if P points to an invalid floating point value. - LEN is the length in bytes -- not relevant on the Vax. */ - -#define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000) - /* Say how long (ordinary) registers are. This is a piece of bogosity used in push_word and a few other places; REGISTER_RAW_SIZE is the real way to know how big a register is. */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 5b8d1f21fd8..d5e18eccafd 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1613,13 +1613,8 @@ do_registers_info (int regnum, int fpregs) { register int j; -#ifdef INVALID_FLOAT - if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i))) - printf_filtered (""); - else -#endif - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + gdb_stdout, 0, 1, 0, Val_pretty_default); printf_filtered ("\t(raw 0x"); for (j = 0; j < REGISTER_RAW_SIZE (i); j++) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 29180c3606f..be8c5956c63 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1763,13 +1763,8 @@ rs6000_do_registers_info (int regnum, int fpregs) { register int j; -#ifdef INVALID_FLOAT - if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i))) - printf_filtered (""); - else -#endif - val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, - gdb_stdout, 0, 1, 0, Val_pretty_default); + val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, + gdb_stdout, 0, 1, 0, Val_pretty_default); printf_filtered ("\t(raw 0x"); for (j = 0; j < REGISTER_RAW_SIZE (i); j++) diff --git a/gdb/values.c b/gdb/values.c index 68230e621ed..9445d9c4561 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -742,13 +742,22 @@ unpack_double (struct type *type, char *valaddr, int *invp) nosign = TYPE_UNSIGNED (type); if (code == TYPE_CODE_FLT) { -#ifdef INVALID_FLOAT - if (INVALID_FLOAT (valaddr, len)) - { - *invp = 1; - return 1.234567891011121314; - } -#endif + /* NOTE: cagney/2002-02-19: There was a test here to see if the + floating-point value was valid (using the macro + INVALID_FLOAT). That test/macro have been removed. + + It turns out that only the VAX defined this macro and then + only in a non-portable way. Fixing the portability problem + wouldn't help since the VAX floating-point code is also badly + bit-rotten. The target needs to add definitions for the + methods TARGET_FLOAT_FORMAT and TARGET_DOUBLE_FORMAT - these + exactly describe the target floating-point format. The + problem here is that the corresponding floatformat_vax_f and + floatformat_vax_d values these methods should be set to are + also not defined either. Oops! + + Hopefully someone will add both the missing floatformat + definitions and floatformat_is_invalid() function. */ return extract_typed_floating (valaddr, type); } else if (nosign) diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 9a53df0b711..a5fbe3a9d72 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -26,6 +26,24 @@ #include "frame.h" #include "value.h" +/* Return 1 if P points to an invalid floating point value. + LEN is the length in bytes -- not relevant on the Vax. */ + +/* FIXME: cagney/2002-01-19: The macro below was originally defined in + tm-vax.h and used in values.c. Two problems. Firstly this is a + very non-portable and secondly it is wrong. The VAX should be + using floatformat and associated methods to identify and handle + invalid floating-point values. Adding to the poor target's woes + there is no floatformat_vax_{f,d} and no TARGET_FLOAT_FORMAT + et.al.. */ + +/* FIXME: cagney/2002-01-19: It turns out that the only thing that + uses this macro is the vax disassembler code (so how old is this + target?). This target should instead be using the opcodes + disassembler. That allowing the macro to be eliminated. */ + +#define INVALID_FLOAT(p, len) ((*(short *) p & 0xff80) == 0x8000) + /* Vax instructions are never longer than this. */ #define MAXLEN 62 -- 2.30.2