From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3170 invoked by alias); 16 Nov 2006 08:30:24 -0000 Received: (qmail 3154 invoked by uid 22791); 16 Nov 2006 08:30:23 -0000 X-Spam-Check-By: sourceware.org Received: from mail1.asahi-net.or.jp (HELO mail.asahi-net.or.jp) (202.224.39.197) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 16 Nov 2006 08:30:12 +0000 Received: from mitou.ysato.dip.jp (l247150.ppp.asahi-net.or.jp [218.219.247.150]) by mail.asahi-net.or.jp (Postfix) with ESMTP id 6F09B23F74; Thu, 16 Nov 2006 17:30:09 +0900 (JST) Received: from mitou.localdomain (unknown [192.168.16.2]) by mitou.ysato.dip.jp (Postfix) with ESMTP id 610171C195; Thu, 16 Nov 2006 17:30:09 +0900 (JST) Date: Thu, 16 Nov 2006 08:30:00 -0000 Message-ID: From: Yoshinori Sato To: Mark Kettenis Cc: gdb-patches@sourceware.org Subject: Re: [RFC] h8300 "info registers" fix In-Reply-To: <200609231800.k8NI0Gob024786@elgar.sibelius.xs4all.nl> References: <200609231800.k8NI0Gob024786@elgar.sibelius.xs4all.nl> User-Agent: Wanderlust/2.15.3 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?ISO-8859-4?Q?Shij=F2?=) APEL/10.6 Emacs/22.0.50 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Thu_Nov_16_17:30:07_2006-1" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00135.txt.bz2 --Multipart_Thu_Nov_16_17:30:07_2006-1 Content-Type: text/plain; charset=US-ASCII Content-length: 1731 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 > > > > 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 --Multipart_Thu_Nov_16_17:30:07_2006-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="h8300.diff" Content-Transfer-Encoding: 7bit Content-length: 2925 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 + + * 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 * 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 --Multipart_Thu_Nov_16_17:30:07_2006-1--