From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30546 invoked by alias); 26 Feb 2004 09:49:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30538 invoked from network); 26 Feb 2004 09:49:26 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 26 Feb 2004 09:49:26 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id i1Q9nQb25224 for ; Thu, 26 Feb 2004 04:49:26 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i1Q9nPM05237 for ; Thu, 26 Feb 2004 04:49:25 -0500 Received: from cygbert.vinschen.de (vpn50-6.rdu.redhat.com [172.16.50.6]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id i1Q9nNX00814 for ; Thu, 26 Feb 2004 01:49:24 -0800 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 82441580C7; Thu, 26 Feb 2004 10:49:20 +0100 (CET) Date: Thu, 26 Feb 2004 09:49:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFA] sh-tdep.c: Fix erroneus register skipping in sh_print_registers_info Message-ID: <20040226094920.GA1740@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20040218135942.GA29776@cygbert.vinschen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040218135942.GA29776@cygbert.vinschen.de> User-Agent: Mutt/1.4.2i X-SW-Source: 2004-02/txt/msg00759.txt.bz2 Ping? Corinna On Feb 18 14:59, Corinna Vinschen wrote: > Hi, > > the below patch fixes a long standing bug in sh_print_registers_info. > When the print loop encounters a float type register and fpregs is > not set, then the loop counter (regnum) is not just incremented by > one, but instead it's incremented by FP_LAST_REGNUM - FP0_REGNUM. > > The problem with this is, that FPUL is also a float type register. > FPUL is two register numbers below FP0_REGNUM. So when the loop > arrives at FPUL, it skips the next 16 registers. The next evaluated > register then (fr14) is still a float type register, so the loop > skips again 16 registers. As a result, the register set is never > printed completely when calling `info registers'. > > The below patch fixes that and shortens the code slightly by using > a "for" loop instead of "while". > > > Corinna > > > ChangeLog: > > * sh-tdep.c (sh_print_registers_info): Use for loop. > Don't skip multiple registers when a float register is encountered. > > Index: sh-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/sh-tdep.c,v > retrieving revision 1.156 > diff -u -p -r1.156 sh-tdep.c > --- sh-tdep.c 26 Jan 2004 20:52:12 -0000 1.156 > +++ sh-tdep.c 18 Feb 2004 13:41:21 -0000 > @@ -1799,35 +1799,23 @@ sh_print_registers_info (struct gdbarch > else > /* do all (or most) registers */ > { > - regnum = 0; > - while (regnum < NUM_REGS) > + for (regnum = 0; regnum < NUM_REGS; ++regnum) > { > /* If the register name is empty, it is undefined for this > processor, so don't display anything. */ > if (REGISTER_NAME (regnum) == NULL > || *(REGISTER_NAME (regnum)) == '\0') > - { > - regnum++; > - continue; > - } > + continue; > > if (TYPE_CODE (gdbarch_register_type (gdbarch, regnum)) == > TYPE_CODE_FLT) > { > + /* true for "INFO ALL-REGISTERS" command */ > if (fpregs) > - { > - /* true for "INFO ALL-REGISTERS" command */ > - sh_do_fp_register (gdbarch, file, regnum); /* FP regs */ > - regnum++; > - } > - else > - regnum += (FP_LAST_REGNUM - FP0_REGNUM); /* skip FP regs */ > + sh_do_fp_register (gdbarch, file, regnum); /* FP regs */ > } > else > - { > - sh_do_register (gdbarch, file, regnum); /* All other regs */ > - regnum++; > - } > + sh_do_register (gdbarch, file, regnum); /* All other regs */ > } > > if (fpregs) > > -- > Corinna Vinschen > Cygwin Developer > Red Hat, Inc. -- Corinna Vinschen Cygwin Developer Red Hat, Inc.