Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [commit/mips] Cleanup register name/number initialization
@ 2004-01-08  1:50 Andrew Cagney
  0 siblings, 0 replies; only message in thread
From: Andrew Cagney @ 2004-01-08  1:50 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]

This consolidates MIPS's name/number initialization code.

committed,
Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 2963 bytes --]

2004-01-07  Andrew Cagney  <cagney@redhat.com>

	* mips-tdep.c: Update copyright.
	(mips_gdbarch_init): Merge two code blocks handling the register
	name and number layout.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.263
diff -u -r1.263 mips-tdep.c
--- mips-tdep.c	5 Jan 2004 23:09:45 -0000	1.263
+++ mips-tdep.c	8 Jan 2004 01:42:59 -0000
@@ -1,7 +1,8 @@
 /* Target-dependent code for the MIPS architecture, for GDB, the GNU Debugger.
 
    Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
-   1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+   Foundation, Inc.
 
    Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
    and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
@@ -5775,11 +5776,11 @@
   set_gdbarch_elf_make_msymbol_special (gdbarch, 
 					mips_elf_make_msymbol_special);
 
-  /* Fill in the OS dependant register numbers.  */
+  /* Fill in the OS dependant register numbers and names.  */
   {
+    const char **reg_names;
     struct mips_regnum *regnum = GDBARCH_OBSTACK_ZALLOC (gdbarch,
 							 struct mips_regnum);
-    tdep->regnum = regnum;
     if (info.osabi == GDB_OSABI_IRIX)
       {
 	regnum->fp0 = 32;
@@ -5791,6 +5792,7 @@
 	regnum->fp_control_status = 69;
 	regnum->fp_implementation_revision = 70;
 	num_regs = 71;
+	reg_names = mips_irix_reg_names;
       }
     else
       {
@@ -5803,6 +5805,11 @@
 	regnum->fp_control_status = 70;
 	regnum->fp_implementation_revision = 71;
 	num_regs = 90;
+	if (info.bfd_arch_info != NULL
+	    && info.bfd_arch_info->mach == bfd_mach_mips3900)
+	  reg_names = mips_tx39_reg_names;
+	else
+	  reg_names = mips_generic_reg_names;
       }
     /* FIXME: cagney/2003-11-15: For MIPS, hasn't PC_REGNUM been
        replaced by read_pc?  */
@@ -5810,6 +5817,9 @@
     set_gdbarch_fp0_regnum (gdbarch, regnum->fp0);
     set_gdbarch_num_regs (gdbarch, num_regs);
     set_gdbarch_num_pseudo_regs (gdbarch, num_regs);
+    set_gdbarch_register_name (gdbarch, mips_register_name);
+    tdep->mips_processor_reg_names = reg_names;
+    tdep->regnum = regnum;
   }
 
   switch (mips_abi)
@@ -5960,14 +5970,6 @@
   else
     tdep->mips_fpu_type = MIPS_FPU_DOUBLE;
 
-  /* MIPS version of register names.  */
-  set_gdbarch_register_name (gdbarch, mips_register_name);
-  if (info.osabi == GDB_OSABI_IRIX)
-    tdep->mips_processor_reg_names = mips_irix_reg_names;
-  else if (info.bfd_arch_info != NULL && info.bfd_arch_info->mach == bfd_mach_mips3900)
-    tdep->mips_processor_reg_names = mips_tx39_reg_names;
-  else
-    tdep->mips_processor_reg_names = mips_generic_reg_names;
   set_gdbarch_read_pc (gdbarch, mips_read_pc);
   set_gdbarch_write_pc (gdbarch, generic_target_write_pc);
   set_gdbarch_deprecated_target_read_fp (gdbarch, mips_read_sp); /* Draft FRAME base.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-01-08  1:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-08  1:50 [commit/mips] Cleanup register name/number initialization Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox