From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22531 invoked by alias); 7 Mar 2003 17:04:01 -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 22523 invoked from network); 7 Mar 2003 17:04:01 -0000 Received: from unknown (HELO localhost.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 7 Mar 2003 17:04:01 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 745B12A9C; Fri, 7 Mar 2003 12:03:57 -0500 (EST) Message-ID: <3E68D0FD.2010809@redhat.com> Date: Fri, 07 Mar 2003 17:04: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] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions References: <1030304211701.ZM24618@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg00166.txt.bz2 > When using dwarf2 debug info, floating point registers are mapped > incorrectly for certain mips targets. It turns out that Irix is the > only one that's getting it right due to the fact that FP0_REGNUM is > defined to be 32. > > Thanks to Chris Demetriou for diagnosing this problem and suggesting > the solution. > > [Note: Irix cross some other mips target is currently broken due to > the fact that FP0_REGNUM is not multiarched yet.] I don't think FP0_REGNUM should be multi-arched. The only reference to FP0_REGNUM in generic code that I could find was this gem: if (FP0_REGNUM >= 0) /* need floating point? */ { if ((regno >= 0 && regno < FP0_REGNUM) || regno == PC_REGNUM || (NPC_REGNUM >= 0 && regno == NPC_REGNUM) || regno == FP_REGNUM || regno == SP_REGNUM) return; /* not a floating point register */ if ((fpregs = proc_get_fpregs (pi)) == NULL) proc_error (pi, "fetch_registers, get_fpregs", __LINE__); supply_fpregset (fpregs); } mips_tdep could certainly gain a local tdep->fp0_regnum though. > Okay? Yes, just make it a little bit more robust. The i386 does this: /* This will hopefully provoke a warning. */ return NUM_REGS + NUM_PSEUDO_REGS; when it doesn't know what to do with a register. Andrew > +static int > +mips_dwarf_reg_to_regnum (int num) > +{ > + if (num < 32) > + return num; > + else > + return num + FP0_REGNUM - 32; > +} > + > +/* Convert a dwarf2 register number to a gdb REGNUM */ > + > +static int > +mips_dwarf2_reg_to_regnum (int num) > +{ > + if (num < 32) > + return num; > + else > + return num + FP0_REGNUM - 32; > +} > + > + > /* Convert an integer into an address. By first converting the value > into a pointer and then extracting it signed, the address is > guarenteed to be correctly sign extended. */ > @@ -5980,6 +6003,8 @@ mips_gdbarch_init (struct gdbarch_info i > /* Map debug register numbers onto internal register numbers. */ > set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum); > set_gdbarch_ecoff_reg_to_regnum (gdbarch, mips_ecoff_reg_to_regnum); > + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_reg_to_regnum); > + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf2_reg_to_regnum); > > /* Initialize a frame */ > set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs); >