This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] mips fp register display
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?
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?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer