This is the mail archive of the gdb-patches@sourceware.org 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]

[7/7] Use per-type architecture


Hello,

now that we have a get_type_arch routine to retrieve the architecture
associated with any type in GDB, this routine can be used to eliminate
various references to current_gdbarch.  This patch uses the per-type
architecture for the following purposes:

- Bit- and byte-order associated with a type
  (various places)

- Floating point format associated with a type
  (floatformat_from_type)

- Default pointer size
  (make_pointer_type / make_reference_type / smash_to_memberptr_type)

- Pointer/integer to address conversion
  (extract_typed_address / store_typed_address)

- Per-architecture type flags (address space names)
  (address_space_name_to_int / address_space_int_to_name)

- C++ ABI properties associated with a class type
  (replaces the gnu-v3-abi.c:get_class_type hack)

- Function pointer semantics
  (find_function_addr / value printing routines)

- Default integer type to use as array index type
  (lookup_array_range_type)

- Various other "related" types (e.g. to print value "as float")
  (value printing routines)

- Architecture to use for evaluating stub methods
  (check_stub_method)


The following parts of my series to completely eliminate current_gdbarch
are obsoleted by this set of patches:

[07/15] Per-value architecture support
[10/15] Basic value access routines
[11/15] Pointer / reference type creation
[03/15] Revert find_function_in_inferior gdbarch changes
[09/15] Revert C++ ABI gdbarch changes

The rest is still applicable (some with minor adaptations).


Bye,
Ulrich


ChangeLog:

	* gdbtypes.c (make_pointer_type, make_reference_type,
	smash_to_memberptr_type, lookup_array_range_type, check_stub_method):
	Use type architecture instead of current_gdbarch.

	* gdbtypes.h (address_space_name_to_int, address_space_int_to_name):
	Add GDBARCH paramter.
	* gdbtypes.c (address_space_name_to_int, address_space_int_to_name):
	Add GDBARCH parameter.   Use it instead of current_gdbarch.
	* c-typeprint.c (c_type_print_modifier): Update call.
	* parse.c (push_type_address_space): Likewise.

	* findvar.c (extract_typed_address, store_typed_address): Use type
	architecture instead of current_gdbarch.

	* value.c (value_as_address, unpack_field_as_long): Use type architecture
	instead of current_gdbarch.

	* doublest.c (floatformat_from_length): Add GDBARCH argument.  Use it
	instead of current_gdbarch.
	(floatformat_from_type): Pass type architecture.

	* infcall.c (find_function_addr): Use type architecture instead
	of current_gdbarch.

	* valarith.c (value_bitstring_subscript, value_x_binop, value_neg,
	value_bit_index): Use type architecture instead of current_gdbarch.
	* valops.c (value_cast, value_slice): Likewise.

	* value.h (modify_field): Add TYPE argument.
	* value.c (modify_field): Add TYPE argument.  Use type architecture
	instead of current_gdbarch.
	(set_internalvar_component): Likewise.
	* eval.c (evaluate_struct_tuple): Update call.
	* valops.c (value_assign): Likewise.
	* ada-lang.c (modify_general_field): Likewise.  Add TYPE argument.
	(make_array_descriptor): Update calls.
	(move_bits): Add BITS_BIG_ENDIAN_P argument.  Use it instead of
	current_gdbarch.
	(ada_value_assign, value_assign_to_component): Update calls.
	(decode_packed_array, ada_value_primitive_packed_val, ada_value_assign,
	value_assign_to_component): Use type arch instead of current_gdbarch.

	* printcmd.c (float_type_from_length): Remove GDBARCH argument,
	use type architecture instead.
	(print_scalar_formatted, printf_command): Update calls.  Use type
	architecture instead of current_gdbarch.
	* valprint.c (val_print_type_code_int): Use type architecture
	instead of current_gdbarch.
	* varobj.c (value_get_print_value): Likewise.
	* python/python-prettyprint.c (print_string_repr): Add GDBARCH
	argument.  Use it instead of current_gdbarch.
	(apply_val_pretty_printer): Update call.

	* ada-valprint.c (ada_val_print_1): Use type architecture instead
	of current_gdbarch.
	* c-valprint.c (print_function_pointer_address): Add GDBARCH argument.
	Use it instead of current_gdbarch.
	(c_val_print): Update calls passing type architecture.
	* f-valprint.c (f_val_print): Use type architecture instead of
	current_gdbarch.
	* jv-valprint (java_value_print): Likewise.
	* m2-valprint.c (print_function_pointer_address): Add GDBARCH argument.
	Use it instead of current_gdbarch.
	(print_unpacked_pointer): Update calls passing type architecture.
	* scm-valprint.c (scm_scmval_print): Use type architecture instead of
	current_gdbarch.

	* gnu-v3-abi.c (get_class_arch): Remove.
	(gnuv3_rtti_type): Use get_type_arch instead of get_class_arch.  Remove
	special-case check for Java classes.
	(gnuv3_virtual_fn_field, gnuv3_baseclass_offset, gnuv3_print_method_ptr,
	gnuv3_method_ptr_size, gnuv3_make_method_ptr, gnuv3_method_ptr_to_value):
	Use get_type_arch instead of get_class_arch.


Index: gdb-head/gdb/ada-lang.c
===================================================================
--- gdb-head.orig/gdb/ada-lang.c
+++ gdb-head/gdb/ada-lang.c
@@ -67,7 +67,7 @@
 
 static void extract_string (CORE_ADDR addr, char *buf);
 
-static void modify_general_field (char *, LONGEST, int, int);
+static void modify_general_field (struct type *, char *, LONGEST, int, int);
 
 static struct type *desc_base_type (struct type *);
 
@@ -182,7 +182,7 @@ static struct value *decode_packed_array
 static struct value *value_subscript_packed (struct value *, int,
                                              struct value **);
 
