From 449abd890017f4db4e9842a492e5be44610ecfaa Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Sat, 13 Apr 1996 21:33:59 +0000 Subject: * remote-nindy.c (nindy_open): Acquire more target state so that user can attach to a previously running program. * (nindy_fetch_registers nindy_store_registers): Get rid of fp conversion code. That's all handled in {extract store}_floating now. * utils.c (floatformat_to_double): Don't bias exponent when handling zero's, denorms or NaNs. * config/i960/tm-i960.h (REGISTER_CONVERT_TO_VIRTUAL REGISTER_CONVERT_TO_RAW): Change to using DOUBLST and FLOATFORMAT_TO/FROM_DOUBLEST macros. * config/i960/tm-nindy960.h: Undefine REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW, and REGISTER_CONVERTIBLE. These are no longer necessary now that all the magic happens in extract/store_floating. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/config/i960/tm-i960.h | 8 ++++---- gdb/config/i960/tm-nindy960.h | 4 ++++ gdb/remote-nindy.c | 28 +++++++++------------------- gdb/utils.c | 19 +++++++++++++------ 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 283d2ca..0207d5f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +Sat Apr 13 14:21:16 1996 Stu Grossman (grossman@critters.cygnus.com) + + * remote-nindy.c (nindy_open): Acquire more target state so that + user can attach to a previously running program. + * (nindy_fetch_registers nindy_store_registers): Get rid of fp + conversion code. That's all handled in {extract store}_floating + now. + * utils.c (floatformat_to_double): Don't bias exponent when + handling zero's, denorms or NaNs. + * config/i960/tm-i960.h (REGISTER_CONVERT_TO_VIRTUAL + REGISTER_CONVERT_TO_RAW): Change to using DOUBLST and + FLOATFORMAT_TO/FROM_DOUBLEST macros. + * config/i960/tm-nindy960.h: Undefine + REGISTER_CONVERT_TO_VIRTUAL, REGISTER_CONVERT_TO_RAW, and + REGISTER_CONVERTIBLE. These are no longer necessary now that all + the magic happens in extract/store_floating. + Sat Apr 13 02:58:02 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * eval.c (evaluate_subexp_standard): Report error when attempting to diff --git a/gdb/config/i960/tm-i960.h b/gdb/config/i960/tm-i960.h index 95a4143..5c57424 100644 --- a/gdb/config/i960/tm-i960.h +++ b/gdb/config/i960/tm-i960.h @@ -170,8 +170,8 @@ extern CORE_ADDR saved_pc_after_call (); #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \ { \ - double val; \ - floatformat_to_double (&floatformat_i960_ext, (FROM), &val); \ + DOUBLEST val; \ + FLOATFORMAT_TO_DOUBLEST (&floatformat_i960_ext, (FROM), &val); \ store_floating ((TO), TYPE_LENGTH (TYPE), val); \ } @@ -180,8 +180,8 @@ extern CORE_ADDR saved_pc_after_call (); #define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \ { \ - double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ - floatformat_from_double (&floatformat_i960_ext, &val, (TO)); \ + DOUBLEST val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \ + FLOATFORMAT_FROM_DOUBLEST (&floatformat_i960_ext, &val, (TO)); \ } /* Return the GDB type object for the "standard" data type diff --git a/gdb/config/i960/tm-nindy960.h b/gdb/config/i960/tm-nindy960.h index 0f9b484..094781f 100644 --- a/gdb/config/i960/tm-nindy960.h +++ b/gdb/config/i960/tm-nindy960.h @@ -95,3 +95,7 @@ nindy_frame_chain_valid(); /* See nindy-tdep.c */ */ #define DECR_PC_AFTER_BREAK 0 + +#undef REGISTER_CONVERT_TO_VIRTUAL +#undef REGISTER_CONVERT_TO_RAW +#undef REGISTER_CONVERTIBLE diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index 29e5923..416adc1 100644 --- a/gdb/remote-nindy.c +++ b/gdb/remote-nindy.c @@ -211,7 +211,13 @@ nindy_open (name, from_tty) savename = savestring (name, strlen (name)); push_target (&nindy_ops); + target_fetch_registers(-1); + + init_thread_list (); + init_wait_for_inferior (); + clear_proceed_status (); + normal_stop (); } /* User-initiated quit of nindy operations. */ @@ -437,8 +443,7 @@ nindy_fetch_registers(regno) int regno; { struct nindy_regs nindy_regs; - int regnum, inv; - double dub; + int regnum; immediate_quit++; ninRegsGet( (char *) &nindy_regs ); @@ -449,14 +454,7 @@ nindy_fetch_registers(regno) memcpy (®isters[REGISTER_BYTE (PCW_REGNUM)], nindy_regs.pcw_acw, 2*4); memcpy (®isters[REGISTER_BYTE (IP_REGNUM)], nindy_regs.ip, 1*4); memcpy (®isters[REGISTER_BYTE (TCW_REGNUM)], nindy_regs.tcw, 1*4); - for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) { - dub = unpack_double (builtin_type_double, - &nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], - &inv); - /* dub now in host byte order */ - FLOATFORMAT_FROM_DOUBLEST (&floatformat_i960_ext, &dub, - ®isters[REGISTER_BYTE (regnum)]); - } + memcpy (®isters[REGISTER_BYTE (FP0_REGNUM)], nindy_regs.fp_as_double, 4 * 8); registers_fetched (); } @@ -474,21 +472,13 @@ nindy_store_registers(regno) { struct nindy_regs nindy_regs; int regnum; - double dub; memcpy (nindy_regs.local_regs, ®isters[REGISTER_BYTE (R0_REGNUM)], 16*4); memcpy (nindy_regs.global_regs, ®isters[REGISTER_BYTE (G0_REGNUM)], 16*4); memcpy (nindy_regs.pcw_acw, ®isters[REGISTER_BYTE (PCW_REGNUM)], 2*4); memcpy (nindy_regs.ip, ®isters[REGISTER_BYTE (IP_REGNUM)], 1*4); memcpy (nindy_regs.tcw, ®isters[REGISTER_BYTE (TCW_REGNUM)], 1*4); - for (regnum = FP0_REGNUM; regnum < FP0_REGNUM + 4; regnum++) - { - FLOATFORMAT_TO_DOUBLEST (&floatformat_i960_ext, - ®isters[REGISTER_BYTE (regnum)], &dub); - store_floating (&nindy_regs.fp_as_double[8 * (regnum - FP0_REGNUM)], - REGISTER_VIRTUAL_SIZE (regnum), - dub); - } + memcpy (nindy_regs.fp_as_double, ®isters[REGISTER_BYTE (FP0_REGNUM)], 8*4); immediate_quit++; ninRegsPut( (char *) &nindy_regs ); diff --git a/gdb/utils.c b/gdb/utils.c index 22e511c..c703ba4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2035,6 +2035,7 @@ floatformat_to_long_double (fmt, from, to) unsigned long mant; unsigned int mant_bits, mant_off; int mant_bits_left; + int special_exponent; /* It's a NaN, denorm or zero */ exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->exp_start, fmt->exp_len); @@ -2045,7 +2046,12 @@ floatformat_to_long_double (fmt, from, to) mant_bits_left = fmt->man_len; mant_off = fmt->man_start; dto = 0.0; - exponent -= fmt->exp_bias; + + special_exponent = exponent == 0 || exponent == fmt->exp_nan; + +/* Don't bias zero's, denorms or NaNs. */ + if (!special_exponent) + exponent -= fmt->exp_bias; /* Build the result algebraically. Might go infinite, underflow, etc; who cares. */ @@ -2053,10 +2059,11 @@ floatformat_to_long_double (fmt, from, to) /* If this format uses a hidden bit, explicitly add it in now. Otherwise, increment the exponent by one to account for the integer bit. */ - if (fmt->intbit == floatformat_intbit_no) - dto = ldexp (1.0, exponent); - else - exponent++; + if (!special_exponent) + if (fmt->intbit == floatformat_intbit_no) + dto = ldexp (1.0, exponent); + else + exponent++; while (mant_bits_left > 0) { @@ -2074,7 +2081,7 @@ floatformat_to_long_double (fmt, from, to) /* Negate it if negative. */ if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start, 1)) dto = -dto; - memcpy (to, &dto, sizeof (dto)); + *to = dto; } static void put_field PARAMS ((unsigned char *, enum floatformat_byteorders, -- cgit v1.1