This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch rfc, 6.0?] only allow raw raw registers; Was: [patch rfc]Add NUM_REGS pseudo regs to MIPS


Hello,

The attached hopefully fixes the panic that SteveW was noticing with the MIPS GNU/Linux target. It chops the legacy register cache (which the MIPS uses) back so that it can no longer contain pseudo registers.

Working through the build list, it has the potential of also affecting:

h8300hms:gdbarch_dump: NUM_PSEUDO_REGS = 1
i386-elf:gdbarch_dump: NUM_PSEUDO_REGS = 8
m68hc11-elf:gdbarch_dump: NUM_PSEUDO_REGS = 37
mips-elf:gdbarch_dump: NUM_PSEUDO_REGS = 90
x86_64-linux-gnu:gdbarch_dump: NUM_PSEUDO_REGS = 8

(and sh64)

but since everything is now using pseudo register read/write, instead of fetch/store pseudo register (I deleted that), it should ho longer have any affect.

Hmm, if fetch/store pseudo is deleted all sorts of code can go ....

Steve, does this fix your problem? Assuming it does, I'll also look to commit this to the 6.0 branch.

Andrew
2003-07-27  Andrew Cagney  <cagney@redhat.com>

	* regcache.c (struct regcache_descr): Update comments on
	nr_raw_registers.
	(init_legacy_regcache_descr): Don't set nr_raw_registers or
	sizeof_raw_register_valid_p.
	(init_regcache_descr): Set nr_raw_registers and
	sizeof_raw_register_valid_p before calling
	init_legacy_regcache_descr.

Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.90
diff -u -r1.90 regcache.c
--- regcache.c	9 Jul 2003 14:35:26 -0000	1.90
+++ regcache.c	27 Jul 2003 13:16:00 -0000
@@ -51,10 +51,11 @@
      for raw and pseudo registers and allow access to both.  */
   int legacy_p;
 
-  /* The raw register cache.  This should contain just [0
-     .. NUM_RAW_REGISTERS).  However, for older targets, it contains
-     space for the full [0 .. NUM_RAW_REGISTERS +
-     NUM_PSEUDO_REGISTERS).  */
+  /* The raw register cache.  Each raw (or hard) register is supplied
+     by the target interface.  The raw cache should not contain
+     redundant information - if the PC is constructed from two
+     registers then those regigisters and not the PC lives in the raw
+     cache.  */
   int nr_raw_registers;
   long sizeof_raw_registers;
   long sizeof_raw_register_valid_p;
@@ -91,12 +92,6 @@
      ``gdbarch'' as a parameter.  */
   gdb_assert (gdbarch != NULL);
 
-  /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
-     in the register cache.  Unfortunatly some architectures still
-     rely on this and the pseudo_register_write() method.  */
-  descr->nr_raw_registers = descr->nr_cooked_registers;
-  descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
-
   /* Compute the offset of each register.  Legacy architectures define
      REGISTER_BYTE() so use that.  */
   /* FIXME: cagney/2002-11-07: Instead of using REGISTER_BYTE() this
@@ -176,6 +171,16 @@
 	descr->register_type[i] = REGISTER_VIRTUAL_TYPE (i); /* OK */
     }
 
+  /* Construct a strictly RAW register cache.  Don't allow pseudo's
+     into the register cache.  */
+  descr->nr_raw_registers = NUM_REGS;
+
+  /* FIXME: cagney/2002-08-13: Overallocate the register_valid_p
+     array.  This pretects GDB from erant code that accesses elements
+     of the global register_valid_p[] array in the range [NUM_REGS
+     .. NUM_REGS + NUM_PSEUDO_REGS).  */
+  descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
+
   /* If an old style architecture, fill in the remainder of the
      register cache descriptor using the register macros.  */
   /* NOTE: cagney/2003-06-29: If either of REGISTER_BYTE or
@@ -193,16 +198,6 @@
       init_legacy_regcache_descr (gdbarch, descr);
       return descr;
     }
-
-  /* Construct a strictly RAW register cache.  Don't allow pseudo's
-     into the register cache.  */
-  descr->nr_raw_registers = NUM_REGS;
-
-  /* FIXME: cagney/2002-08-13: Overallocate the register_valid_p
-     array.  This pretects GDB from erant code that accesses elements
-     of the global register_valid_p[] array in the range [NUM_REGS
-     .. NUM_REGS + NUM_PSEUDO_REGS).  */
-  descr->sizeof_raw_register_valid_p = descr->sizeof_cooked_register_valid_p;
 
   /* Lay out the register cache.
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]