From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8119 invoked by alias); 19 Sep 2006 16:28:15 -0000 Received: (qmail 8107 invoked by uid 22791); 19 Sep 2006 16:28:12 -0000 X-Spam-Check-By: sourceware.org Received: from mail2.asahi-net.or.jp (HELO mail.asahi-net.or.jp) (202.224.39.198) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 19 Sep 2006 16:28:05 +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 5F41618057 for ; Wed, 20 Sep 2006 01:28:02 +0900 (JST) Received: from mitou.localdomain (unknown [192.168.16.2]) by mitou.ysato.dip.jp (Postfix) with ESMTP id 3DD181C197 for ; Wed, 20 Sep 2006 01:28:02 +0900 (JST) Date: Tue, 19 Sep 2006 16:28:00 -0000 Message-ID: From: Yoshinori Sato To: gdb-patches Subject: Re: [RFC] h8300 "info registers" fix In-Reply-To: References: 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: text/plain; charset=US-ASCII 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-09/txt/msg00108.txt.bz2 I corrected it not to depend on endian. Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.7901 diff -u -r1.7901 ChangeLog --- ChangeLog 17 Sep 2006 15:48:34 -0000 1.7901 +++ ChangeLog 19 Sep 2006 15:55:15 -0000 @@ -1,3 +1,11 @@ +2006-09-19 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-09-17 Vladimir Prus * mi/mi-cmd-stack.c (mi_cmd_stack_list_args): Don't emit error 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; + } else regcache_raw_read (regcache, regno, buf); } @@ -1161,10 +1171,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 +1223,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 +1350,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 -- Yoshinori Sato