From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] h8300 "info registers" fix
Date: Thu, 16 Nov 2006 08:30:00 -0000 [thread overview]
Message-ID: <m21wo3g5f2.wl%ysato@users.sourceforge.jp> (raw)
In-Reply-To: <200609231800.k8NI0Gob024786@elgar.sibelius.xs4all.nl>
[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]
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 #2: h8300.diff --]
[-- Type: application/octet-stream, Size: 2925 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.7960
diff -u -r1.7960 ChangeLog
--- ChangeLog 13 Nov 2006 19:05:50 -0000 1.7960
+++ ChangeLog 16 Nov 2006 07:16:29 -0000
@@ -1,3 +1,11 @@
+2006-11-16 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * h8300-tdep.c (h8300_pseud_register_read): fix E_CCR_REGNUM
+ and E_EXR_REGNUM size.
+ (h8300_pseudo_register_write): Ditto.
+ (h8300_sim_register_regno): New function.
+ (h8300_h8300_gdbarch_init): add regist h8300_sim_register_regno.
+
2006-11-13 Paul Gilliam <pgilliam@us.ibm.com>
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Don't futz with
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 16 Nov 2006 07:16:29 -0000
@@ -1148,10 +1148,18 @@
struct regcache *regcache, int regno,
gdb_byte *buf)
{
+ gdb_byte tmp[4];
+
if (regno == E_PSEUDO_CCR_REGNUM)
- regcache_raw_read (regcache, E_CCR_REGNUM, buf);
+ {
+ regcache_raw_read (regcache, E_CCR_REGNUM, tmp);
+ *buf = tmp[3]; /* h8300 is bigendian */
+ }
else if (regno == E_PSEUDO_EXR_REGNUM)
- regcache_raw_read (regcache, E_EXR_REGNUM, buf);
+ {
+ regcache_raw_read (regcache, E_EXR_REGNUM, tmp);
+ *buf = tmp[3];
+ }
else
regcache_raw_read (regcache, regno, buf);
}
@@ -1161,10 +1169,18 @@
struct regcache *regcache, int regno,
const gdb_byte *buf)
{
+ unsigned long tmp;
+
if (regno == E_PSEUDO_CCR_REGNUM)
- regcache_raw_write (regcache, E_CCR_REGNUM, buf);
+ {
+ tmp = extract_unsigned_integer(buf, 1);
+ regcache_raw_write (regcache, E_CCR_REGNUM, (gdb_byte *)&tmp);
+ }
else if (regno == E_PSEUDO_EXR_REGNUM)
- regcache_raw_write (regcache, E_EXR_REGNUM, buf);
+ {
+ tmp = extract_unsigned_integer(buf, 1);
+ regcache_raw_write (regcache, E_EXR_REGNUM, (gdb_byte *)&tmp);
+ }
else
regcache_raw_write (regcache, regno, buf);
}
@@ -1205,6 +1221,19 @@
No floating-point info available for this processor.\n");
}
+static int
+h8300_register_sim_regno (int regno)
+{
+ switch (regno)
+ {
+ case E_CCR_REGNUM:
+ case E_EXR_REGNUM:
+ return regno;
+ default:
+ return legacy_register_sim_regno (regno);
+ }
+}
+
static struct gdbarch *
h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -1319,6 +1348,7 @@
set_gdbarch_register_type (gdbarch, h8300_register_type);
set_gdbarch_print_registers_info (gdbarch, h8300_print_registers_info);
set_gdbarch_print_float_info (gdbarch, h8300_print_float_info);
+ set_gdbarch_register_sim_regno(gdbarch, h8300_register_sim_regno);
/*
* Frame Info
prev parent reply other threads:[~2006-11-16 8:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-12 15:05 Yoshinori Sato
2006-09-12 20:28 ` Michael Snyder
2006-09-13 2:28 ` Yoshinori Sato
2006-09-13 15:54 ` Yoshinori Sato
2006-09-13 20:05 ` Michael Snyder
2006-09-13 20:09 ` Daniel Jacobowitz
2006-09-13 20:23 ` Michael Snyder
2006-09-13 20:30 ` Daniel Jacobowitz
2006-09-13 20:59 ` Michael Snyder
2006-09-23 1:08 ` Mark Kettenis
2006-09-23 1:06 ` Mark Kettenis
2006-09-23 3:20 ` Jim Blandy
2006-09-23 3:26 ` Daniel Jacobowitz
2006-09-14 9:40 ` Yoshinori Sato
2006-09-19 16:28 ` Yoshinori Sato
2006-09-23 18:00 ` Mark Kettenis
2006-11-16 8:30 ` Yoshinori Sato [this message]
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=m21wo3g5f2.wl%ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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