From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13014 invoked by alias); 11 Mar 2003 21:22:30 -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 13006 invoked from network); 11 Mar 2003 21:22:29 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 11 Mar 2003 21:22:29 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h2BLMTQ16955 for ; Tue, 11 Mar 2003 16:22:29 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h2BLMSV03330; Tue, 11 Mar 2003 16:22:28 -0500 Received: from localhost.localdomain (vpn50-53.rdu.redhat.com [172.16.50.53]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h2BLMRS07479; Tue, 11 Mar 2003 16:22:27 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h2BLMMF11770; Tue, 11 Mar 2003 14:22:22 -0700 Date: Tue, 11 Mar 2003 21:22:00 -0000 From: Kevin Buettner Message-Id: <1030311212221.ZM11769@localhost.localdomain> In-Reply-To: Andrew Cagney "Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions" (Mar 7, 1:52pm) References: <1030304211701.ZM24618@localhost.localdomain> <3E68D0FD.2010809@redhat.com> <1030307175146.ZM16168@localhost.localdomain> <3E68EA63.10401@redhat.com> To: Andrew Cagney Subject: Re: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions Cc: gdb-patches@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-03/txt/msg00261.txt.bz2 On Mar 7, 1:52pm, Andrew Cagney wrote: > True. In the mean time, these new methods might as well be consistent > with the other existing reg_to_regnum methods (from memory, it does > eventually provoke a warning). Okay. I've studied the code some more on the gcc side of things. gcc differentiates between ``dbx'' (which we call ``aout'' in gdb) and everything else. As such, I decided that it didn't make much sense to have three identical functions to maintain (i.e. the ecoff, dwarf, and dwarf2 cases). It's quite possible that the non-dbx case(s) will need to be modified in the near future since I'm considering adding some mappings for the hi and lo registers. If we ever do discover a reason for making the dwarf, dwarf2, and ecoff mappings diverge, it will be easy enough to replicate the function at that time. Below is a revised patch which takes into account your earlier comments as well as the observation that I just made above. Okay? * mips-tdep.c (mips_ecoff_reg_to_regnum): Rename to mips_dwarf_dwarf2_ecoff_reg_to_regnum(). (mips_dwarf_dwarf2_ecoff_reg_to_regnum, mips_stab_reg_to_regnum): Do range checks on register number obtained from debugging info. (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and set_gdbarch_dwarf2_reg_to_regnum(). Adjust call of set_gdbarch_ecoff_reg_to_regnum() to account for new name of mapping function. Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.168 diff -u -p -r1.168 mips-tdep.c --- mips-tdep.c 3 Mar 2003 20:50:19 -0000 1.168 +++ mips-tdep.c 11 Mar 2003 21:03:42 -0000 @@ -5546,23 +5546,37 @@ mips_saved_pc_after_call (struct frame_i static int mips_stab_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 38 && num < 70) return num + FP0_REGNUM - 38; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } -/* Convert a ecoff register number to a gdb REGNUM */ + +/* Convert a dwarf, dwarf2, or ecoff register number to a gdb REGNUM */ static int -mips_ecoff_reg_to_regnum (int num) +mips_dwarf_dwarf2_ecoff_reg_to_regnum (int num) { - if (num < 32) + if (num >= 0 && num < 32) return num; - else + else if (num >= 32 && num < 64) return num + FP0_REGNUM - 32; + else + { + /* This will hopefully (eventually) provoke a warning. Should + we be calling complaint() here? */ + return NUM_REGS + NUM_PSEUDO_REGS; + } } + /* 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. */ @@ -5979,7 +5993,9 @@ 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_ecoff_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); + set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mips_dwarf_dwarf2_ecoff_reg_to_regnum); /* Initialize a frame */ set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mips_frame_init_saved_regs);