This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] h8300 "info registers" fix


A response is late sorry.

At Sat, 23 Sep 2006 20:00:16 +0200 (CEST),
Mark Kettenis wrote:
> 
> > Date: Wed, 20 Sep 2006 01:28:02 +0900
> > From: Yoshinori Sato <ysato@users.sourceforge.jp>
> > 
> > I corrected it not to depend on endian.
> > 
> > Index: h8300-tdep.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/h8300-tdep.c,v
> > retrieving revision 1.103
> > diff -u -r1.103 h8300-tdep.c
> > --- h8300-tdep.c	17 Dec 2005 22:34:00 -0000	1.103
> > +++ h8300-tdep.c	19 Sep 2006 15:55:15 -0000
> > @@ -1148,10 +1148,20 @@
> >  			    struct regcache *regcache, int regno,
> >  			    gdb_byte *buf)
> >  {
> > +  unsigned long tmp;
> > +
> >    if (regno == E_PSEUDO_CCR_REGNUM)
> > -    regcache_raw_read (regcache, E_CCR_REGNUM, buf);
> > +    {
> > +      regcache_raw_read (regcache, E_CCR_REGNUM, (gdb_byte *)&tmp);
> > +      store_unsigned_integer((gdb_byte *)&tmp, 4, tmp);
> > +      *buf = tmp;
> > +    }
> >    else if (regno == E_PSEUDO_EXR_REGNUM)
> > -    regcache_raw_read (regcache, E_EXR_REGNUM, buf);
> > +    {
> > +      regcache_raw_read (regcache, E_EXR_REGNUM, (gdb_byte *)&tmp);
> > +      store_unsigned_integer((gdb_byte *)&tmp, 4, tmp);
> > +      *buf = tmp;
> > +    }
> 
> This is still wrong.  You'll need to read the raw register into a
> properly sized gdb_byte array, take the right bits out of it and then
> move it into the buffer.  You probably want something like
> 
>   gdb_byte tmp[4];
> 
>   regcache_raw_read(regcache, E_CCR_REGNUM, tmp)
>   *buf = tmp[0];
> 
> or
> 
>   gdb_byte tmp[4];
> 
>   regcache_raw_read(regcache, E_CCR_REGNUM, tmp)
>   *buf = tmp[3];
> 
> depending on whether h8300 is little- or big-endian.
> 
> Mark

Attachment: h8300.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]