public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] rl78-tdep.c: Make PC a pseudo-register
Date: Thu, 15 Aug 2013 04:34:00 -0000	[thread overview]
Message-ID: <20130814213433.2422be23@redhat.com> (raw)
In-Reply-To: <20130814140446.GC11128@adacore.com>

Hi Joel,

On Wed, 14 Aug 2013 07:04:46 -0700
Joel Brobecker <brobecker@adacore.com> wrote:

> I am not an expert by any means, but I thought that this type
> of situation is usually handled the way you just did with this
> patch. For instance, 32bit mode with 64bit registers...

Thanks for looking it over.  I'll probably end up committing
it after formatting issues that you noticed.

> > @@ -94,7 +94,7 @@ enum
> >    RL78_PSW_REGNUM,	/* 8 bits */
> >    RL78_ES_REGNUM,	/* 8 bits */
> >    RL78_CS_REGNUM,	/* 8 bits */
> > -  RL78_PC_REGNUM,	/* 20 bits; we'll use 32 bits for it.  */
> > +  RL78_RAW_PC_REGNUM,	/* 20 bits; we'll use 32 bits for it.  */
> >  
> >    /* Fixed address SFRs (some of those above are SFRs too.) */
> >    RL78_SPL_REGNUM,	/* 8 bits; lower half of SP */
> > @@ -105,7 +105,8 @@ enum
> >    RL78_NUM_REGS,
> >  
> >    /* Pseudo registers.  */
> > -  RL78_SP_REGNUM = RL78_NUM_REGS,
> > +  RL78_PC_REGNUM = RL78_NUM_REGS,
> > +  RL78_SP_REGNUM,
> 
> Out of curiosity, why not include RL78_SP_REGNUM in RL78_NUM_REGS?

Before, RL78_SP_REGNUM was the first pseudo-register.  Now,
RL78_PC_REGNUM will be the first pseudo-register and SP will be the
second.  I did it this way to preserve the register order in "info
registers".  There is less user visible change this way.

> >        if ((regnum < RL78_NUM_REGS
> >             && regnum != RL78_SPL_REGNUM
> > -	   && regnum != RL78_SPH_REGNUM)
> > -          || regnum == RL78_SP_REGNUM)
> > +	   && regnum != RL78_SPH_REGNUM
> > +	   && regnum != RL78_RAW_PC_REGNUM)
> > +          || regnum == RL78_SP_REGNUM
> > +	  || regnum == RL78_PC_REGNUM)
> 
> FYI, there is an inconsistent use of tabs vs spaces that made the review
> of this change a little harder...

I'll adjust this before committing.

> > +  else if (reg == RL78_PC_REGNUM)
> > +    {
> > +      gdb_byte rawbuf[4];
> > +      memcpy (rawbuf, buffer, 3);
> > +      rawbuf[3] = 0;
> > +      regcache_raw_write (regcache, RL78_RAW_PC_REGNUM, rawbuf);
> > +    }
> 
> In both hunks, you're missing an empty line after the rawbuf
> variable declaration (one of the many coding rules of the GDB
> project).

I'll fix that too.

> Other than that, I didn't see anything obviously wrong with the patch.

Thanks again for looking it over.  Much appreciated.

Kevin

  reply	other threads:[~2013-08-15  4:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09  3:56 Kevin Buettner
2013-08-14 14:04 ` Joel Brobecker
2013-08-15  4:34   ` Kevin Buettner [this message]
2013-08-16  4:31 ` 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=20130814213433.2422be23@redhat.com \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).