This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] mips fp register display


On Thu, 21 Jun 2001, Daniel Jacobowitz wrote:

> On Thu, Jun 21, 2001 at 03:42:10PM -0700, Don Howard wrote:
> >
> > This is a patch for an obscure mips fp register display problem.  32 bit mips
> > chips support 64 bit float operations using two fp registers.  64 bit mips
> > chips provide a backward compatiblity mode where 64 bit float ops are also
> > supported using 2 float regsiters -- 32 bits stored in each of the 2 64bit fp
> > regs.
> >
> > This patch addresses insight as well as cli gdb.  Insight is not 100% correct:
> > single precision floats are displayed in double format =( (cli gdb displays
> > both float and double).  I can change REGISTER_VIRTUAL_TYPE() to try to guess
> > the the intended type (builtin_type_{float,double}), but that is really not
> > the right place to fix this problem.
> >
> >
> > 2001-06-21  Don Howard  <dhoward@redhat.com>
> >
> >
> >         * mips-tdep.c (mips2_read_fp_register): New function.  Reads a
> >         64-bit float value stored as two 32-bit fragments in consecutive
> >         float registers.
> >         (mips2_fp_compat): New function.  Determine if a MIPS3 or later
> >         cpu is operating in MIPS{1,2} float-compat mode.
> >         (mips_get_saved_register): Modified to use new
> >         mips2-compat float support.
> >         (mips_print_register): Modified to display 64-bit float regs in
> >         single and double precision.
>
> I see why this is necessary, but it doesn't address the problem I was
> talking about.  I also don't think it's really the right solution.
> If you look a few lines higher in mips_print_register, you see:
>
>   /* If an even floating point register, also print as double. */
>   if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (regnum)) == TYPE_CODE_FLT
>       && !((regnum - FP0_REGNUM) & 1))
>     if (REGISTER_RAW_SIZE (regnum) == 4)        /* this would be silly on MIPS64 or N32 (Irix 6) */
>       {
>         char dbuffer[2 * MAX_REGISTER_RAW_SIZE];
>
>         read_relative_register_raw_bytes (regnum, dbuffer);
>         read_relative_register_raw_bytes (regnum + 1, dbuffer + MIPS_REGSIZE);
>         REGISTER_CONVERT_TO_TYPE (regnum, builtin_type_double, dbuffer);
>
>         printf_filtered ("(d%d: ", regnum - FP0_REGNUM);
>         val_print (builtin_type_double, dbuffer, 0, 0,
>                    gdb_stdout, 0, 1, 0, Val_pretty_default);
>         printf_filtered ("); ");
>       }
>   fputs_filtered (REGISTER_NAME (regnum), gdb_stdout);
>
> Well, obviously it's not always silly on N32.  Change the
> 	if (REGISTER_RAW_SIZE (regnum) == 4)
> to something like
> 	if (mips_small_float_registers ())
>
> On the other hand, I think that perhaps if FR is set
> REGISTER_RAW_SIZE (regnum) ought to be 4.  Isn't that what it means?

It seems to me that REGISTER_VIRTUAL_SIZE() is the macro that should provide
this info, as the raw register doesn't change.  Neither of these check the FR
bit.

>
> Also, we already have REGISTER_CONVERT_TO_TYPE.  Rather than hacking in
> a third or perhaps fourth copy of this sort of thing, why not extend
> REGISTER_CONVERT_TO_TYPE?

I would guess (I'm no authority though) that REGISTER_CONVERT_TO_VIRTUAL() and
REGISTER_CONVERT_TO_RAW() might be better places to do this.

I chose to implement a new read_fp_register() function so that insight could
benifit from the fix also.  print_register() and do_register_row() affect cli
gdb only.

-- 
-Don
dhoward@redhat.com
gdb engineering







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]