From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13445 invoked by alias); 4 Mar 2003 21:17:08 -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 13414 invoked from network); 4 Mar 2003 21:17:07 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 4 Mar 2003 21:17:07 -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 h24LH7Q11701 for ; Tue, 4 Mar 2003 16:17:07 -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 h24LH7V28723 for ; Tue, 4 Mar 2003 16:17:07 -0500 Received: from localhost.localdomain (vpn50-35.rdu.redhat.com [172.16.50.35]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h24LH6C00507 for ; Tue, 4 Mar 2003 16:17:06 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h24LH1024619 for gdb-patches@sources.redhat.com; Tue, 4 Mar 2003 14:17:01 -0700 Date: Tue, 04 Mar 2003 21:17:00 -0000 From: Kevin Buettner Message-Id: <1030304211701.ZM24618@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFA] mips-tdep.c: Add dwarf/dwarf2 regnum mapping functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-03/txt/msg00113.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.] Okay? * mips-tdep.c (mips_dwarf_reg_to_regnum, mips_dwarf2_reg_to_regnum): New functions. (mips_gdbarch_init): Call set_gdbarch_dwarf_reg_to_regnum() and set_gdbarch_dwarf2_reg_to_regnum(). 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 4 Mar 2003 17:25:21 -0000 @@ -5563,6 +5563,29 @@ mips_ecoff_reg_to_regnum (int num) return num + FP0_REGNUM - 32; } +/* Convert a dwarf register number to a gdb REGNUM */ + +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);