From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16509 invoked by alias); 5 Mar 2009 19:12:58 -0000 Received: (qmail 16500 invoked by uid 22791); 5 Mar 2009 19:12:57 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Mar 2009 19:12:51 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 7D4E42BABAB; Thu, 5 Mar 2009 14:12:53 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id xaC14SFvrdIa; Thu, 5 Mar 2009 14:12:53 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 26C872BAB62; Thu, 5 Mar 2009 14:12:51 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id C3E7EE7ACD; Thu, 5 Mar 2009 11:12:45 -0800 (PST) Date: Thu, 05 Mar 2009 19:12:00 -0000 From: Joel Brobecker To: Aleksandar Ristovski Cc: gdb-patches@sources.redhat.com Subject: Re: [patch] mips-tdep: info registers Message-ID: <20090305191245.GB3744@adacore.com> References: <20090223020820.GC26056@adacore.com> <20090223025230.GA11699@caradoc.them.org> <200902230718.n1N7IoBD028396@brahms.sibelius.xs4all.nl> <20090223161756.GA19411@caradoc.them.org> <20090223162602.GH26056@adacore.com> <20090227195607.GJ26056@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org X-SW-Source: 2009-03/txt/msg00060.txt.bz2 Hi Daniel, IIRC, you've worked on the mips target a few times in the past. Do you forsee any problem if mips_register_name return "0" .. "31" for the raw GP registers? What Aleksandar is trying to do is allow "info register 1" to work on mips, instead of having to use "info register at"... Thanks! > * mips-tdep.c (mips_register_name): Handle numeric GPR > register numbers. > (mips_print_registers_info): Remove gdb_assert. > Index: gdb/mips-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/mips-tdep.c,v > retrieving revision 1.490 > diff -u -p -r1.490 mips-tdep.c > --- gdb/mips-tdep.c 22 Feb 2009 01:02:17 -0000 1.490 > +++ gdb/mips-tdep.c 4 Mar 2009 21:39:25 -0000 > @@ -440,13 +440,27 @@ mips_register_name (struct gdbarch *gdba > "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra" > }; > > + /* MIPS GPR register numbers, as used by assembler. Order must > + reflect gdb's regno<->MIPS register number mapping which is > + currently 1-1. */ > + static char *mips_gpr_numeric_names[] = { > + "0", "1", "2", "3", "4", "5", "6", "7", > + "8", "9", "10", "11", "12", "13", "14", "15", > + "16", "17", "18", "19", "20", "21", "22", "23", > + "24", "25", "26", "27", "28", "29", "30", "31" > + }; > + > enum mips_abi abi = mips_abi (gdbarch); > > - /* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers, > - but then don't make the raw register names visible. */ > + /* Map [gdbarch_num_regs .. 2*gdbarch_num_regs) onto the raw registers. */ > int rawnum = regno % gdbarch_num_regs (gdbarch); > if (regno < gdbarch_num_regs (gdbarch)) > - return ""; > + { I would like a commenthere explaining why we return the numeric names for raw registers, and why we only do that for GPRs. > + if (regno >= 0 && regno < 32) > + return mips_gpr_numeric_names [regno]; > + else > + return ""; > + } > > /* The MIPS integer registers are always mapped from 0 to 31. The > names of the registers (which reflects the conventions regarding > @@ -4601,7 +4615,6 @@ mips_print_registers_info (struct gdbarc > { > if (regnum != -1) /* do one specified register */ > { > - gdb_assert (regnum >= gdbarch_num_regs (gdbarch)); > if (*(gdbarch_register_name (gdbarch, regnum)) == '\0') > error (_("Not a valid register for the current processor type")); > -- Joel