Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Don Howard <dhoward@redhat.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Cc: <gdb-patches@sources.redhat.com>
Subject: Re: [RFA] mips fp register display
Date: Fri, 22 Jun 2001 10:26:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.33.0106220738380.1135-100000@theotherone> (raw)
In-Reply-To: <20010621160131.A27435@nevyn.them.org>

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







  reply	other threads:[~2001-06-22 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-21 14:41 Don Howard
2001-06-21 16:01 ` Daniel Jacobowitz
2001-06-22 10:26   ` Don Howard [this message]
2001-06-23 11:03     ` Andrew Cagney
2001-06-23 11:09 ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2001-05-10 10:48 [RFA] Mips " Don Howard
2001-03-27  1:01 Don Howard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0106220738380.1135-100000@theotherone \
    --to=dhoward@redhat.com \
    --cc=dmj+@andrew.cmu.edu \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox