Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] ppc-linux-nat.c AltiVec regs ptrace
Date: Wed, 20 Feb 2002 21:04:00 -0000	[thread overview]
Message-ID: <1020221050423.ZM829@localhost.localdomain> (raw)
In-Reply-To: Elena Zannoni <ezannoni@redhat.com> "Re: [RFA] ppc-linux-nat.c AltiVec regs ptrace" (Feb 20,  9:09pm)

Elena,

It looks pretty good.  I noticed a typo in a comment.  After your
earlier remarks, I'm beginning to think that you put these in
deliberately to see if I'd notice.  ;-)

There are a few things that I'm confused about though...

On Feb 20,  9:09pm, Elena Zannoni wrote:

> +         time throuhg, and we have comfirmed that there is kernel
                 ^^^^^^^
Here's the typo.

Here's where I'm confused...

> +static void
> +supply_vrregset (gdb_vrregset_t *vrregsetp)
> +{
> +  int i;
> +  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
> +  int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum;

Are you off by one here?  I.e, shouldn't the above statement be

     int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;

?

> +  int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum);
> +  int offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum);
> +
> +  for (i = 0; i < num_of_vrregs - 1; i++)

Why ``num_of_vrregs - 1'' ?  It seems to me that the combination of the
fencepost error (above) combined with this one means that the last two
Altivec registers won't get processed.

> +    {
> +      /* The last 2 registers of this set are only 32 bit long, not
> +         128.  However an offset is necessary only for VSCR because it
> +         occupies a whole vector, while VRSAVE occupies a full 4 bytes
> +         slot.  */
> +      if (i == (tdep->ppc_vrsave_regnum - 1))
> +        supply_register (tdep->ppc_vr0_regnum + i,
> +                         *vrregsetp + i * vrregsize + offset);
> +      else
> +        supply_register (tdep->ppc_vr0_regnum + i, *vrregsetp + i * vrregsize);
> +    }
> +}

[...]

>  static void
> +fill_vrregset (gdb_vrregset_t *vrregsetp)
> +{
> +  int i;
> +  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
> +  int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum;

I think this is another fencepost error.

> +  int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum);
> +  int offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum);
> +
> +  for (i = 0; i < num_of_vrregs; i++)

This one looks right to me though, so long as you fix the computation of
num_of_vrregs.

Kevin


  parent reply	other threads:[~2002-02-21  5:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-20 12:21 Elena Zannoni
2002-02-20 12:39 ` Daniel Jacobowitz
2002-02-20 13:07   ` Elena Zannoni
2002-02-20 14:15     ` Daniel Jacobowitz
2002-02-20 14:34       ` Andrew Cagney
2002-02-20 15:07       ` Elena Zannoni
2002-02-20 15:46         ` Daniel Jacobowitz
2002-02-20 16:28           ` Elena Zannoni
2002-02-20 16:34             ` Daniel Jacobowitz
2002-02-20 18:09               ` Elena Zannoni
2002-02-20 18:57                 ` Daniel Jacobowitz
2002-02-20 20:10                   ` Elena Zannoni
2002-02-20 21:04                 ` Kevin Buettner [this message]
2002-02-21  7:33                   ` Elena Zannoni
2002-02-21  7:33 ` Kevin Buettner
2002-02-21  7:39   ` Elena Zannoni
2002-02-21  8:00     ` Daniel Jacobowitz
2002-02-21 13:25   ` Elena Zannoni
2002-02-21 13:46     ` Kevin Buettner

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=1020221050423.ZM829@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=ezannoni@redhat.com \
    --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