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] Deprecate register_gdbarch_swap


So that people are clear that new code should use gdbarch_data. I'll look to commit in a week.

Andrew
2004-02-08  Andrew Cagney  <cagney@redhat.com>

	* gdbarch.sh (deprecated_register_gdbarch_swap): Rename
	register_gdbarch_swap.
	(DEPRECATED_REGISTER_GDBARCH_SWAP): Rename REGISTER_GDBARCH_SWAP.
	* f-lang.c (_initialize_f_language): Update, use
	DEPRECATED_REGISTER_GDBARCH_SWAP.
	* remote.c (_initialize_remote): Ditto.
	* regcache.c (_initialize_regcache): Ditto.
	* parse.c (_initialize_parse): Ditto.
	* infrun.c (_initialize_infrun): Ditto.
	* mi/mi-main.c (_initialize_mi_main): Ditto.
	* gdbtypes.c (_initialize_gdbtypes): Ditto.
	
Index: f-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.c,v
retrieving revision 1.21
diff -u -r1.21 f-lang.c
--- f-lang.c	23 Jan 2004 23:03:29 -0000	1.21
+++ f-lang.c	8 Feb 2004 17:07:24 -0000
@@ -568,36 +568,22 @@
 _initialize_f_language (void)
 {
   build_fortran_types ();
-  register_gdbarch_swap (&builtin_type_f_character, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_logical, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_logical_s1, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_logical_s2, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_integer, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_integer_s2, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_real, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_real_s8, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_real_s16, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_complex_s8, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_complex_s16, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_complex_s32, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_f_void, 
-			 sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_string, 
-			 sizeof (struct type *), NULL);
 
-  register_gdbarch_swap (NULL, 0, build_fortran_types);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_character);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_logical); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_logical_s1); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_logical_s2); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_integer); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_integer_s2); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_real); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_real_s8); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_real_s16); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_complex_s8); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_complex_s16); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_complex_s32); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_f_void); 
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_string); 
+  deprecated_register_gdbarch_swap (NULL, 0, build_fortran_types);
 
   builtin_type_string =
     init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.268
diff -u -r1.268 gdbarch.c
--- gdbarch.c	26 Jan 2004 20:52:04 -0000	1.268
+++ gdbarch.c	8 Feb 2004 17:07:48 -0000
@@ -5621,9 +5621,9 @@
 };
 
 void
-register_gdbarch_swap (void *data,
-		       unsigned long sizeof_data,
-		       gdbarch_swap_ftype *init)
+deprecated_register_gdbarch_swap (void *data,
+		                  unsigned long sizeof_data,
+		                  gdbarch_swap_ftype *init)
 {
   struct gdbarch_swap_registration **rego;
   for (rego = &gdbarch_swap_registry.registrations;
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.233
diff -u -r1.233 gdbarch.h
--- gdbarch.h	26 Jan 2004 20:52:09 -0000	1.233
+++ gdbarch.h	8 Feb 2004 17:08:06 -0000
@@ -2596,8 +2596,8 @@
    New code should use register_gdbarch_data(). */
 
 typedef void (gdbarch_swap_ftype) (void);
-extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
-#define REGISTER_GDBARCH_SWAP(VAR) register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
+extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
+#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
 
 
 
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.294
diff -u -r1.294 gdbarch.sh
--- gdbarch.sh	26 Jan 2004 20:52:10 -0000	1.294
+++ gdbarch.sh	8 Feb 2004 17:08:27 -0000
@@ -1245,8 +1245,8 @@
    New code should use register_gdbarch_data(). */
 
 typedef void (gdbarch_swap_ftype) (void);
-extern void register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
-#define REGISTER_GDBARCH_SWAP(VAR) register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
+extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
+#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
 
 
 
@@ -1932,9 +1932,9 @@
 };
 
 void
-register_gdbarch_swap (void *data,
-		       unsigned long sizeof_data,
-		       gdbarch_swap_ftype *init)
+deprecated_register_gdbarch_swap (void *data,
+		                  unsigned long sizeof_data,
+		                  gdbarch_swap_ftype *init)
 {
   struct gdbarch_swap_registration **rego;
   for (rego = &gdbarch_swap_registry.registrations;
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.80
diff -u -r1.80 gdbtypes.c
--- gdbtypes.c	7 Feb 2004 16:57:55 -0000	1.80
+++ gdbtypes.c	8 Feb 2004 17:08:49 -0000
@@ -3365,58 +3365,58 @@
   /* FIXME - For the moment, handle types by swapping them in and out.
      Should be using the per-architecture data-pointer and a large
      struct. */
-  register_gdbarch_swap (&builtin_type_void, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_char, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_short, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_long, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_long_long, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_signed_char, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_unsigned_char, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_unsigned_short, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_unsigned_int, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_unsigned_long, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_unsigned_long_long, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_float, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_double, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_long_double, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_complex, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_double_complex, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_string, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int8, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_uint8, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int16, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_uint16, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int32, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_uint32, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int64, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_uint64, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_int128, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_uint128, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4sf, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4si, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v16qi, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v8qi, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v8hi, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4hi, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v2si, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v2_double, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4_float, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v2_int64, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4_int32, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v8_int16, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v16_int8, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v2_float, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v2_int32, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v8_int8, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_v4_int16, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_vec128, sizeof (struct type *), NULL);
-  register_gdbarch_swap (&builtin_type_vec128i, sizeof (struct type *), NULL);
-  REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr);
-  REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr);
-  REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
-  REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma);
-  register_gdbarch_swap (NULL, 0, build_gdbtypes);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_void);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_char);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_short);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_long);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_long_long);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_signed_char);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_unsigned_char);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_unsigned_short);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_unsigned_int);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_unsigned_long);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_unsigned_long_long);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_float);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_double);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_long_double);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_complex);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_double_complex);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_string);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int8);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_uint8);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int16);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_uint16);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int32);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_uint32);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int64);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_uint64);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_int128);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_uint128);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4sf);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4si);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v16qi);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v8qi);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v8hi);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4hi);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v2si);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v2_double);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4_float);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v2_int64);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4_int32);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v8_int16);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v16_int8);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v2_float);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v2_int32);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v8_int8);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_v4_int16);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_vec128);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_vec128i);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_void_data_ptr);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_void_func_ptr);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_CORE_ADDR);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_bfd_vma);
+  deprecated_register_gdbarch_swap (NULL, 0, build_gdbtypes);
 
   /* Note: These types do not need to be swapped - they are target
      neutral.  */
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.135
diff -u -r1.135 infrun.c
--- infrun.c	5 Feb 2004 19:56:33 -0000	1.135
+++ infrun.c	8 Feb 2004 17:09:31 -0000
@@ -3997,8 +3997,8 @@
   int numsigs;
   struct cmd_list_element *c;
 
