From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27678 invoked by alias); 7 Jul 2003 18:09:06 -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 27670 invoked from network); 7 Jul 2003 18:09:05 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 7 Jul 2003 18:09:05 -0000 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 19ZXlE-0002rd-00; Mon, 07 Jul 2003 11:18:36 -0400 Date: Mon, 07 Jul 2003 18:09:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Cc: Andrew Cagney , Fred Fish Subject: Re: [RFA] Testing REGISTER_NAME in mips-linux-nat.c Message-ID: <20030707151834.GB6349@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com, Andrew Cagney , Fred Fish References: <20030627172013.54F648B5FD@bletchley.vert.intrinsity.com> <3EFC9B86.5060300@redhat.com> <20030628183631.GA25309@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030628183631.GA25309@nevyn.them.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-07/txt/msg00131.txt.bz2 On Sat, Jun 28, 2003 at 02:36:31PM -0400, Daniel Jacobowitz wrote: > On Fri, Jun 27, 2003 at 03:31:18PM -0400, Andrew Cagney wrote: > > >A recent change to mips_register_name to return a empty string for > > >register numbers < NUM_REGS is causing problems with the native mips > > >linux port. The change in mips_register_name is: > > > > Arrgh, they keep turning up :-( > > > > > + /* Map [NUM_REGS .. 2*NUM_REGS) onto the raw registers, but then > > > + don't make the raw register names visible. */ > > > + int rawnum = regno % NUM_REGS; > > > + if (regno < NUM_REGS) > > > + return ""; > > > > > >Now for example when mips_linux_cannot_fetch_register() is called with > > >regno == PC_REGNUM, it will return 1 and reading of the PC will return > > >zero as the PC value. > > > > > >I think this is the correct patch, but I'm not 100% sure. Perhaps we > > >can just eliminate the REGISTER_NAME check completely. > > > > The assertion: > > > > gdb_assert (regno >= 0 && regno < NUM_REGS); > > > > holds so, yes, eliminating REGISTER_NAME would make sense. > > Take a look at MIPS_REGISTER_NAMES in tm-mips.h, which is the generic > registers. Note lots of empty (unnamed) entries in there - we can't > fetch or store those. That's what the check is trying to avoid. > > I don't think Fred's patch is right either, because this function > shouldn't even be called for regno > NUM_REGS, so it just disables the > check. I think the right thing to do is either (ugh!) to call > REGISTER_NAME (regno + NUM_REGS), or to switch to an inclusive list of > available registers. Which is easier, and cleaner. > > Fred, my mips-linux box is offline at the moment, so I can't test this. > Could you try the attached patch and let me know if it works? > > I think I'm going to try to get my own breed of automated testing > going to cover this... > > > Hmm, how come this doesn't just use PTRACE_GETREGS? > > Because mips-linux doesn't implement that yet. > > -- > Daniel Jacobowitz > MontaVista Software Debian GNU/Linux Developer > > 2003-06-28 Daniel Jacobowitz > > * mips-linux-nat.c (mips_linux_cannot_fetch_register) > (mips_linux_cannot_store_register): List supported instead of > unsupported registers. I've checked this in everywhere. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer