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]

Re: [patch rfc] Almost eliminate REGISTER_CONVERTIBLE et.al.


Hello,

The attached almost eliminates the REGISTER_CONVERTIBLE family of architecture methods.

The value_of_register method uses REGISTER_CONVERTIBLE, while value_from_register uses CONVERT_REGISTER_P (defaults to REGISTER_CONVERTIBLE). The REGISTER_CONVERTIBLE call in value_of_register is, however, totally unnecessary. The register_[virtual]_type method should always return the correct type of a register. The CONVERT_REGISTER_P call remains necessary since, as with the alpha, code likes to do wierd things like encode integers in floating point registers.

The patch switches i386, ia64, rs6000, and alpha to CONVERT_REGISTER_P et.al. while, for the remainder, the unnecessary REGISTER_CONVERTIBLE assignment is eliminated.

The only exception is MIPS which still has messed up raw/virtual registers :-(

I trimmed this back a bit, and checked in the attached.


Andrew

2003-06-02  Andrew Cagney  <cagney@redhat.com>

	* alpha-tdep.c (alpha_gdbarch_init): Set convert_register_p,
	register_to_value, and value_to_register, instead of
	register_convertible, register_convert_to_raw, and
	register_convert_to_virtual.
	* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
	* ia64-tdep.c (ia64_gdbarch_init): Ditto.
	* i386-tdep.c (i386_gdbarch_init): Ditto.
	* sparc-tdep.c (sparc_print_registers): Delete call to
	REGISTER_CONVERTIBLE.
	(sparc_gdbarch_init): Do not set register_convertible.
	* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
	* frv-tdep.c (frv_gdbarch_init): Ditto.
	* cris-tdep.c (cris_gdbarch_init): Ditto.

Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.72
diff -u -r1.72 cris-tdep.c
--- cris-tdep.c	17 May 2003 05:59:57 -0000	1.72
+++ cris-tdep.c	3 Jun 2003 01:22:07 -0000
@@ -4267,9 +4267,6 @@
   
   set_gdbarch_deprecated_get_saved_register (gdbarch, deprecated_generic_get_saved_register);
   
-  /* No register requires conversion from raw format to virtual format.  */
-  set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
-
   set_gdbarch_deprecated_push_return_address (gdbarch, cris_push_return_address);
   set_gdbarch_deprecated_pop_frame (gdbarch, cris_pop_frame);
 
Index: frv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/frv-tdep.c,v
retrieving revision 1.38
diff -u -r1.38 frv-tdep.c
--- frv-tdep.c	2 Jun 2003 02:09:39 -0000	1.38
+++ frv-tdep.c	3 Jun 2003 01:22:07 -0000
@@ -1108,7 +1108,6 @@
 
   set_gdbarch_decr_pc_after_break (gdbarch, 0);
   set_gdbarch_function_start_offset (gdbarch, 0);
-  set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
 
   set_gdbarch_remote_translate_xfer_address
     (gdbarch, frv_remote_translate_xfer_address);
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.68
diff -u -r1.68 m68hc11-tdep.c
--- m68hc11-tdep.c	2 Jun 2003 02:09:39 -0000	1.68
+++ m68hc11-tdep.c	3 Jun 2003 01:22:08 -0000
@@ -1391,8 +1391,6 @@
   set_gdbarch_deprecated_store_struct_return (gdbarch, m68hc11_store_struct_return);
   set_gdbarch_deprecated_store_return_value (gdbarch, m68hc11_store_return_value);
   set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address);
-  set_gdbarch_register_convertible (gdbarch, generic_register_convertible_not);
-
 
   set_gdbarch_deprecated_frame_chain (gdbarch, m68hc11_frame_chain);
   set_gdbarch_deprecated_frame_saved_pc (gdbarch, m68hc11_frame_saved_pc);
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.105
diff -u -r1.105 sparc-tdep.c
--- sparc-tdep.c	2 Jun 2003 02:54:35 -0000	1.105
+++ sparc-tdep.c	3 Jun 2003 01:22:11 -0000
@@ -2104,20 +2104,7 @@
 	  continue;
 	}
 
-      /* FIXME: cagney/2002-08-03: This code shouldn't be necessary.
-         The function frame_register_read() should have returned the
-         pre-cooked register so no conversion is necessary.  */
-      /* Convert raw data to virtual format if necessary.  */
-      if (REGISTER_CONVERTIBLE (i))
-	{
-	  REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i),
-				       raw_buffer, virtual_buffer);
-	}
-      else
-	{
-	  memcpy (virtual_buffer, raw_buffer,
-		  REGISTER_VIRTUAL_SIZE (i));
-	}
+      memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (i));
 
       /* If virtual format is floating, print it that way, and in raw
          hex.  */
@@ -3351,8 +3338,6 @@
   set_gdbarch_register_convert_to_raw (gdbarch, sparc_convert_to_raw);
   set_gdbarch_register_convert_to_virtual (gdbarch, 
 					   sparc_convert_to_virtual);
-  set_gdbarch_register_convertible (gdbarch, 
-				    generic_register_convertible_not);
   set_gdbarch_reg_struct_has_addr (gdbarch, sparc_reg_struct_has_addr);
   set_gdbarch_return_value_on_stack (gdbarch, sparc_return_value_on_stack);
   set_gdbarch_deprecated_saved_pc_after_call (gdbarch, sparc_saved_pc_after_call);

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