Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Jim Blandy <jimb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: PowerPC: add segment register numbers
Date: Tue, 13 Jul 2004 00:01:00 -0000	[thread overview]
Message-ID: <20040712170129.47f4bc06@saguaro> (raw)
In-Reply-To: <vt2zn64516c.fsf@zenia.home>

On 12 Jul 2004 17:08:11 -0500
Jim Blandy <jimb@redhat.com> wrote:

> 	* ppc-tdep.h (struct gdbarch_tdep): New member: ppc_sr0_regnum.
> 	* rs6000-tdep.c (rs6000_gdbarch_init): Initialize it.

I have a question and a comment...

First the question: Regarding this portion of the patch...

*************** rs6000_gdbarch_init (struct gdbarch_info
*** 2879,2884 ****
--- 2879,2885 ----
      tdep->ppc_mq_regnum = -1;
    tdep->ppc_fp0_regnum = 32;
    tdep->ppc_fpscr_regnum = power ? 71 : 70;
+   tdep->ppc_sr0_regnum = 71;

...what about the case when ``power'' is non-zero?  Do we want
ppc_fpscr_regnum and ppc_sr0_regnum to both be equal to 71?

Now the comment: Regarding the following portion of the patch...

> *************** rs6000_gdbarch_init (struct gdbarch_info
> *** 2939,2945 ****
> --- 2943,2961 ----
>           set_gdbarch_pseudo_register_read (gdbarch, e500_pseudo_register_read);
>           set_gdbarch_pseudo_register_write (gdbarch, e500_pseudo_register_write);
>   	break;
> + 
> +       case bfd_mach_ppc64:
> +       case bfd_mach_ppc_620:
> +       case bfd_mach_ppc_630:
> +       case bfd_mach_ppc_a35:
> +       case bfd_mach_ppc_rs64ii:
> +       case bfd_mach_ppc_rs64iii:
> +         /* These processor's register sets don't have segment registers.  */
> +         tdep->ppc_sr0_regnum = -1;
> +         break;
>         }   
> +   else
> +     gdb_assert (0);

...I don't really like the gdb_assert (0).

With this patch, the code is structured as follows:

  if (v->arch == bfd_arch_powerpc)
    switch (v->mach)
      {
        ...
      }   
  else
    gdb_assert (0);

Could you revise your patch so that the above is instead structured
like this...?

  gdb_assert(v->arch == bfd_arch_powerpc);
  switch (v->mach)
    {
      ...
    }

BTW, the reason I don't like the assert (0) is that I like seeing a
somewhat meaningful condition when an assert is triggered.  Seeing 0
as the failed condition doesn't give much of a clue about what's going
on.

Kevin


  reply	other threads:[~2004-07-13  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12 22:10 Jim Blandy
2004-07-13  0:01 ` Kevin Buettner [this message]
2004-07-14 23:28   ` Jim Blandy
2004-07-15  0:22     ` Kevin Buettner
2004-07-15  9:08       ` Jim Blandy
2004-07-14 23:37   ` Jim Blandy
2004-07-15  0:23     ` Kevin Buettner
2004-07-15  8:48       ` Jim Blandy

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=20040712170129.47f4bc06@saguaro \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@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