-  register_gdbarch_swap (&stop_registers, sizeof (stop_registers), NULL);
-  register_gdbarch_swap (NULL, 0, build_infrun);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (stop_registers);
+  deprecated_register_gdbarch_swap (NULL, 0, build_infrun);
 
   add_info ("signals", signals_info,
 	    "What debugger does when program gets various signals.\n\
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.38
diff -u -r1.38 parse.c
--- parse.c	25 Sep 2003 08:40:45 -0000	1.38
+++ parse.c	8 Feb 2004 17:09:38 -0000
@@ -1293,11 +1293,10 @@
   /* FIXME - For the moment, handle types by swapping them in and out.
      Should be using the per-architecture data-pointer and a large
      struct. */
-  register_gdbarch_swap (&msym_text_symbol_type, sizeof (msym_text_symbol_type), NULL);
-  register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL);
-  register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL);
-
-  register_gdbarch_swap (NULL, 0, build_parse);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_text_symbol_type);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_data_symbol_type);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (msym_unknown_symbol_type);
+  deprecated_register_gdbarch_swap (NULL, 0, build_parse);
 
   add_show_from_set (
 	    add_set_cmd ("expression", class_maintenance, var_zinteger,
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.106
diff -u -r1.106 regcache.c
--- regcache.c	17 Jan 2004 18:24:15 -0000	1.106
+++ regcache.c	8 Feb 2004 17:09:53 -0000
@@ -1707,10 +1707,10 @@
 _initialize_regcache (void)
 {
   regcache_descr_handle = register_gdbarch_data (init_regcache_descr);
-  REGISTER_GDBARCH_SWAP (current_regcache);
-  register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL);
-  register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL);
-  register_gdbarch_swap (NULL, 0, build_regcache);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (current_regcache);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_registers);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_register_valid);
+  deprecated_register_gdbarch_swap (NULL, 0, build_regcache);
 
   add_com ("flushregs", class_maintenance, reg_flush_command,
 	   "Force gdb to flush its register cache (maintainer command)");
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.128
diff -u -r1.128 remote.c
--- remote.c	26 Jan 2004 23:07:00 -0000	1.128
+++ remote.c	8 Feb 2004 17:10:30 -0000
@@ -5406,9 +5406,8 @@
 
   /* Old tacky stuff.  NOTE: This comes after the remote protocol so
      that the remote protocol has been initialized.  */
-  register_gdbarch_swap (&remote_address_size, 
-                         sizeof (&remote_address_size), NULL);
-  register_gdbarch_swap (NULL, 0, build_remote_gdbarch_data);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (remote_address_size);
+  deprecated_register_gdbarch_swap (NULL, 0, build_remote_gdbarch_data);
 
   init_remote_ops ();
   add_target (&remote_ops);
Index: std-regs.c
===================================================================
RCS file: /cvs/src/src/gdb/std-regs.c,v
retrieving revision 1.9
diff -u -r1.9 std-regs.c
--- std-regs.c	3 Sep 2003 20:46:02 -0000	1.9
+++ std-regs.c	8 Feb 2004 17:10:30 -0000
@@ -142,7 +142,7 @@
      can't be initialized using _initialize*() or gdbarch.  Due mainly
      to non-multi-arch targets, GDB initializes things piece meal and,
      as a consequence can leave these types NULL.  */
-  REGISTER_GDBARCH_SWAP (builtin_type_frame_reg);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (builtin_type_frame_reg);
 
   /* Frame based $fp, $pc, $sp and $ps.  These only come into play
      when the target does not define its own version of these
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.56
diff -u -r1.56 mi-main.c
--- mi/mi-main.c	2 Oct 2003 20:28:31 -0000	1.56
+++ mi/mi-main.c	8 Feb 2004 17:10:45 -0000
@@ -1485,6 +1485,6 @@
 void
 _initialize_mi_main (void)
 {
-  register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
-  register_gdbarch_swap (NULL, 0, mi_setup_architecture_data);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (old_regs);
+  deprecated_register_gdbarch_swap (NULL, 0, mi_setup_architecture_data);
 }

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