From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30013 invoked by alias); 23 Sep 2006 18:00:25 -0000 Received: (qmail 30005 invoked by uid 22791); 23 Sep 2006 18:00:25 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 23 Sep 2006 18:00:23 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k8NI0JWl008914; Sat, 23 Sep 2006 20:00:19 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.8/8.13.6) with ESMTP id k8NI0JQw021683; Sat, 23 Sep 2006 20:00:19 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.8/8.13.8/Submit) id k8NI0Gob024786; Sat, 23 Sep 2006 20:00:16 +0200 (CEST) Date: Sat, 23 Sep 2006 18:00:00 -0000 Message-Id: <200609231800.k8NI0Gob024786@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: ysato@users.sourceforge.jp CC: gdb-patches@sourceware.org In-reply-to: (message from Yoshinori Sato on Wed, 20 Sep 2006 01:28:02 +0900) Subject: Re: [RFC] h8300 "info registers" fix References: 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/msg00163.txt.bz2 > 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