From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8046 invoked by alias); 19 Mar 2003 01:46:19 -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 7988 invoked from network); 19 Mar 2003 01:46:17 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 19 Mar 2003 01:46:17 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id AD7242B11; Tue, 18 Mar 2003 20:46:12 -0500 (EST) Message-ID: <3E77CBE4.4090009@redhat.com> Date: Wed, 19 Mar 2003 01:46:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Use correct register names for MIPS n32/n64 ABIs References: <1030318234150.ZM25965@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00417.txt.bz2 > For an Irix 6 target, when debugging an o32 program, gdb does not > provide the correct register names when using "info registers". > It does however, use the correct names for n32/n64. Conversely, for > all other MIPS targets, o32 register names are always used regardless > of the ABI. + if (i < 32 && (abi == MIPS_ABI_N32 || abi == MIPS_ABI_N64)) + return mips_n32_n64_gpr_names[i]; + else + return mips_processor_reg_names[i]; Having mips_register_name() only handle half the ABIs (n32/n64) is, I think, weird. > The patch below causes the correct ABI-dependent register names to be > used. > > I considered at least one other approach for fixing this problem. I > considered providing new register name arrays for each of the ABIs, > but that seemed unwieldy, and quite unnecessary too since the GPR > register numbers are always 0-31. Also, all mips cores (that gdb > knows about) agree on what these names should be for the o32 ABI. As > such, it seemed easier to remap just the names of the GPRs in > mips_register_name(). > > Another follow on patch to this one would be to encode the knowledge > of what the GPRs should be entirely within mips_register_name() and > relegate the register name arrays to describing (only) the names of > registers whose numbers are 32 or greater. (I'll wait to do this > until I find out the reaction to the patch below.) Can you please just do this, and consider it pre-approved. When (regnum < 32) have mips_register_name() always generate the name directly, only refering to mips_processor_reg_names[] when i>=32. A bounds check on mips_processor_reg_names[i] probably wouldn't hurt. Andrew