From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24841 invoked by alias); 1 Aug 2002 20:08: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 24826 invoked from network); 1 Aug 2002 20:07:59 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 1 Aug 2002 20:07:59 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g71JtSl29266 for ; Thu, 1 Aug 2002 15:55:29 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g71K7uu09922; Thu, 1 Aug 2002 16:07:56 -0400 Received: from romulus.sfbay.redhat.com (remus.sfbay.redhat.com [172.16.27.252]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g71K7tm07801; Thu, 1 Aug 2002 13:07:55 -0700 Received: (from kev@localhost) by romulus.sfbay.redhat.com (8.11.6/8.11.6) id g71K7nA29221; Thu, 1 Aug 2002 13:07:49 -0700 Date: Thu, 01 Aug 2002 13:08:00 -0000 From: Kevin Buettner Message-Id: <1020801200749.ZM29220@localhost.localdomain> In-Reply-To: Andrew Cagney "Re: [PATCH] 64-bit support for Irix 6" (Aug 1, 1:42pm) References: <1020731172757.ZM21630@localhost.localdomain> <3D494F95.5060708@ges.redhat.com> <1020801165318.ZM27591@localhost.localdomain> <3D497309.7020300@ges.redhat.com> To: Andrew Cagney Subject: Re: [PATCH] 64-bit support for Irix 6 Cc: gdb-patches@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-08/txt/msg00015.txt.bz2 On Aug 1, 1:42pm, Andrew Cagney wrote: > Even though it removes a macro, I think it is still fudging things. Okay. > The patch should be converting REGISTER_VIRTUAL_TYPE() to a function and > then adding it to the multi-arch vector. > > Add an #undef to tm-irix6.h. I've committed the change below. As the MIPS maintainer, you may want to ponder my note in the mips_register_virtual_type() comment. (It doesn't affect Irix because (for good or ill) Irix redefines FP_REGNUM.) * mips-tdep.c (mips_register_virtual_type): New function. (mips_gdbarch_init): Register mips_register_virtual_type() with gdbarch machinery. * config/mips/tm-irix6.h (mips/tm-bigmips64.h): Include this file instead of tm-bigmips.h. (MIPS_REGSIZE): Delete this macro. (REGISTER_VIRTUAL_TYPE): Delete macro. Undef macro so that multiarch version in mips-tdep.c will be found. Index: mips-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v retrieving revision 1.85 diff -u -p -r1.85 mips-tdep.c --- mips-tdep.c 31 Jul 2002 20:26:49 -0000 1.85 +++ mips-tdep.c 1 Aug 2002 19:49:59 -0000 @@ -483,6 +483,36 @@ mips_register_convert_to_raw (struct typ TYPE_LENGTH (virtual_type)); } +/* Return the GDB type object for the "standard" data type + of data in register REG. + + Note: kevinb/2002-08-01: The definition below should faithfully + reproduce the behavior of each of the REGISTER_VIRTUAL_TYPE + definitions found in config/mips/tm-*.h. I'm concerned about + the ``FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM'' clause + though. In some cases FP_REGNUM is in this range, and I doubt + that this code is correct for the 64-bit case. */ + +static struct type * +mips_register_virtual_type (int reg) +{ + if (FP0_REGNUM <= reg && reg < FP0_REGNUM + 32) + return builtin_type_double; + else if (reg == PS_REGNUM /* CR */) + return builtin_type_uint32; + else if (FCRCS_REGNUM <= reg && reg <= LAST_EMBED_REGNUM) + return builtin_type_uint32; + else + { + /* Everything else... return ``long long'' when registers + are 64-bits wide, ``int'' otherwise. */ + if (MIPS_REGSIZE == TYPE_LENGTH (builtin_type_long_long)) + return builtin_type_long_long; + else + return builtin_type_int; + } +} + /* Should the upper word of 64-bit addresses be zeroed? */ enum auto_boolean mask_address_var = AUTO_BOOLEAN_AUTO; @@ -4634,6 +4664,8 @@ mips_gdbarch_init (struct gdbarch_info i set_gdbarch_pointer_to_address (gdbarch, signed_pointer_to_address); set_gdbarch_address_to_pointer (gdbarch, address_to_signed_pointer); set_gdbarch_integer_to_address (gdbarch, mips_integer_to_address); + + set_gdbarch_register_virtual_type (gdbarch, mips_register_virtual_type); /* Hook in OS ABI-specific overrides, if they have been registered. */ gdbarch_init_osabi (info, gdbarch, osabi); Index: config/mips/tm-irix6.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-irix6.h,v retrieving revision 1.3 diff -u -p -r1.3 tm-irix6.h --- config/mips/tm-irix6.h 31 Jul 2002 17:22:06 -0000 1.3 +++ config/mips/tm-irix6.h 1 Aug 2002 19:49:59 -0000 @@ -19,10 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include "mips/tm-bigmips.h" - -#undef MIPS_REGSIZE -#define MIPS_REGSIZE 8 +#include "mips/tm-bigmips64.h" /* SGI's assembler doesn't grok dollar signs in identifiers. So we use dots instead. This item must be coordinated with G++. */ @@ -91,14 +88,6 @@ ((N) - FP0_REGNUM) * sizeof(double) : \ 32 * sizeof(double) + ((N) - 32) * MIPS_REGSIZE) -#undef REGISTER_VIRTUAL_TYPE -/* define 8 byte register type */ -#define REGISTER_VIRTUAL_TYPE(N) \ - (((N) >= FP0_REGNUM && (N) < FP0_REGNUM+32) ? builtin_type_double \ - : ((N) == 32 /*SR*/) ? builtin_type_uint32 \ - : ((N) >= 70 && (N) <= 89) ? builtin_type_uint32 \ - : builtin_type_long_long) - /* Force N32 ABI as the default. */ #define MIPS_DEFAULT_ABI MIPS_ABI_N32 @@ -129,3 +118,6 @@ /* Select the disassembler */ #undef TM_PRINT_INSN_MACH #define TM_PRINT_INSN_MACH bfd_mach_mips8000 + +/* Undefine those methods which have been multiarched. */ +#undef REGISTER_VIRTUAL_TYPE