From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5307 invoked by alias); 13 Dec 2002 00:19:55 -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 5292 invoked from network); 13 Dec 2002 00:19:55 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 13 Dec 2002 00:19:55 -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 gBCNs9P00462 for ; Thu, 12 Dec 2002 18:54:09 -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 gBD0JsD05661 for ; Thu, 12 Dec 2002 19:19:54 -0500 Received: from localhost.localdomain (vpn50-3.rdu.redhat.com [172.16.50.3]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gBD0JrY10977 for ; Thu, 12 Dec 2002 19:19:53 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id gBD0Jmq11113 for gdb-patches@sources.redhat.com; Thu, 12 Dec 2002 17:19:48 -0700 Date: Thu, 12 Dec 2002 16:42:00 -0000 From: Kevin Buettner Message-Id: <1021213001947.ZM11112@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFA] Multiarch NUM_REGS for MIPS MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-12/txt/msg00409.txt.bz2 I've just discovered that the ``finish'' command was broken on MIPS due to the fact that gdbarch_num_regs must now be set for each architecture. I.e, it's no longer sufficient for a target to simply define NUM_REGS and assume that that'll work. (See default_register_reggroup_p().) The patch below multiarches NUM_REGS for MIPS. Tested on a remote mips64-linux target and on Irix 6. Okay to commit? * config/mips/tm-mips.h, config/mips/tm-irix3.h, config/mips/tm-irix6.h (NUM_REGS): Delete. * mips-tdep.c (mips_gdbarch_init): Call set_gdbarch_num_regs(). (temp_saved_regs): Declare as a pointer rather than an array. (mips32_heuristic_proc_desc, heuristic_proc_desc): Make sure that ``temp_saved_regs'' has storage allocated to it and that it's the correct size. Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.146 diff -u -p -r1.146 mips-tdep.c --- mips-tdep.c 11 Dec 2002 02:26:36 -0000 1.146 +++ mips-tdep.c 13 Dec 2002 00:01:35 -0000 @@ -1714,7 +1714,7 @@ mips_frame_saved_pc (struct frame_info * } static struct mips_extra_func_info temp_proc_desc; -static CORE_ADDR temp_saved_regs[NUM_REGS]; +static CORE_ADDR *temp_saved_regs; /* Set a register's saved stack address in temp_saved_regs. If an address has already been set for this register, do nothing; this way we will @@ -2026,6 +2026,7 @@ mips32_heuristic_proc_desc (CORE_ADDR st CORE_ADDR cur_pc; CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */ restart: + temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); PROC_FRAME_OFFSET (&temp_proc_desc) = 0; PROC_FRAME_ADJUST (&temp_proc_desc) = 0; /* offset of FP from SP */ @@ -2134,6 +2135,7 @@ heuristic_proc_desc (CORE_ADDR start_pc, if (start_pc == 0) return NULL; memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc)); + temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); PROC_LOW_ADDR (&temp_proc_desc) = start_pc; PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM; @@ -5756,6 +5758,11 @@ mips_gdbarch_init (struct gdbarch_info i set_gdbarch_elf_make_msymbol_special (gdbarch, mips_elf_make_msymbol_special); + + if (osabi == GDB_OSABI_IRIX) + set_gdbarch_num_regs (gdbarch, 71); + else + set_gdbarch_num_regs (gdbarch, 90); switch (mips_abi) { Index: config/mips/tm-irix3.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-irix3.h,v retrieving revision 1.3 diff -u -p -r1.3 tm-irix3.h --- config/mips/tm-irix3.h 11 Oct 2002 14:02:39 -0000 1.3 +++ config/mips/tm-irix3.h 13 Dec 2002 00:01:35 -0000 @@ -23,7 +23,6 @@ /* Redefine register numbers for SGI. */ -#undef NUM_REGS #undef MIPS_REGISTER_NAMES #undef FP0_REGNUM #undef PC_REGNUM @@ -33,10 +32,6 @@ #undef BADVADDR_REGNUM #undef FCRCS_REGNUM #undef FCRIR_REGNUM - -/* Number of machine registers */ - -#define NUM_REGS 71 /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ Index: config/mips/tm-irix6.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v retrieving revision 1.8 diff -u -p -r1.8 tm-irix6.h --- config/mips/tm-irix6.h 11 Oct 2002 14:02:39 -0000 1.8 +++ config/mips/tm-irix6.h 13 Dec 2002 00:01:35 -0000 @@ -24,7 +24,6 @@ /* Redefine register numbers for SGI. */ -#undef NUM_REGS #undef MIPS_REGISTER_NAMES #undef FP0_REGNUM #undef PC_REGNUM @@ -34,10 +33,6 @@ #undef BADVADDR_REGNUM #undef FCRCS_REGNUM #undef FCRIR_REGNUM - -/* Number of machine registers */ - -#define NUM_REGS 71 /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */ Index: config/mips/tm-mips.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v retrieving revision 1.45 diff -u -p -r1.45 tm-mips.h --- config/mips/tm-mips.h 21 Nov 2002 18:54:44 -0000 1.45 +++ config/mips/tm-mips.h 13 Dec 2002 00:01:35 -0000 @@ -59,12 +59,6 @@ extern int mips_step_skips_delay (CORE_A #define MIPS_REGSIZE 4 #endif -/* Number of machine registers */ - -#ifndef NUM_REGS -#define NUM_REGS 90 -#endif - /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. */