From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28317 invoked by alias); 13 Sep 2002 20:16:05 -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 28305 invoked from network); 13 Sep 2002 20:16:04 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 13 Sep 2002 20:16:04 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 3758D3CA7 for ; Fri, 13 Sep 2002 16:16:02 -0400 (EDT) Message-ID: <3D824782.1040306@ges.redhat.com> Date: Fri, 13 Sep 2002 13:16:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [patch/mips, rfc] Don't define FP_REGNUM Content-Type: multipart/mixed; boundary="------------070207000900030201000700" X-SW-Source: 2002-09/txt/msg00267.txt.bz2 This is a multi-part message in MIME format. --------------070207000900030201000700 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1698 Hello, Ok, so this takes things out of the theory stage :-) The attached patch eliminates the totally bogus definition of FP_REGNUM from the MIPS target. It was being mapped to a pseudo register and that pseudo register, through luck, not good management, sometimes contained the contents of the SP. It now always returns the SP. To get this patch working, I needed to modify ``legacy_virtual_frame_pointer'' (used by the tracepoint code) so that it tries FP_REGNUM and then SP_REGNUM as a possible frame pointer register. As I write: - gdb_assert (FP_REGNUM >= 0); - *frame_regnum = FP_REGNUM; + /* FIXME: cagney/2002-09-13: This code is used when identifying the + frame pointer of the current PC. It is assuming that a single + register and an offset can determine this. Instead it should + generate a byte code expression that computes the current FP. */ + if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS) + *frame_regnum = FP_REGNUM; + else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS) + *frame_regnum = SP_REGNUM; + else + /* Should this be an internal error? I guess so, it is reflecting + an architectural limitation in the current design. */ + internal_error (__FILE__, __LINE__, "No virtual frame pointer available"); *frame_offset = 0; For the MIPS to work, a custom virtual_frame_pointer() function would be needed. I don't see any point in implementing this, though, as there is no tracepoint target to test it against. Anyway, coments on this aspect of the patch? If not, I'll check it in. [Hmm, need to mention this in the NEWS file. The MIPS $fp will finally behave as specified in the documentation.] enjoy, Andrew --------------070207000900030201000700 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 7234 Fri Sep 13 10:32:33 2002 Andrew Cagney * arch-utils.c (legacy_virtual_frame_pointer): Try either FP_REGNUM or SP_REGNUM as a frame pointer source. Note that this is very limited. * mipsnbsd-tdep.c (mipsnbsd_cannot_fetch_register): Delete reference to FP_REGNUM. (mipsnbsd_cannot_store_register): Ditto. * mips-linux-nat.c: Update copyright. (mips_linux_cannot_fetch_register): Delete reference to FP_REGNUM. (mips_linux_cannot_store_register): Ditto. * mips-linux-tdep.c (supply_gregset): Ditto. Update copyright. * config/mips/tm-mips.h: Update copyright. (FP_REGNUM): Delete macro. * config/mips/tm-irix6.h: Ditto. * mips-tdep.c (mips_gdbarch_init): Set read_fp to mips_read_sp. Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.67 diff -u -r1.67 arch-utils.c --- arch-utils.c 24 Aug 2002 00:21:34 -0000 1.67 +++ arch-utils.c 13 Sep 2002 18:51:46 -0000 @@ -423,8 +423,18 @@ int *frame_regnum, LONGEST *frame_offset) { - gdb_assert (FP_REGNUM >= 0); - *frame_regnum = FP_REGNUM; + /* FIXME: cagney/2002-09-13: This code is used when identifying the + frame pointer of the current PC. It is assuming that a single + register and an offset can determine this. Instead it should + generate a byte code expression that computes the current FP. */ + if (FP_REGNUM >= 0 && FP_REGNUM < NUM_REGS) + *frame_regnum = FP_REGNUM; + else if (SP_REGNUM >= 0 && SP_REGNUM < NUM_REGS) + *frame_regnum = SP_REGNUM; + else + /* Should this be an internal error? I guess so, it is reflecting + an architectural limitation in the current design. */ + internal_error (__FILE__, __LINE__, "No virtual frame pointer available"); *frame_offset = 0; } Index: mips-linux-nat.c =================================================================== RCS file: /cvs/src/src/gdb/mips-linux-nat.c,v retrieving revision 1.2 diff -u -r1.2 mips-linux-nat.c --- mips-linux-nat.c 20 Feb 2002 22:51:41 -0000 1.2 +++ mips-linux-nat.c 13 Sep 2002 18:51:46 -0000 @@ -1,5 +1,6 @@ /* Native-dependent code for GNU/Linux on MIPS processors. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -28,9 +29,7 @@ int mips_linux_cannot_fetch_register (int regno) { - if (regno >= FP_REGNUM) - return 1; - else if (regno == PS_REGNUM) + if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) return 1; @@ -41,9 +40,7 @@ int mips_linux_cannot_store_register (int regno) { - if (regno >= FP_REGNUM) - return 1; - else if (regno == PS_REGNUM) + if (regno == PS_REGNUM) return 1; else if (regno == ZERO_REGNUM) return 1; Index: mips-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v retrieving revision 1.4 diff -u -r1.4 mips-linux-tdep.c --- mips-linux-tdep.c 19 Aug 2002 14:24:56 -0000 1.4 +++ mips-linux-tdep.c 13 Sep 2002 18:51:46 -0000 @@ -1,5 +1,6 @@ /* Target-dependent code for GNU/Linux on MIPS processors. - Copyright 2001 Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -100,7 +101,6 @@ supply_register (CAUSE_REGNUM, (char *)(regp + EF_CP0_CAUSE)); /* Fill inaccessible registers with zero. */ - supply_register (FP_REGNUM, zerobuf); supply_register (UNUSED_REGNUM, zerobuf); for (regi = FIRST_EMBED_REGNUM; regi < LAST_EMBED_REGNUM; regi++) supply_register (regi, zerobuf); Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.121 diff -u -r1.121 mips-tdep.c --- mips-tdep.c 10 Sep 2002 21:31:18 -0000 1.121 +++ mips-tdep.c 13 Sep 2002 18:51:50 -0000 @@ -5919,7 +5919,7 @@ set_gdbarch_register_name (gdbarch, mips_register_name); set_gdbarch_read_pc (gdbarch, mips_read_pc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_fp (gdbarch, generic_target_read_fp); + set_gdbarch_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base. */ set_gdbarch_read_sp (gdbarch, mips_read_sp); set_gdbarch_write_sp (gdbarch, generic_target_write_sp); Index: mipsnbsd-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mipsnbsd-tdep.c,v retrieving revision 1.2 diff -u -r1.2 mipsnbsd-tdep.c --- mipsnbsd-tdep.c 31 Aug 2002 20:28:37 -0000 1.2 +++ mipsnbsd-tdep.c 13 Sep 2002 18:51:50 -0000 @@ -258,16 +258,14 @@ static int mipsnbsd_cannot_fetch_register (int regno) { - return (regno >= FP_REGNUM - || regno == ZERO_REGNUM + return (regno == ZERO_REGNUM || regno == FCRIR_REGNUM); } static int mipsnbsd_cannot_store_register (int regno) { - return (regno >= FP_REGNUM - || regno == ZERO_REGNUM + return (regno == ZERO_REGNUM || regno == FCRIR_REGNUM); } Index: config/mips/tm-irix6.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v retrieving revision 1.5 diff -u -r1.5 tm-irix6.h --- config/mips/tm-irix6.h 20 Aug 2002 13:17:55 -0000 1.5 +++ config/mips/tm-irix6.h 13 Sep 2002 18:51:50 -0000 @@ -1,6 +1,6 @@ /* Target machine description for SGI Iris under Irix 6.x, for GDB. - Copyright 2001 - Free Software Foundation, Inc. + + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -38,7 +38,6 @@ #undef BADVADDR_REGNUM #undef FCRCS_REGNUM #undef FCRIR_REGNUM -#undef FP_REGNUM /* Number of machine registers */ @@ -74,7 +73,6 @@ #define LO_REGNUM 68 /* ... */ #define FCRCS_REGNUM 69 /* FP control/status */ #define FCRIR_REGNUM 70 /* FP implementation/revision */ -#define FP_REGNUM 30 /* S8 register is the Frame Pointer */ #undef REGISTER_BYTES Index: config/mips/tm-mips.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v retrieving revision 1.43 diff -u -r1.43 tm-mips.h --- config/mips/tm-mips.h 21 Aug 2002 22:39:26 -0000 1.43 +++ config/mips/tm-mips.h 13 Sep 2002 18:51:50 -0000 @@ -1,7 +1,8 @@ /* Definitions to make GDB run on a mips box under 4.3bsd. - Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000 - Free Software Foundation, Inc. + + Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Contributed by Per Bothner (bothner@cs.wisc.edu) at U.Wisconsin and by Alessandro Forin (af@cs.cmu.edu) at CMU.. @@ -115,7 +116,6 @@ #define FPA0_REGNUM (FP0_REGNUM+12) /* First float argument register */ #define FCRCS_REGNUM 70 /* FP control/status */ #define FCRIR_REGNUM 71 /* FP implementation/revision */ -#define FP_REGNUM 72 /* Pseudo register that contains true address of executing stack frame */ #define UNUSED_REGNUM 73 /* Never used, FIXME */ #define FIRST_EMBED_REGNUM 74 /* First CP0 register for embedded use */ #define PRID_REGNUM 89 /* Processor ID */ --------------070207000900030201000700--