-static void move_bits (gdb_byte *, int, const gdb_byte *, int, int);
+static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int);
 
 static struct value *coerce_unspec_val_to_type (struct value *,
                                                 struct type *);
@@ -1214,9 +1214,10 @@ static char *bound_name[] = {
 /* Like modify_field, but allows bitpos > wordlength.  */
 
 static void
-modify_general_field (char *addr, LONGEST fieldval, int bitpos, int bitsize)
+modify_general_field (struct type *type, char *addr,
+		      LONGEST fieldval, int bitpos, int bitsize)
 {
-  modify_field (addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
+  modify_field (type, addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
 }
 
 
@@ -1832,7 +1833,7 @@ decode_packed_array (struct value *arr)
       return NULL;
     }
 
-  if (gdbarch_bits_big_endian (current_gdbarch)
+  if (gdbarch_bits_big_endian (get_type_arch (value_type (arr)))
       && ada_is_modular_type (value_type (arr)))
     {
        /* This is a (right-justified) modular type representing a packed
@@ -1956,7 +1957,7 @@ ada_value_primitive_packed_val (struct v
   int len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8;
   /* Transmit bytes from least to most significant; delta is the direction
      the indices move.  */
-  int delta = gdbarch_bits_big_endian (current_gdbarch) ? -1 : 1;
+  int delta = gdbarch_bits_big_endian (get_type_arch (type)) ? -1 : 1;
 
   type = ada_check_typedef (type);
 
@@ -2005,7 +2006,7 @@ ada_value_primitive_packed_val (struct v
       memset (unpacked, 0, TYPE_LENGTH (type));
       return v;
     }
-  else if (gdbarch_bits_big_endian (current_gdbarch))
+  else if (gdbarch_bits_big_endian (get_type_arch (type)))
     {
       src = len - 1;
       if (has_negatives (type)
@@ -2091,7 +2092,7 @@ ada_value_primitive_packed_val (struct v
    not overlap.  */
 static void
 move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source,
-	   int src_offset, int n)
+	   int src_offset, int n, int bits_big_endian_p)
 {
   unsigned int accum, mask;
   int accum_bits, chunk_size;
@@ -2100,7 +2101,7 @@ move_bits (gdb_byte *target, int targ_of
   targ_offset %= HOST_CHAR_BIT;
   source += src_offset / HOST_CHAR_BIT;
   src_offset %= HOST_CHAR_BIT;
-  if (gdbarch_bits_big_endian (current_gdbarch))
+  if (bits_big_endian_p)
     {
       accum = (unsigned char) *source;
       source += 1;
@@ -2192,12 +2193,12 @@ ada_value_assign (struct value *toval, s
       from_size = value_bitsize (fromval);
       if (from_size == 0)
 	from_size = TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT;
-      if (gdbarch_bits_big_endian (current_gdbarch))
+      if (gdbarch_bits_big_endian (get_type_arch (type)))
         move_bits (buffer, value_bitpos (toval),
-		   value_contents (fromval), from_size - bits, bits);
+		   value_contents (fromval), from_size - bits, bits, 1);
       else
-        move_bits (buffer, value_bitpos (toval), value_contents (fromval),
-                   0, bits);
+        move_bits (buffer, value_bitpos (toval),
+		   value_contents (fromval), 0, bits, 0);
       write_memory (to_addr, buffer, len);
       if (deprecated_memory_changed_hook)
 	deprecated_memory_changed_hook (to_addr, len);
@@ -2236,16 +2237,16 @@ value_assign_to_component (struct value 
   else
     bits = value_bitsize (component);
 
-  if (gdbarch_bits_big_endian (current_gdbarch))
+  if (gdbarch_bits_big_endian (get_type_arch (value_type (container))))
     move_bits (value_contents_writeable (container) + offset_in_container, 
 	       value_bitpos (container) + bit_offset_in_container,
 	       value_contents (val),
 	       TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits,
-	       bits);
+	       bits, 1);
   else
     move_bits (value_contents_writeable (container) + offset_in_container, 
 	       value_bitpos (container) + bit_offset_in_container,
-	       value_contents (val), 0, bits);
+	       value_contents (val), 0, bits, 0);
 }	       
 			
 /* The value of the element of array ARR at the ARITY indices given in IND.
@@ -3831,11 +3832,13 @@ make_array_descriptor (struct type *type
 
   for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1)
     {
-      modify_general_field (value_contents_writeable (bounds),
+      modify_general_field (value_type (bounds),
+			    value_contents_writeable (bounds),
                             ada_array_bound (arr, i, 0),
                             desc_bound_bitpos (bounds_type, i, 0),
                             desc_bound_bitsize (bounds_type, i, 0));
-      modify_general_field (value_contents_writeable (bounds),
+      modify_general_field (value_type (bounds),
+			    value_contents_writeable (bounds),
                             ada_array_bound (arr, i, 1),
                             desc_bound_bitpos (bounds_type, i, 1),
                             desc_bound_bitsize (bounds_type, i, 1));
@@ -3843,12 +3846,14 @@ make_array_descriptor (struct type *type
 
   bounds = ensure_lval (bounds, gdbarch, sp);
 
-  modify_general_field (value_contents_writeable (descriptor),
+  modify_general_field (value_type (descriptor),
+			value_contents_writeable (descriptor),
                         value_address (ensure_lval (arr, gdbarch, sp)),
                         fat_pntr_data_bitpos (desc_type),
                         fat_pntr_data_bitsize (desc_type));
 
-  modify_general_field (value_contents_writeable (descriptor),
+  modify_general_field (value_type (descriptor),
+			value_contents_writeable (descriptor),
                         value_address (bounds),
                         fat_pntr_bounds_bitpos (desc_type),
                         fat_pntr_bounds_bitsize (desc_type));
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -746,7 +746,7 @@ ada_val_print_1 (struct type *type, cons
 	  struct value *func = ada_vax_float_print_function (type);
 	  if (func != 0)
 	    {
-	      struct gdbarch *gdbarch = current_gdbarch;
+	      struct gdbarch *gdbarch = get_type_arch (type);
 	      CORE_ADDR addr;
 	      addr = value_as_address (call_function_by_hand (func, 1, &val));
 	      val_print_string (builtin_type (gdbarch)->builtin_true_char,
@@ -785,20 +785,15 @@ ada_val_print_1 (struct type *type, cons
 	      opts.format = format;
 	      print_scalar_formatted (valaddr, type, &opts, 0, stream);
 	    }
-          else if (ada_is_system_address_type (type)
-		   && TYPE_OBJFILE (type) != NULL)
+          else if (ada_is_system_address_type (type))
             {
               /* FIXME: We want to print System.Address variables using
                  the same format as for any access type.  But for some
                  reason GNAT encodes the System.Address type as an int,
                  so we have to work-around this deficiency by handling
-                 System.Address values as a special case.
+                 System.Address values as a special case.  */
 
-		 We do this only for System.Address types defined in an
-		 objfile.  For the built-in version of System.Address we
-		 have installed the proper type to begin with.  */
-
-	      struct gdbarch *gdbarch = get_objfile_arch (TYPE_OBJFILE (type));
+	      struct gdbarch *gdbarch = get_type_arch (type);
 	      struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
 
               fprintf_filtered (stream, "(");
Index: gdb-head/gdb/c-typeprint.c
===================================================================
--- gdb-head.orig/gdb/c-typeprint.c
+++ gdb-head/gdb/c-typeprint.c
@@ -338,7 +338,8 @@ c_type_print_modifier (struct type *type
       did_print_modifier = 1;
     }
 
-  address_space_id = address_space_int_to_name (TYPE_INSTANCE_FLAGS (type));
+  address_space_id = address_space_int_to_name (get_type_arch (type),
+						TYPE_INSTANCE_FLAGS (type));
   if (address_space_id)
     {
       if (did_print_modifier || need_pre_space)
Index: gdb-head/gdb/c-valprint.c
===================================================================
--- gdb-head.orig/gdb/c-valprint.c
+++ gdb-head/gdb/c-valprint.c
@@ -36,11 +36,10 @@
    stream STREAM.  */
 
 static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
-				int addressprint)
+print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
+				struct ui_file *stream, int addressprint)
 {
-  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
-							    address,
+  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
 							    &current_target);
 
   /* If the function pointer is represented by a description, print the
@@ -153,6 +152,7 @@ c_val_print (struct type *type, const gd
 	     CORE_ADDR address, struct ui_file *stream, int recurse,
 	     const struct value_print_options *options)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   unsigned int i = 0;	/* Number of characters printed */
   unsigned len;
   struct type *elttype, *unresolved_elttype;
@@ -252,7 +252,8 @@ c_val_print (struct type *type, const gd
 	     -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
-	  print_function_pointer_address (addr, stream, options->addressprint);
+	  print_function_pointer_address (gdbarch, addr, stream,
+					  options->addressprint);
 	  break;
 	}
       unresolved_elttype = TYPE_TARGET_TYPE (type);
@@ -264,7 +265,7 @@ c_val_print (struct type *type, const gd
 	  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
 	    {
 	      /* Try to print what function it points to.  */
-	      print_function_pointer_address (addr, stream,
+	      print_function_pointer_address (gdbarch, addr, stream,
 					      options->addressprint);
 	      /* Return value is irrelevant except for string pointers.  */
 	      return (0);
@@ -382,7 +383,8 @@ c_val_print (struct type *type, const gd
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + offset, field_type);
 
-	  print_function_pointer_address (addr, stream, options->addressprint);
+	  print_function_pointer_address (gdbarch, addr, stream,
+					  options->addressprint);
 	}
       else
 	cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream,
Index: gdb-head/gdb/doublest.c
===================================================================
--- gdb-head.orig/gdb/doublest.c
+++ gdb-head/gdb/doublest.c
@@ -761,27 +761,27 @@ floatformat_from_doublest (const struct 
    but not passed on by GDB.  This should be fixed.  */
 
 static const struct floatformat *
-floatformat_from_length (int len)
+floatformat_from_length (struct gdbarch *gdbarch, int len)
 {
   const struct floatformat *format;
-  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
-    format = gdbarch_float_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
-    format = gdbarch_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
-  else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
-    format = gdbarch_long_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
+  if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+    format = gdbarch_float_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
+    format = gdbarch_double_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
+  else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (gdbarch))
+    format = gdbarch_long_double_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
   /* On i386 the 'long double' type takes 96 bits,
      while the real number of used bits is only 80,
      both in processor and in memory.  
      The code below accepts the real bit size.  */ 
-  else if ((gdbarch_long_double_format (current_gdbarch) != NULL) 
+  else if ((gdbarch_long_double_format (gdbarch) != NULL)
 	   && (len * TARGET_CHAR_BIT ==
-               gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
-    format = gdbarch_long_double_format (current_gdbarch)
-	       [gdbarch_byte_order (current_gdbarch)];
+               gdbarch_long_double_format (gdbarch)[0]->totalsize))
+    format = gdbarch_long_double_format (gdbarch)
+	       [gdbarch_byte_order (gdbarch)];
   else
     format = NULL;
   if (format == NULL)
@@ -793,11 +793,12 @@ floatformat_from_length (int len)
 const struct floatformat *
 floatformat_from_type (const struct type *type)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
   if (TYPE_FLOATFORMAT (type) != NULL)
-    return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)];
+    return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
   else
-    return floatformat_from_length (TYPE_LENGTH (type));
+    return floatformat_from_length (gdbarch, TYPE_LENGTH (type));
 }
 
 /* Extract a floating-point number of type TYPE from a target-order
Index: gdb-head/gdb/eval.c
===================================================================
--- gdb-head.orig/gdb/eval.c
+++ gdb-head/gdb/eval.c
@@ -354,8 +354,8 @@ evaluate_struct_tuple (struct value *str
 	    bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno);
 	  addr = value_contents_writeable (struct_val) + bitpos / 8;
 	  if (bitsize)
-	    modify_field (addr, value_as_long (val),
-			  bitpos % 8, bitsize);
+	    modify_field (struct_type, addr,
+			  value_as_long (val), bitpos % 8, bitsize);
 	  else
 	    memcpy (addr, value_contents (val),
 		    TYPE_LENGTH (value_type (val)));
Index: gdb-head/gdb/f-valprint.c
===================================================================
--- gdb-head.orig/gdb/f-valprint.c
+++ gdb-head/gdb/f-valprint.c
@@ -245,6 +245,7 @@ f_val_print (struct type *type, const gd
 	     CORE_ADDR address, struct ui_file *stream, int recurse,
 	     const struct value_print_options *options)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   unsigned int i = 0;	/* Number of characters printed */
   struct type *elttype;
   LONGEST val;
@@ -256,7 +257,7 @@ f_val_print (struct type *type, const gd
     {
     case TYPE_CODE_STRING:
       f77_get_dynamic_length_of_aggregate (type);
-      LA_PRINT_STRING (stream, builtin_type (current_gdbarch)->builtin_char,
+      LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
 		       valaddr, TYPE_LENGTH (type), 0, options);
       break;
 
Index: gdb-head/gdb/findvar.c
===================================================================
--- gdb-head.orig/gdb/findvar.c
+++ gdb-head/gdb/findvar.c
@@ -173,7 +173,7 @@ extract_typed_address (const gdb_byte *b
 		    _("extract_typed_address: "
 		    "type is not a pointer or reference"));
 
-  return gdbarch_pointer_to_address (current_gdbarch, type, buf);
+  return gdbarch_pointer_to_address (get_type_arch (type), type, buf);
 }
 
 
@@ -242,7 +242,7 @@ store_typed_address (gdb_byte *buf, stru
 		    _("store_typed_address: "
 		    "type is not a pointer or reference"));
 
-  gdbarch_address_to_pointer (current_gdbarch, type, buf, addr);
+  gdbarch_address_to_pointer (get_type_arch (type), type, buf, addr);
 }
 
 
Index: gdb-head/gdb/gdbtypes.c
===================================================================
--- gdb-head.orig/gdb/gdbtypes.c
+++ gdb-head/gdb/gdbtypes.c
@@ -281,8 +281,8 @@ make_pointer_type (struct type *type, st
   /* FIXME!  Assume the machine has only one representation for
      pointers!  */
 
-  TYPE_LENGTH (ntype) = 
-    gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype)
+    = gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_PTR;
 
   /* Mark pointers as unsigned.  The target converts between pointers
@@ -359,7 +359,8 @@ make_reference_type (struct type *type, 
      references, and that it matches the (only) representation for
      pointers!  */
 
-  TYPE_LENGTH (ntype) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (ntype) =
+    gdbarch_ptr_bit (get_type_arch (type)) / TARGET_CHAR_BIT;
   TYPE_CODE (ntype) = TYPE_CODE_REF;
 
   if (!TYPE_REFERENCE_TYPE (type))	/* Remember it, if don't have one.  */
@@ -428,9 +429,8 @@ lookup_function_type (struct type *type)
 /* Identify address space identifier by name --
    return the integer flag defined in gdbtypes.h.  */
 extern int
-address_space_name_to_int (char *space_identifier)
+address_space_name_to_int (struct gdbarch *gdbarch, char *space_identifier)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
   int type_flags;
   /* Check for known address space delimiters.  */
   if (!strcmp (space_identifier, "code"))
@@ -450,9 +450,8 @@ address_space_name_to_int (char *space_i
    gdbtypes.h -- return the string version of the adress space name.  */
 
 const char *
-address_space_int_to_name (int space_flag)
+address_space_int_to_name (struct gdbarch *gdbarch, int space_flag)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
   if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE)
     return "code";
   else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE)
@@ -845,7 +844,7 @@ struct type *
 lookup_array_range_type (struct type *element_type,
 			 int low_bound, int high_bound)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = get_type_arch (element_type);
   struct type *index_type = builtin_type (gdbarch)->builtin_int;
   struct type *range_type
     = create_range_type (NULL, index_type, low_bound, high_bound);
@@ -968,7 +967,8 @@ smash_to_memberptr_type (struct type *ty
   TYPE_DOMAIN_TYPE (type) = domain;
   /* Assume that a data member pointer is the same size as a normal
      pointer.  */
-  TYPE_LENGTH (type) = gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+  TYPE_LENGTH (type)
+    = gdbarch_ptr_bit (get_type_arch (to_type)) / TARGET_CHAR_BIT;
   TYPE_CODE (type) = TYPE_CODE_MEMBERPTR;
 }
 
@@ -1525,7 +1525,7 @@ safe_parse_type (struct gdbarch *gdbarch
 static void
 check_stub_method (struct type *type, int method_id, int signature_id)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = get_type_arch (type);
   struct fn_field *f;
   char *mangled_name = gdb_mangle_name (type, method_id, signature_id);
   char *demangled_name = cplus_demangle (mangled_name,
Index: gdb-head/gdb/gdbtypes.h
===================================================================
--- gdb-head.orig/gdb/gdbtypes.h
+++ gdb-head/gdb/gdbtypes.h
@@ -1187,9 +1187,9 @@ extern struct type *make_cv_type (int, i
 
 extern void replace_type (struct type *, struct type *);
 
-extern int address_space_name_to_int (char *);
+extern int address_space_name_to_int (struct gdbarch *, char *);
 
-extern const char *address_space_int_to_name (int);
+extern const char *address_space_int_to_name (struct gdbarch *, int);
 
 extern struct type *make_type_with_address_space (struct type *type, 
 						  int space_identifier);
Index: gdb-head/gdb/infcall.c
===================================================================
--- gdb-head.orig/gdb/infcall.c
+++ gdb-head/gdb/infcall.c
@@ -231,6 +231,7 @@ CORE_ADDR
 find_function_addr (struct value *function, struct type **retval_type)
 {
   struct type *ftype = check_typedef (value_type (function));
+  struct gdbarch *gdbarch = get_type_arch (ftype);
   enum type_code code = TYPE_CODE (ftype);
   struct type *value_type = NULL;
   CORE_ADDR funaddr;
@@ -251,8 +252,7 @@ find_function_addr (struct value *functi
       if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
 	  || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
 	{
-	  funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
-							funaddr,
+	  funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
 							&current_target);
 	  value_type = TYPE_TARGET_TYPE (ftype);
 	}
@@ -273,8 +273,7 @@ find_function_addr (struct value *functi
 	      CORE_ADDR nfunaddr;
 	      funaddr = value_as_address (value_addr (function));
 	      nfunaddr = funaddr;
-	      funaddr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
-							    funaddr,
+	      funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
 							    &current_target);
 	      if (funaddr != nfunaddr)
 		found_descriptor = 1;
@@ -289,7 +288,7 @@ find_function_addr (struct value *functi
 
   if (retval_type != NULL)
     *retval_type = value_type;
-  return funaddr + gdbarch_deprecated_function_start_offset (current_gdbarch);
+  return funaddr + gdbarch_deprecated_function_start_offset (gdbarch);
 }
 
 /* For CALL_DUMMY_ON_STACK, push a breakpoint sequence that the called
Index: gdb-head/gdb/jv-valprint.c
===================================================================
--- gdb-head.orig/gdb/jv-valprint.c
+++ gdb-head/gdb/jv-valprint.c
@@ -38,7 +38,7 @@ int
 java_value_print (struct value *val, struct ui_file *stream, 
 		  const struct value_print_options *options)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = get_type_arch (value_type (val));
   struct type *type;
   CORE_ADDR address;
   int i;
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -46,11 +46,10 @@ m2_print_array_contents (struct type *ty
    stream STREAM.  */
 
 static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
-				int addressprint)
+print_function_pointer_address (struct gdbarch *gdbarch, CORE_ADDR address,
+				struct ui_file *stream, int addressprint)
 {
-  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
-							    address,
+  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch, address,
 							    &current_target);
 
   /* If the function pointer is represented by a description, print the
@@ -213,12 +212,14 @@ print_unpacked_pointer (struct type *typ
 			const struct value_print_options *options,
 			struct ui_file *stream)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
   if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
     {
       /* Try to print what function it points to.  */
-      print_function_pointer_address (addr, stream, options->addressprint);
+      print_function_pointer_address (gdbarch, addr, stream,
+				      options->addressprint);
       /* Return value is irrelevant except for string pointers.  */
       return 0;
     }
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -317,8 +317,9 @@ print_formatted (struct value *val, int 
 /* Return builtin floating point type of same length as TYPE.
    If no such type is found, return TYPE itself.  */
 static struct type *
-float_type_from_length (struct gdbarch *gdbarch, struct type *type)
+float_type_from_length (struct type *type)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   const struct builtin_type *builtin = builtin_type (gdbarch);
   unsigned int len = TYPE_LENGTH (type);
 
@@ -344,7 +345,7 @@ print_scalar_formatted (const void *vala
 			const struct value_print_options *options,
 			int size, struct ui_file *stream)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = get_type_arch (type);
   LONGEST val_long = 0;
   unsigned int len = TYPE_LENGTH (type);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -466,7 +467,7 @@ print_scalar_formatted (const void *vala
       break;
 
     case 'f':
-      type = float_type_from_length (current_gdbarch, type);
+      type = float_type_from_length (type);
       print_floating (valaddr, type, stream);
       break;
 
@@ -2275,8 +2276,9 @@ printf_command (char *arg, int from_tty)
 	      gdb_byte *str;
 	      CORE_ADDR tem;
 	      int j;
-	      struct type *wctype = lookup_typename (current_language,
-						     current_gdbarch,
+	      struct gdbarch *gdbarch
+		= get_type_arch (value_type (val_args[i]));
+	      struct type *wctype = lookup_typename (current_language, gdbarch,
 						     "wchar_t", NULL, 0);
 	      int wcwidth = TYPE_LENGTH (wctype);
 	      gdb_byte *buf = alloca (wcwidth);
@@ -2315,8 +2317,9 @@ printf_command (char *arg, int from_tty)
 	    break;
 	  case wide_char_arg:
 	    {
-	      struct type *wctype = lookup_typename (current_language,
-						     current_gdbarch,
+	      struct gdbarch *gdbarch
+		= get_type_arch (value_type (val_args[i]));
+	      struct type *wctype = lookup_typename (current_language, gdbarch,
 						     "wchar_t", NULL, 0);
 	      struct type *valtype;
 	      struct obstack output;
@@ -2352,7 +2355,7 @@ printf_command (char *arg, int from_tty)
 
 	      /* If format string wants a float, unchecked-convert the value
 		 to floating point of the same size.  */
-	      type = float_type_from_length (current_gdbarch, type);
+	      type = float_type_from_length (type);
 	      val = unpack_double (type, value_contents (val_args[i]), &inv);
 	      if (inv)
 		error (_("Invalid floating value found in program."));
@@ -2369,7 +2372,7 @@ printf_command (char *arg, int from_tty)
 
 	      /* If format string wants a float, unchecked-convert the value
 		 to floating point of the same size.  */
-	      type = float_type_from_length (current_gdbarch, type);
+	      type = float_type_from_length (type);
 	      val = unpack_double (type, value_contents (val_args[i]), &inv);
 	      if (inv)
 		error (_("Invalid floating value found in program."));
@@ -2423,6 +2426,7 @@ printf_command (char *arg, int from_tty)
 	      /* Parameter data.  */
 	      struct type *param_type = value_type (val_args[i]);
 	      unsigned int param_len = TYPE_LENGTH (param_type);
+	      struct gdbarch *gdbarch = get_type_arch (param_type);
 
 	      /* DFP output data.  */
 	      struct value *dfp_value = NULL;
@@ -2451,18 +2455,18 @@ printf_command (char *arg, int from_tty)
 		  if (*sos == 'H')
 		    {
 		      dfp_len = 4;
-		      dfp_type = builtin_type (current_gdbarch)->builtin_decfloat;
+		      dfp_type = builtin_type (gdbarch)->builtin_decfloat;
 		    }
 		  else if (*sos == 'D' && *(sos - 1) == 'D')
 		    {
 		      dfp_len = 16;
-		      dfp_type = builtin_type (current_gdbarch)->builtin_declong;
+		      dfp_type = builtin_type (gdbarch)->builtin_declong;
 		      sos--;
 		    }
 		  else
 		    {
 		      dfp_len = 8;
-		      dfp_type = builtin_type (current_gdbarch)->builtin_decdouble;
+		      dfp_type = builtin_type (gdbarch)->builtin_decdouble;
 		    }
 		}
 
Index: gdb-head/gdb/scm-valprint.c
===================================================================
--- gdb-head.orig/gdb/scm-valprint.c
+++ gdb-head/gdb/scm-valprint.c
@@ -179,6 +179,8 @@ scm_scmval_print (struct type *type, LON
 		  struct ui_file *stream, int recurse,
 		  const struct value_print_options *options)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
+
 #define SCM_SIZE (TYPE_LENGTH (type))
 taloop:
   switch (7 & (int) svalue)
@@ -193,7 +195,7 @@ taloop:
       if (SCM_ICHRP (svalue))
 	{
 	  svalue = SCM_ICHR (svalue);
-	  scm_printchar (svalue, builtin_type (current_gdbarch)->builtin_char,
+	  scm_printchar (svalue, builtin_type (gdbarch)->builtin_char,
 			 stream);
 	  break;
 	}
Index: gdb-head/gdb/valarith.c
===================================================================
--- gdb-head.orig/gdb/valarith.c
+++ gdb-head/gdb/valarith.c
@@ -233,7 +233,7 @@ value_bitstring_subscript (struct type *
   byte = *((char *) value_contents (bitstring) + offset);
 
   bit_index = index % TARGET_CHAR_BIT;
-  byte >>= (gdbarch_bits_big_endian (current_gdbarch) ?
+  byte >>= (gdbarch_bits_big_endian (get_type_arch (bitstring_type)) ?
 	    TARGET_CHAR_BIT - 1 - bit_index : bit_index);
 
   v = value_from_longest (type, byte & 1);
@@ -471,7 +471,7 @@ value_x_binop (struct value *arg1, struc
 struct value *
 value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = get_type_arch (value_type (arg1));
   struct value **argvec;
   char *ptr, *mangle_ptr;
   char tstr[13], mangle_tstr[13];
@@ -1479,7 +1479,7 @@ value_neg (struct value *arg1)
 
       memcpy (decbytes, value_contents (arg1), len);
 
-      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+      if (gdbarch_byte_order (get_type_arch (type)) == BFD_ENDIAN_LITTLE)
 	decbytes[len-1] = decbytes[len - 1] | 0x80;
       else
 	decbytes[0] = decbytes[0] | 0x80;
@@ -1521,6 +1521,7 @@ value_complement (struct value *arg1)
 int
 value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   LONGEST low_bound, high_bound;
   LONGEST word;
   unsigned rel_index;
@@ -1532,7 +1533,7 @@ value_bit_index (struct type *type, cons
   rel_index = index - low_bound;
   word = extract_unsigned_integer (valaddr + (rel_index / TARGET_CHAR_BIT), 1);
   rel_index %= TARGET_CHAR_BIT;
-  if (gdbarch_bits_big_endian (current_gdbarch))
+  if (gdbarch_bits_big_endian (gdbarch))
     rel_index = TARGET_CHAR_BIT - 1 - rel_index;
   return (word >> rel_index) & 1;
 }
Index: gdb-head/gdb/valops.c
===================================================================
--- gdb-head.orig/gdb/valops.c
+++ gdb-head/gdb/valops.c
@@ -471,7 +471,7 @@ value_cast (struct type *type, struct va
 	 otherwise occur when dealing with a target having two byte
 	 pointers and four byte addresses.  */
 
-      int addr_bit = gdbarch_addr_bit (current_gdbarch);
+      int addr_bit = gdbarch_addr_bit (get_type_arch (type2));
 
       LONGEST longest = value_as_long (arg2);
       if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
@@ -808,7 +808,7 @@ value_assign (struct value *toval, struc
 		     (int) sizeof (LONGEST) * HOST_CHAR_BIT);
 
 	    read_memory (value_address (toval), buffer, changed_len);
-	    modify_field (buffer, value_as_long (fromval),
+	    modify_field (type, buffer, value_as_long (fromval),
 			  value_bitpos (toval), value_bitsize (toval));
 	    changed_addr = value_address (toval);
 	    dest_buffer = buffer;
@@ -869,9 +869,8 @@ value_assign (struct value *toval, struc
 					  value_offset (toval),
 					  changed_len, buffer);
 
-		modify_field (buffer, value_as_long (fromval),
-			      value_bitpos (toval), 
-			      value_bitsize (toval));
+		modify_field (type, buffer, value_as_long (fromval),
+			      value_bitpos (toval), value_bitsize (toval));
 
 		put_frame_register_bytes (frame, value_reg,
 					  value_offset (toval),
@@ -2947,7 +2946,7 @@ value_slice (struct value *array, int lo
 	  else if (element > 0)
 	    {
 	      int j = i % TARGET_CHAR_BIT;
-	      if (gdbarch_bits_big_endian (current_gdbarch))
+	      if (gdbarch_bits_big_endian (get_type_arch (array_type)))
 		j = TARGET_CHAR_BIT - 1 - j;
 	      value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
 	    }
Index: gdb-head/gdb/valprint.c
===================================================================
--- gdb-head.orig/gdb/valprint.c
+++ gdb-head/gdb/valprint.c
@@ -401,7 +401,7 @@ void
 val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
 			 struct ui_file *stream)
 {
-  enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
 
   if (TYPE_LENGTH (type) > sizeof (LONGEST))
     {
Index: gdb-head/gdb/value.c
===================================================================
--- gdb-head.orig/gdb/value.c
+++ gdb-head/gdb/value.c
@@ -1162,7 +1162,7 @@ set_internalvar_component (struct intern
       addr = value_contents_writeable (var->u.value);
 
       if (bitsize)
-	modify_field (addr + offset,
+	modify_field (value_type (var->u.value), addr + offset,
 		      value_as_long (newval), bitpos, bitsize);
       else
 	memcpy (addr + offset, value_contents (newval),
@@ -1505,13 +1505,15 @@ value_as_double (struct value *val)
 CORE_ADDR
 value_as_address (struct value *val)
 {
+  struct gdbarch *gdbarch = get_type_arch (value_type (val));
+
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
 #if 0
   /* gdbarch_addr_bits_remove is wrong if we are being called for a
      non-address (e.g. argument to "signal", "info break", etc.), or
      for pointers to char, in which the low bits *are* significant.  */
-  return gdbarch_addr_bits_remove (current_gdbarch, value_as_long (val));
+  return gdbarch_addr_bits_remove (gdbarch, value_as_long (val));
 #else
 
   /* There are several targets (IA-64, PowerPC, and others) which
@@ -1596,8 +1598,8 @@ value_as_address (struct value *val)
 
   if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
       && TYPE_CODE (value_type (val)) != TYPE_CODE_REF
-      && gdbarch_integer_to_address_p (current_gdbarch))
-    return gdbarch_integer_to_address (current_gdbarch, value_type (val),
+      && gdbarch_integer_to_address_p (gdbarch))
+    return gdbarch_integer_to_address (gdbarch, value_type (val),
 				       value_contents (val));
 
   return unpack_long (value_type (val), value_contents (val));
@@ -1988,7 +1990,7 @@ unpack_field_as_long (struct type *type,
 
   /* Extract bits.  See comment above. */
 
-  if (gdbarch_bits_big_endian (current_gdbarch))
+  if (gdbarch_bits_big_endian (get_type_arch (type)))
     lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
   else
     lsbcount = (bitpos % 8);
@@ -2020,7 +2022,8 @@ unpack_field_as_long (struct type *type,
    0 <= BITPOS, where lbits is the size of a LONGEST in bits.  */
 
 void
-modify_field (gdb_byte *addr, LONGEST fieldval, int bitpos, int bitsize)
+modify_field (struct type *type, gdb_byte *addr,
+	      LONGEST fieldval, int bitpos, int bitsize)
 {
   ULONGEST oword;
   ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
@@ -2044,7 +2047,7 @@ modify_field (gdb_byte *addr, LONGEST fi
   oword = extract_unsigned_integer (addr, sizeof oword);
 
   /* Shifting for bit field depends on endianness of the target machine.  */
-  if (gdbarch_bits_big_endian (current_gdbarch))
+  if (gdbarch_bits_big_endian (get_type_arch (type)))
     bitpos = sizeof (oword) * 8 - bitpos - bitsize;
 
   oword &= ~(mask << bitpos);
Index: gdb-head/gdb/value.h
===================================================================
--- gdb-head.orig/gdb/value.h
+++ gdb-head/gdb/value.h
@@ -589,8 +589,8 @@ extern void release_value (struct value 
 
 extern int record_latest_value (struct value *val);
 
-extern void modify_field (gdb_byte *addr, LONGEST fieldval, int bitpos,
-			  int bitsize);
+extern void modify_field (struct type *type, gdb_byte *addr,
+			  LONGEST fieldval, int bitpos, int bitsize);
 
 extern void type_print (struct type *type, char *varstring,
 			struct ui_file *stream, int show);
Index: gdb-head/gdb/varobj.c
===================================================================
--- gdb-head.orig/gdb/varobj.c
+++ gdb-head/gdb/varobj.c
@@ -2278,8 +2278,9 @@ value_get_print_value (struct value *val
   opts.raw = 1;
   if (thevalue)
     {
+      struct gdbarch *gdbarch = get_type_arch (value_type (value));
       make_cleanup (xfree, thevalue);
-      LA_PRINT_STRING (stb, builtin_type (current_gdbarch)->builtin_char,
+      LA_PRINT_STRING (stb, builtin_type (gdbarch)->builtin_char,
 		       (gdb_byte *) thevalue, strlen (thevalue),
 		       0, &opts);
     }
Index: gdb-head/gdb/python/python-prettyprint.c
===================================================================
--- gdb-head.orig/gdb/python/python-prettyprint.c
+++ gdb-head/gdb/python/python-prettyprint.c
@@ -181,7 +181,8 @@ static void
 print_string_repr (PyObject *printer, const char *hint,
 		   struct ui_file *stream, int recurse,
 		   const struct value_print_options *options,
-		   const struct language_defn *language)
+		   const struct language_defn *language,
+		   struct gdbarch *gdbarch)
 {
   char *output;
   struct value *replacement = NULL;
@@ -190,7 +191,7 @@ print_string_repr (PyObject *printer, co
   if (output)
     {
       if (hint && !strcmp (hint, "string"))
-	LA_PRINT_STRING (stream, builtin_type (current_gdbarch)->builtin_char,
+	LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
 			 (gdb_byte *) output, strlen (output),
 			 0, options);
       else
@@ -466,6 +467,7 @@ apply_val_pretty_printer (struct type *t
 			  const struct value_print_options *options,
 			  const struct language_defn *language)
 {
+  struct gdbarch *gdbarch = get_type_arch (type);
   PyObject *printer = NULL;
   PyObject *val_obj = NULL;
   struct value *value;
@@ -498,7 +500,8 @@ apply_val_pretty_printer (struct type *t
   make_cleanup (free_current_contents, &hint);
 
   /* Print the section */
-  print_string_repr (printer, hint, stream, recurse, options, language);
+  print_string_repr (printer, hint, stream, recurse, options, language,
+		     gdbarch);
   print_children (printer, hint, stream, recurse, options, language);
   result = 1;
 
Index: gdb-head/gdb/parse.c
===================================================================
--- gdb-head.orig/gdb/parse.c
+++ gdb-head/gdb/parse.c
@@ -1227,7 +1227,7 @@ push_type_int (int n)
 void
 push_type_address_space (char *string)
 {
-  push_type_int (address_space_name_to_int (string));
+  push_type_int (address_space_name_to_int (parse_gdbarch, string));
 }
 
 enum type_pieces
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -45,21 +45,6 @@ gnuv3_is_operator_name (const char *name
 }
 
 
-/* Determine architecture of class DOMAIN.  This architecture is used
-   to query C++ ABI details (types, method pointer layout, etc.).
-
-   Note that we assume DOMAIN must have been allocated with an OBJFILE;
-   GDB does not provide any built-in class types.  Thus we use the
-   architecture of that OBJFILE to define the C++ ABI.  */
-
-static struct gdbarch *
-get_class_arch (struct type *domain)
-{
-  gdb_assert (TYPE_CODE (domain) == TYPE_CODE_CLASS);
-  gdb_assert (TYPE_OBJFILE (domain) != NULL);
-  return get_objfile_arch (TYPE_OBJFILE (domain));
-}
-
 /* To help us find the components of a vtable, we build ourselves a
    GDB type object representing the vtable structure.  Following the
    V3 ABI, it goes something like this:
@@ -227,14 +212,8 @@ gnuv3_rtti_type (struct value *value,
   if (TYPE_CODE (values_type) != TYPE_CODE_CLASS)
     return NULL;
 
-  /* This routine may be called for Java types that do not have
-     a proper objfile.  Just return NULL for those.  */
-  if (!TYPE_OBJFILE (values_type)
-      || !TYPE_OBJFILE (values_type)->obfd)
-    return NULL;
-
   /* Determine architecture.  */
-  gdbarch = get_class_arch (values_type);
+  gdbarch = get_type_arch (values_type);
   vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data);
 
   /* If we can't find the virtual table pointer for values_type, we
@@ -386,7 +365,7 @@ gnuv3_virtual_fn_field (struct value **v
     error (_("Only classes can have virtual functions."));
 
   /* Determine architecture.  */
-  gdbarch = get_class_arch (values_type);
+  gdbarch = get_type_arch (values_type);
 
   /* Cast our value to the base class which defines this virtual
      function.  This takes care of any necessary `this'
@@ -420,7 +399,7 @@ gnuv3_baseclass_offset (struct type *typ
   int vbasetype_vptr_fieldno;
 
   /* Determine architecture.  */
-  gdbarch = get_class_arch (type);
+  gdbarch = get_type_arch (type);
   vtable_type = gdbarch_data (gdbarch, vtable_type_gdbarch_data);
   ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
 
@@ -574,7 +553,7 @@ gnuv3_print_method_ptr (const gdb_byte *
 			struct ui_file *stream)
 {
   struct type *domain = TYPE_DOMAIN_TYPE (type);
-  struct gdbarch *gdbarch = get_class_arch (domain);
+  struct gdbarch *gdbarch = get_type_arch (domain);
   CORE_ADDR ptr_value;
   LONGEST adjustment;
   int vbit;
@@ -640,7 +619,7 @@ static int
 gnuv3_method_ptr_size (struct type *type)
 {
   struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type));
-  struct gdbarch *gdbarch = get_class_arch (domain_type);
+  struct gdbarch *gdbarch = get_type_arch (domain_type);
   return 2 * TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
 }
 
@@ -651,7 +630,7 @@ gnuv3_make_method_ptr (struct type *type
 		       CORE_ADDR value, int is_virtual)
 {
   struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type));
-  struct gdbarch *gdbarch = get_class_arch (domain_type);
+  struct gdbarch *gdbarch = get_type_arch (domain_type);
   int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
 
   /* FIXME drow/2006-12-24: The adjustment of "this" is currently
@@ -693,7 +672,7 @@ gnuv3_method_ptr_to_value (struct value 
   method_type = TYPE_TARGET_TYPE (check_typedef (value_type (method_ptr)));
 
   /* Extract the pointer to member.  */
-  gdbarch = get_class_arch (domain_type);
+  gdbarch = get_type_arch (domain_type);
   vbit = gnuv3_decode_method_ptr (gdbarch, contents, &ptr_value, &adjustment);
 
   /* First convert THIS to match the containing type of the pointer to
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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