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]

[07/15] Per-value architecture support


Hello,

operations of values need to be architecture-aware in certain cases:

- fundamental properties of the value are defined by the architecture
  (byte order, bit order, floating-point format, integer/pointer <->
   address conversions, function pointer conversions)

- value printing and some value arithmetic operations need to construct
  character types / primitive types / pointer or reference types related
  to the architecture of the value

- when pushing a value into target memory, we need to know the architecture

To address these issues, this patch implements the following changes:

- Whenever a value is allocated, we now require both a type *and* an
  architecture.   All value constructors thus get a gdbarch parameter,
  and all call sites are updates.

- The la_printstr and la_val_print language callbacks also get a
  gdbarch callback; all implementations and call sites are updated.

Due to the fact that value printing and value creation are somewhat
intertwined  -- the value_print family of routines which get a value
object and the val_print family of routines which just get the
components of a value call into each other in various ways -- this
patch implements both the above changes in a single patch.

Bye,
Ulrich


ChangeLog:

	* language.h (struct language_defn): Add GDBARCH parameter
	to la_printstr and la_val_print members.
	(LA_VAL_PRINT, LA_PRINT_STRING): Pass GDBARCH parameter.
	* language.c (unk_lang_printstr): Add GDBARCH paramter.
	(unk_lang_val_print): Likewise.
	* ada-lang.h (ada_printstr, ada_val_print): Likewise.
	* ada-valprint.c (ada_printstr, ada_val_print): Likewise.
	* c-lang.h (c_val_print, c_printstr): Likewise.
	* c-lang.c (c_printstr): Likewise.
	* c-valprint.c (c_val_print): Likewise.
	* f-lang.h (f_val_print): Likewise.
	* f-lang.c (f_printstr): Likewise.
	* f-valprint.c (f_val_print): Likewise.
	* jv-lang.h (java_val_print): Likewise.
	* jv-valprint.c (java_val_print): Likewise.
	* m2-lang.h (m2_val_print): Likewise.
	* m2-lang.c (m2_printstr): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* objc-lang.c (objc_printstr): Likewise.
	* p-lang.h (pascal_printstr, pascal_val_print): Likewise.
	* p-lang.c (pascal_printstr): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	* scm-lang.h (scm_val_print): Likewise.
	* scm-lang.c (scm_printstr): Likewise.
	* scm-valprint.c (scm_val_print): Likewise.
	* python/pyhton.h (apply_val_pretty_printer): Likewise.
	* python/pyhton-prettyprint.c (apply_val_pretty_printer): Likewise.
	* ada-valprint.c (ada_val_print_1): Update call to c_val_print.
	(print_field_values): Update call to ada_val_print.
	* jv-valprint.c (java_val_print): Update call to c_val_print.
	* scm-valprint.c (scm_val_print): Likewise.

	* value.h (val_print, val_print_string, print_floating,
	print_decimal_floating): Add GDBARCH parameter.
	* valprint.h (maybe_print_array_index, val_print_array_elements,
	val_print_type_code_int, val_print_type_code_flags): Likewise.
	* valprint.c (val_print): Add GDBARCH parameter.  Pass to
	language->la_val_print callback.
	(val_print_string, print_floating, print_decimal_floating,
	maybe_print_array_index, val_print_array_elements,
	val_print_type_code_int, val_print_type_code_flags): Add
	GDBARCH parameter.
	* gdbtypes.h (print_scalar_formatted): Add GDBARCH parameter.
	* printcmd.c (print_scalar_formatted): Likewise.

	Update all callers of val_print, val_print_string, print_floating,
	print_decimal_floating, maybe_print_array_index,
	val_print_array_elements, val_print_type_code_int,
	val_print_type_code_flags, print_scalar_formatted,
	LA_VAL_PRINT, LA_PRINT_STRING and apply_val_pretty_printer
	to pass an appropriate architecture:
	* ada-valprint.c (ada_print_floating, ada_val_print_1,
	ada_val_print_array, ada_value_print, print_field_values,
	val_print_packed_array_elements): Update.
	* cp-valprint.c (cp_print_value, cp_print_value_fields,
	cp_print_static_field): Update.
	* c-valprint.c (c_val_print): Update.
	* f-valprint.c (f77_print_array_1, f_val_print): Update.
	* jv-valprint.c (java_value_print, java_print_value_fields,
	java_val_print): Update.
	* m2-valprint.c (print_unpacked_pointer, m2_print_array_contents,
	m2_val_print): Update.
	* p-valprint.c (pascal_val_print,
	pascal_object_print_value_fields): Update.
	* expprint.c (print_subexp_standard): Update.
	* printcmd.c (print_formatted, print_scalar_formatted): Update.
	* varobj.c (value_get_print_value): Update.
	* valprint.c (val_print, common_val_print, val_print_array_elements,
	val_print_string, value_print): Update.
	* auxv.c (fprint_target_auxv): Update.
	* infcmd.c (registers_info, default_print_registers_info): Update.
	* tui/tui-regs.c (tui_register_format): Update.
	* mi/mi-main.c (get_register, mi_cmd_data_evaluate_expression,
	mi_cmd_data_read_memory): Update.
	* mips-tdep.c (mips_print_fp_register, mips_print_register): Update.
	* mt-tdep.c (mt_registers_info): Update.
	* sh64-tdep.c (sh64_do_register): Update.
	* python/python-prettyprint.c (print_string_repr): Update.

	* c-lang.h (cp_print_value_fields): Add GDBARCH parameter.
	(cp_print_class_member): Likewise.
	* cp-valprint.c (cp_print_value_fields): Likewise.
	(cp_print_class_member): Likewise.
	(cp_print_value, cp_print_static_field): Update calls.
	* c-valprint.c (c_val_print): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* p-lang.h (pascal_object_print_value_fields): Add GDBARCH parameter.
	* p-valprint.c (pascal_object_print_value_fields): Likewise.
	(pascal_val_print, pascal_object_print_value,
	pascal_object_print_static_field): Update calls.

	* ada-valprint.c (struct ada_val_print_args): Add GDBARCH member.
	(ada_val_print): Initialize it.
	(val_print_packed_array_elements, printable_val_type,
	ada_print_floating, printstr, ada_val_print_array, ada_val_print_1,
	print_variant_part, print_record, print_field_values): Add GDBARCH
	parameter.  Update all local callers.
	* cp-valprint.c (cp_print_value): Likewise.
	* c-valprint.c (print_function_pointer_address): Likewise.
	* f-valprint.c (f77_print_array_1, f77_print_array): Likewise.
	* jv-valprint.c (java_print_value_fields): Likewise.
	* m2-valprint.c (print_unpacked_pointer, m2_print_array_contents,
	print_function_pointer_address, m2_print_long_set,
	m2_print_unbounded_array, print_variable_at_address): Likewise.
	* p-valprint.c (pascal_object_print_value): Likewise.
	* scm-valprint.c (scm_ipruk, scm_scmval_print, scm_scmlist_print,
	scm_inferior_print): Likewise.


	* value.h (value_arch): Add prototype.
	(allocate_value, allocate_value_lazy, allocate_repeat_value,
	allocate_computed_value, value_from_longest, value_from_pointer,
	value_from_double, value_from_decfloat, value_bitstring, value_cstring,
	value_string, value_at, value_at_lazy, value_from_contents_and_address,
	value_from_register, value_of_variable, address_of_variable,
	read_var_value, value_of_internalvar, value_zero, value_one,
	value_aggregate_elt, value_static_field, value_bit_index,
	modify_field, unpack_field_as_long, value_fn_field): Add GDBARCH
	parameter.
	* value.c (struct value): Add GDBARCH member.
	(value_arch): New accessor function.
	(allocate_value_lazy): Add GDBARCH parameter.  Store into struct value.
	(allocate_value, allocate_repeat_value, allocate_computed_value,
	value_of_internalval, value_static_field, unpack_field_as_long,
	modify_field, value_from_longest, value_from_pointer,
	value_from_contents_and_address, value_from_double,
	value_from_decfloat, value_fn_field): Add GDBARCH parameter.
	* valops.c (value_zero, value_one, value_at, value_at_lazy,
	value_string, value_cstring, value_bitstring, value_of_variable,
	address_of_variable, value_aggregate_elt): Likewise.
	* valarith.c (value_bit_index): Likewise.
	* findvar.c (read_var_value, value_from_register): Likewise.

	* gdbarch.sh (value_from_register): Add VAL_ARCH parameter.
	* gdbarch.c, gdbarch.h: Regenerate.
	* findvar.c (value_from_register): Pass architecture to
	gdbarch_value_from_register callback.
	(default_value_from_register): Add VAL_ARCH parameter.
	* value.h (val_print_array_elements): Likewise.
	* s390-tdep.c (s390_value_from_register): Add VAL_ARCH parameter.
	Pass it to default_value_from_register.
	* spu-tdep.c (spu_value_from_register): Add VAL_ARCH parameter.
	Pass it to default_value_from_register.

	* symtab.h (struct symbol_computed_ops): Add GDBARCH parameter to
	read_variable member.
	* findvar.c (read_var_value): Pass architecture to ->read_variable.
	* dwarf2loc.c (locexpr_read_variable, loclist_read_variable): Add
	GDBARCH parameter, pass architecture to dwarf2_evaluate_loc_desc.
	(dwarf2_evaluate_loc_desc): Add GDBARCH parameter.

	* value.h (internalvar_make_value): Add GDBARCH parameter.
	* value.c (value_of_internalval): Pass architecture to ->make_value.
	* infrun.c (siginfo_make_value): Add GDBARCH parameter.  Use it
	instead of current frame architecture.

	Update all calls to allocate_value, allocate_value_lazy,
	allocate_repeat_value, allocate_computed_value, value_from_longest,
	value_from_pointer, value_from_double, value_from_decfloat,
	value_string, value_cstring, value_bitstring, value_at, value_at_lazy,
	value_fn_field, value_from_contents_and_address, value_from_register,
	value_of_variable, address_of_variable, read_var_value,
	value_of_internalvar, value_zero, value_one, value_aggregate_elt,
	value_static_field, value_bit_index, modify_field, unpack_field_as_long
	to pass appropriate architecture:
	* ada-valprint.c (ada_value_print, ada_val_print_1): Update.
	* cp-valprint.c (cp_print_value_fields): Update.
	* c-valprint.c (c_val_print): Update.
	* f-valprint.c (f_val_print): Update.
	* infcmd.c (print_return_value): Update.
	* jv-valprint.c (java_value_print, java_print_value_fields): Update.
	* m2-valprint.c (m2_print_long_set, m2_print_unbounded_array,
	print_variable_at_address, m2_val_print): Update.
	* printcmd.c (print_scalar_formatted, do_examine, x_command,
	print_variable_and_value, printf_command, set_next_address): Update.
	* p-valprint.c (pascal_val_print, pascal_object_print_value_fields):
	Update.
	* scm-valprint.c (scm_inferior_print): Update.
	* valprint.c (maybe_print_array_index): Update.
	* ada-lang.c (coerce_unspec_val_to_type, modify_general_field,
	thin_data_pntr, desc_bounds, ada_value_primitive_packed_val,
	ada_value_ptr_subscript, ada_value_slice_from_ptr, ada_array_bound,
	ada_array_length, empty_array, ada_convert_actual, assign_component,
	make_array_descriptor, value_tag_from_contents_and_address,
	ada_tag_name_2, ada_value_struct_elt, ada_which_variant_applies,
	ada_template_to_fixed_record_type_1, to_record_with_fixed_variant_part,
	ada_to_fixed_value_create, value_pos_atr, value_val_atr, cast_to_fixed,
	cast_from_fixed, ada_value_binop, ada_evaluate_subexp, get_var_value):
	Update.
	* ada-tasks.c (read_atcb): Update.
	* alpha-tdep.c (alpha_push_dummy_call): Update.
	* ax-gdb.c (const_var_ref, const_expr): Update.
	* dummy-frame.c (dummy_frame_prev_register): Update.
	* dwarf2expr.c (execute_stack_op): Update.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc, loclist_read_variable): Update.
	* eval.c (evaluate_struct_tuple, evaluate_subexp_standard,
	evaluate_subexp_for_address, evaluate_subexp_with_coercion,
	evaluate_subexp_for_sizeof): Update.
	* expprint.c (print_subexp_standard): Update.
	* findcmd.c (find_command): Update.
	* findvar.c (value_of_register, value_of_register_lazy, read_var_value,
	default_value_from_register, value_from_register, address_from_register):
	Update.
	* frame-unwind.c (frame_unwind_got_optimized, frame_unwind_got_memory,
	frame_unwind_got_constant, frame_unwind_got_bytes,
	frame_unwind_got_address): Update.
	* gcore.c (derive_heap_segment): Update.
	* gnu-v2-abi.c (gnuv2_virtual_fn_field): Update.
	* gnu-v3-abi.c (gnuv3_rtti_type, gnuv3_get_vtable, gnuv3_get_virtual_fn,
	gnuv3_baseclass_offset, gnuv3_method_ptr_to_value): Update.
	* infcall.c (call_function_by_hand): Update.
	* jv-lang.c (java_class_from_object, evaluate_subexp_java): Update.
	* linux-fork.c (checkpoint_command): Update
	* m2-lang.c (evaluate_subexp_modula2): Update.
	* objc-lang.c (lookup_objc_class, lookup_child_selector,
	value_nsstring): Update.
	* python/python-value.c (valpy_binop, valpy_absolute,
	convert_value_from_python): Update.
	* python/python-frame.c (frapy_read_var): Update.
	* python/python-prettyprint.c (apply_val_pretty_printer): Update.
	* scm-lang.c (scm_lookup_name, evaluate_exp): Update.
	* sentinel-frame.c (sentinel_frame_prev_register): Update.
	* sparc-tdep.c (sparc32_store_arguments): Update.
	* sparc64-tdep.c (sparc64_store_arguments): Update.
	* std-regs.c (value_of_builtin_frame_fp_reg,
	value_of_builtin_frame_pc_reg): Update.
	* tracepoint.c (set_traceframe_context): Update.
	* valarith.c (value_ptradd, value_ptrsub, value_subscript,
	value_subscripted_rvalue, value_bitstring_subscript, value_x_binop,
	value_x_unop, value_concat, value_binop, value_pos, value_neg,
	value_complement, value_in): Update.
	* valops.c (find_function_in_inferior, value_allocate_space_in_inferior,
	value_cast_structs, value_cast, value_zero, value_one, value_at,
	value_at_lazy, value_assign, value_repeat, value_of_variable,
	address_of_variable, value_coerce_to_target, value_coerce_array,
	value_coerce_function, value_addr, value_ind, value_array,
	value_cstring, value_string, value_bitstring,
	search_struct_field, value_struct_elt_for_reference,
	value_maybe_namespace_elt, value_full_object, value_of_local,
	value_slice, value_literal_complex, cast_into_complex,
	search_struct_method, value_struct_elt, find_overload_match): Update.
	* value.c (allocate_value, allocate_repeat_value,
	allocate_computed_value, value_copy, value_of_internalvar,
	set_internalvar_component, show_convenience, value_static_field,
	value_primitive_field, value_fn_field, value_from_longest,
	value_from_pointer, value_from_contents_and_address,
	value_from_double, value_from_decfloat, coerce_ref): Update.
	* varobj.c (varobj_get_type, value_struct_element_index,
	c_describe_child): Update.
	* mi/mi-cmd-stack.c (list_args_or_locals): Update.
	* stack.c (print_frame_args): Update.
	* c-lang.c (evaluate_subexp_c): Update.
	* infrun.c (siginfo_make_value): Update.

	* ax-gdb.c (const_var_ref): Add GDBARCH parameter.
	(const_expr): Add EXPRESSION parameter.  Update calls.
	(maybe_const_expr): Add EXPRESSION parameter.  Update calls.
	(gen_repeat): Update calls to const_expr and maybe_const_expr.

	* printcmd.c (do_examine): Add GDBARCH paramter.
	(x_command, do_one_display): Update calls.

	* valops.c (value_struct_elt_for_reference, value_namespace_elt,
	value_maybe_namespace_elt): Add GDBARCH parameter.
	(value_aggregate_elt, value_struct_elt_for_reference,
	value_namespace_elt): Update calls.

	* python/python-prettyprint.c (print_string_repr): Add GDBARCH
	parameter.
	* python/python-prettyprint.c (apply_val_pretty_printer): Update call.

	* ada-lang.h (ada_value_primitive_packed_val,
	ada_which_variant_applies, ada_vax_float_print_function,
	ada_to_fixed_type, ada_template_to_fixed_record_type_1): Add GDBARCH
	parameter.
	* ada-lang.c (ada_value_primitive_packed_val,
	ada_which_variant_applies, ada_vax_float_print_function,
	ada_to_fixed_type, ada_template_to_fixed_record_type_1): Likewise.
	(value_subscript_packed, ada_value_primitive_field,
	ada_value_struct_elt, ada_template_to_fixed_record_type_1,
	template_to_fixed_record_type, to_fixed_array_type,
	to_fixed_variant_branch_type, ada_to_fixed_value_create,
	decode_packed_array, unwrap_value): Update calls.
	* ada-valprint.c (val_print_packed_array_elements, print_variant_part,
	ada_val_print_1, printable_val_type, ada_value_print): Likewise.
	* ada-tasks.c (get_tcb_types_info): Likewise.

	* ada-lang.c (modify_general_field, to_fixed_array_type,
	to_fixed_range_type, move_bits, get_var_value,
	ada_to_fixed_value_create, ada_array_bound_from_type, empty_array,
	value_tag_from_contents_and_address, template_to_fixed_record_type,
	to_record_with_fixed_variant_part, to_fixed_record_type,
	ada_to_fixed_type_1): Add GDBARCH parameter.
	Update all local callers.


	* mi/mi-main.c: Include "arch-utils.h".
	(mi_cmd_data_read_memory): Use get_current_arch ().
	* value.c: Include "arch-utils.h".
	(show_convenience): Use get_current_arch ().


	Update various routines to eliminate use of current_gdbarch
	in favour of the (now available) appropriate architecture:
	* c-valprint.c (print_function_pointer_address): Update.
	* m2-valprint.c (print_function_pointer_address): Update.
	* jv-valprint.c (java_value_print): Update.
	* scm-valprint.c (scm_inferior_print, scm_scmval_print): Update.
	* valprint.c (val_print_type_code_int): Update.
	* ada-lang.c (decode_packed_array, ada_value_primitive_packed_val,
	move_bits, ada_value_assign, value_assign_to_component, ensure_lval,
	to_fixed_range_type): Update.
	* eval.c (evaluate_subexp_standard): Update.
	* infcall.c (find_function_addr): Update.
	* varobj.c (value_get_print_value): Update.
	* valarith.c (value_bitstring_subscript, value_neg, value_bit_index):
	Update.
	* valops.c (value_cast, value_slice, value_coerce_to_target): Update.
	* value.c (value_as_address, unpack_field_as_long, modify_field):
	Update.
	* printcmd.c (print_scalar_formatted): Update.
	* python/python-prettyprint.c (print_string_repr,
	apply_val_pretty_printer): Update.

	Update various routines to eliminate use of get_objfile_arch ()
	in favour of the (now available) appropriate architecture:
	* ada-valprint.c (ada_val_print_1): Update.
	* value.c (value_fn_field): Update.

doc/ChangeLog:

	* gdbint.texinfo (Values): Update code example for changed
	signature of allocate_computed_value.
	(Pointers Are Not Always Addresses): Update signature of
	value_from_pointer.


Index: gdb-head/gdb/ada-lang.h
===================================================================
--- gdb-head.orig/gdb/ada-lang.h
+++ gdb-head/gdb/ada-lang.h
@@ -246,8 +246,8 @@ extern void ada_error (char *); /* Defin
 extern void ada_print_type (struct type *, char *, struct ui_file *, int,
                             int);
 
-extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-                          struct ui_file *, int,
+extern int ada_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			  int, CORE_ADDR, struct ui_file *, int,
 			  const struct value_print_options *);
 
 extern int ada_value_print (struct value *, struct ui_file *,
@@ -259,8 +259,8 @@ extern void ada_emit_char (int, struct t
 
 extern void ada_printchar (int, struct type *, struct ui_file *);
 
-extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *,
-			  unsigned int, int,
+extern void ada_printstr (struct ui_file *, struct type *, struct gdbarch *,
+			  const gdb_byte *, unsigned int, int,
 			  const struct value_print_options *);
 
 struct value *ada_convert_actual (struct value *actual,
@@ -337,7 +337,8 @@ extern int ada_is_packed_array_type (str
 extern struct value *ada_value_primitive_packed_val (struct value *,
 						     const gdb_byte *,
                                                      long, int, int,
-                                                     struct type *);
+                                                     struct type *,
+						     struct gdbarch *);
 
 extern struct type *ada_coerce_to_simple_array_type (struct type *);
 
@@ -394,18 +395,20 @@ extern int ada_is_vax_floating_type (str
 
 extern int ada_vax_float_type_suffix (struct type *);
 
-extern struct value *ada_vax_float_print_function (struct type *);
+extern struct value *ada_vax_float_print_function (struct type *,
+						   struct gdbarch *);
 
 extern struct type *ada_system_address_type (void);
 
 extern int ada_which_variant_applies (struct type *, struct type *,
-				      const gdb_byte *);
+				      struct gdbarch *, const gdb_byte *);
 
-extern struct type *ada_to_fixed_type (struct type *, const gdb_byte *,
-				       CORE_ADDR, struct value *,
-                                       int check_tag);
+extern struct type *ada_to_fixed_type (struct type *, struct gdbarch *,
+				       const gdb_byte *, CORE_ADDR,
+				       struct value *, int check_tag);
 
 extern struct type *ada_template_to_fixed_record_type_1 (struct type *type,
+							 struct gdbarch *gdbarch,
 							 const gdb_byte *valaddr,
 							 CORE_ADDR address,
 							 struct value *dval0,
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -39,6 +39,7 @@
 struct ada_val_print_args
 {
   struct type *type;
+  struct gdbarch *gdbarch;
   const gdb_byte *valaddr0;
   int embedded_offset;
   CORE_ADDR address;
@@ -47,11 +48,12 @@ struct ada_val_print_args
   const struct value_print_options *options;
 };
 
-static void print_record (struct type *, const gdb_byte *, struct ui_file *,
-			  int, const struct value_print_options *);
+static void print_record (struct type *, struct gdbarch *, const gdb_byte *,
+			  struct ui_file *, int,
+			  const struct value_print_options *);
 
-static int print_field_values (struct type *, const gdb_byte *,
-			       struct ui_file *, int,
+static int print_field_values (struct type *, struct gdbarch *,
+			       const gdb_byte *, struct ui_file *, int,
 			       const struct value_print_options *,
 			       int, struct type *,
 			       const gdb_byte *);
@@ -60,8 +62,8 @@ static void adjust_type_signedness (stru
 
 static int ada_val_print_stub (void *args0);
 
-static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
-			    struct ui_file *, int,
+static int ada_val_print_1 (struct type *, struct gdbarch *, const gdb_byte *,
+			    int, CORE_ADDR, struct ui_file *, int,
 			    const struct value_print_options *);
 
 
@@ -142,9 +144,9 @@ print_optional_low_bound (struct ui_file
     TYPE must have been decoded (as by ada_coerce_to_simple_array).  */
 
 static void
-val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
-				 int bitoffset, struct ui_file *stream,
-				 int recurse,
+val_print_packed_array_elements (struct type *type, struct gdbarch *gdbarch,
+				 const gdb_byte *valaddr, int bitoffset,
+				 struct ui_file *stream, int recurse,
 				 const struct value_print_options *options)
 {
   unsigned int i;
@@ -189,13 +191,13 @@ val_print_packed_array_elements (struct 
 	    }
 	}
       wrap_here (n_spaces (2 + 2 * recurse));
-      maybe_print_array_index (index_type, i + low, stream, options);
+      maybe_print_array_index (index_type, gdbarch, i + low, stream, options);
 
       i0 = i;
       v0 = ada_value_primitive_packed_val (NULL, valaddr,
 					   (i0 * bitsize) / HOST_CHAR_BIT,
 					   (i0 * bitsize) % HOST_CHAR_BIT,
-					   bitsize, elttype);
+					   bitsize, elttype, gdbarch);
       while (1)
 	{
 	  i += 1;
@@ -204,7 +206,7 @@ val_print_packed_array_elements (struct 
 	  v1 = ada_value_primitive_packed_val (NULL, valaddr,
 					       (i * bitsize) / HOST_CHAR_BIT,
 					       (i * bitsize) % HOST_CHAR_BIT,
-					       bitsize, elttype);
+					       bitsize, elttype, gdbarch);
 	  if (memcmp (value_contents (v0), value_contents (v1), eltlen) != 0)
 	    break;
 	}
@@ -213,8 +215,8 @@ val_print_packed_array_elements (struct 
 	{
 	  struct value_print_options opts = *options;
 	  opts.deref_ref = 0;
-	  val_print (elttype, value_contents (v0), 0, 0, stream,
-		     recurse + 1, &opts, current_language);
+	  val_print (elttype, value_arch (v0), value_contents (v0), 0, 0,
+		     stream, recurse + 1, &opts, current_language);
 	  annotate_elt_rep (i - i0);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
 	  annotate_elt_rep_end ();
@@ -239,11 +241,11 @@ val_print_packed_array_elements (struct 
 		      fprintf_filtered (stream, ", ");
 		    }
 		  wrap_here (n_spaces (2 + 2 * recurse));
-		  maybe_print_array_index (index_type, j + low,
+		  maybe_print_array_index (index_type, gdbarch, j + low,
 					   stream, options);
 		}
-	      val_print (elttype, value_contents (v0), 0, 0, stream,
-			 recurse + 1, &opts, current_language);
+	      val_print (elttype, value_arch (v0), value_contents (v0), 0, 0,
+			 stream, recurse + 1, &opts, current_language);
 	      annotate_elt ();
 	    }
 	}
@@ -259,9 +261,11 @@ val_print_packed_array_elements (struct 
 }
 
 static struct type *
-printable_val_type (struct type *type, const gdb_byte *valaddr)
+printable_val_type (struct type *type, struct gdbarch *gdbarch,
+		    const gdb_byte *valaddr)
 {
-  return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL, 1);
+  return ada_to_fixed_type (ada_aligned_type (type),
+			    gdbarch, valaddr, 0, NULL, 1);
 }
 
 /* Print the character C on STREAM as part of the contents of a literal
@@ -314,7 +318,7 @@ ui_memcpy (void *dest, const char *buffe
    point.  We use GNAT format for NaNs and infinities.  */
 static void
 ada_print_floating (const gdb_byte *valaddr, struct type *type,
-		    struct ui_file *stream)
+		    struct gdbarch *gdbarch, struct ui_file *stream)
 {
   char buffer[64];
   char *s, *result;
@@ -322,7 +326,7 @@ ada_print_floating (const gdb_byte *vala
   struct ui_file *tmp_stream = mem_fileopen ();
   struct cleanup *cleanups = make_cleanup_ui_file_delete (tmp_stream);
 
-  print_floating (valaddr, type, tmp_stream);
+  print_floating (valaddr, type, gdbarch, tmp_stream);
   ui_file_put (tmp_stream, ui_memcpy, buffer);
   do_cleanups (cleanups);
 
@@ -455,7 +459,8 @@ ada_print_scalar (struct type *type, LON
  */
 
 static void
-printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
+printstr (struct ui_file *stream, struct type *elttype,
+	  struct gdbarch *gdbarch, const gdb_byte *string,
 	  unsigned int length, int force_ellipses, int type_len,
 	  const struct value_print_options *options)
 {
@@ -545,12 +550,13 @@ printstr (struct ui_file *stream, struct
 }
 
 void
-ada_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+ada_printstr (struct ui_file *stream, struct type *type,
+	      struct gdbarch *gdbarch, const gdb_byte *string,
 	      unsigned int length, int force_ellipses,
 	      const struct value_print_options *options)
 {
-  printstr (stream, type, string, length, force_ellipses, TYPE_LENGTH (type),
-	    options);
+  printstr (stream, type, gdbarch, string, length, force_ellipses,
+	    TYPE_LENGTH (type), options);
 }
 
 
@@ -565,13 +571,15 @@ ada_printstr (struct ui_file *stream, st
    continuation lines; this amount is roughly twice the value of RECURSE.  */
 
 int
-ada_val_print (struct type *type, const gdb_byte *valaddr0,
+ada_val_print (struct type *type, struct gdbarch *gdbarch,
+	       const gdb_byte *valaddr0,
 	       int embedded_offset, CORE_ADDR address,
 	       struct ui_file *stream, int recurse,
 	       const struct value_print_options *options)
 {
   struct ada_val_print_args args;
   args.type = type;
+  args.gdbarch = gdbarch;
   args.valaddr0 = valaddr0;
   args.embedded_offset = embedded_offset;
   args.address = address;
@@ -588,7 +596,7 @@ static int
 ada_val_print_stub (void *args0)
 {
   struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
-  return ada_val_print_1 (argsp->type, argsp->valaddr0,
+  return ada_val_print_1 (argsp->type, argsp->gdbarch, argsp->valaddr0,
 			  argsp->embedded_offset, argsp->address,
 			  argsp->stream, argsp->recurse, argsp->options);
 }
@@ -599,8 +607,9 @@ ada_val_print_stub (void *args0)
    of the return value is also identical to ada_val_print.  */
 
 static int
-ada_val_print_array (struct type *type, const gdb_byte *valaddr,
-		     CORE_ADDR address, struct ui_file *stream, int recurse,
+ada_val_print_array (struct type *type, struct gdbarch *gdbarch,
+		     const gdb_byte *valaddr, CORE_ADDR address,
+		     struct ui_file *stream, int recurse,
 		     const struct value_print_options *options)
 {
   struct type *elttype = TYPE_TARGET_TYPE (type);
@@ -639,7 +648,7 @@ ada_val_print_array (struct type *type, 
           len = temp_len;
         }
 
-      printstr (stream, elttype, valaddr, len, 0, eltlen, options);
+      printstr (stream, elttype, gdbarch, valaddr, len, 0, eltlen, options);
       result = len;
     }
   else
@@ -647,10 +656,10 @@ ada_val_print_array (struct type *type, 
       fprintf_filtered (stream, "(");
       print_optional_low_bound (stream, type, options);
       if (TYPE_FIELD_BITSIZE (type, 0) > 0)
-        val_print_packed_array_elements (type, valaddr, 0, stream,
+        val_print_packed_array_elements (type, gdbarch, valaddr, 0, stream,
                                          recurse, options);
       else
-        val_print_array_elements (type, valaddr, address, stream,
+        val_print_array_elements (type, gdbarch, valaddr, address, stream,
                                   recurse, options, 0);
       fprintf_filtered (stream, ")");
     }
@@ -662,7 +671,8 @@ ada_val_print_array (struct type *type, 
    does not catch evaluation errors (leaving that to ada_val_print).  */
 
 static int
-ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
+ada_val_print_1 (struct type *type, struct gdbarch *gdbarch,
+		 const gdb_byte *valaddr0,
 		 int embedded_offset, CORE_ADDR address,
 		 struct ui_file *stream, int recurse,
 		 const struct value_print_options *options)
@@ -681,7 +691,7 @@ ada_val_print_1 (struct type *type, cons
       int retn;
       struct value *mark = value_mark ();
       struct value *val;
-      val = value_from_contents_and_address (type, valaddr, address);
+      val = value_from_contents_and_address (type, gdbarch, valaddr, address);
       val = ada_coerce_to_simple_array_ptr (val);
       if (val == NULL)
 	{
@@ -689,30 +699,31 @@ ada_val_print_1 (struct type *type, cons
 	  retn = 0;
 	}
       else
-	retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
-				value_address (val), stream, recurse, options);
+	retn = ada_val_print_1 (value_type (val), value_arch (val),
+				value_contents (val), 0, value_address (val),
+				stream, recurse, options);
       value_free_to_mark (mark);
       return retn;
     }
 
   valaddr = ada_aligned_value_addr (type, valaddr);
   embedded_offset -= valaddr - valaddr0 - embedded_offset;
-  type = printable_val_type (type, valaddr);
+  type = printable_val_type (type, gdbarch, valaddr);
 
   switch (TYPE_CODE (type))
     {
     default:
-      return c_val_print (type, valaddr0, embedded_offset, address, stream,
-			  recurse, options);
+      return c_val_print (type, gdbarch, valaddr0, embedded_offset, address,
+			  stream, recurse, options);
 
     case TYPE_CODE_PTR:
       {
-	int ret = c_val_print (type, valaddr0, embedded_offset, address, 
-			       stream, recurse, options);
+	int ret = c_val_print (type, gdbarch, valaddr0, embedded_offset,
+			       address, stream, recurse, options);
 	if (ada_is_tag_type (type))
 	  {
 	    struct value *val = 
-	      value_from_contents_and_address (type, valaddr, address);
+	      value_from_contents_and_address (type, gdbarch, valaddr, address);
 	    const char *name = ada_tag_name (val);
 	    if (name != NULL) 
 	      fprintf_filtered (stream, " (%s)", name);
@@ -735,13 +746,13 @@ ada_val_print_1 (struct type *type, cons
       else if (ada_is_vax_floating_type (type))
 	{
 	  struct value *val =
-	    value_from_contents_and_address (type, valaddr, address);
-	  struct value *func = ada_vax_float_print_function (type);
+	    value_from_contents_and_address (type, gdbarch, valaddr, address);
+	  struct value *func = ada_vax_float_print_function (type, gdbarch);
 	  if (func != 0)
 	    {
 	      CORE_ADDR addr;
 	      addr = value_as_address (call_function_by_hand (func, 1, &val));
-	      val_print_string (builtin_type_true_char,
+	      val_print_string (builtin_type_true_char, gdbarch,
 				addr, -1, stream, options);
 	      return 0;
 	    }
@@ -758,12 +769,12 @@ ada_val_print_1 (struct type *type, cons
 	         code regardless of lengths; I'm just avoiding a cast.  */
 	      struct value *v = value_cast (target_type,
 					    value_from_contents_and_address
-					    (type, valaddr, 0));
-	      return ada_val_print_1 (target_type, value_contents (v), 0, 0,
-				      stream, recurse + 1, options);
+					    (type, gdbarch, valaddr, 0));
+	      return ada_val_print_1 (target_type, gdbarch, value_contents (v),
+				      0, 0, stream, recurse + 1, options);
 	    }
 	  else
-	    return ada_val_print_1 (TYPE_TARGET_TYPE (type),
+	    return ada_val_print_1 (TYPE_TARGET_TYPE (type), gdbarch,
 				    valaddr0, embedded_offset,
 				    address, stream, recurse, options);
 	}
@@ -775,22 +786,17 @@ ada_val_print_1 (struct type *type, cons
 	    {
 	      struct value_print_options opts = *options;
 	      opts.format = format;
-	      print_scalar_formatted (valaddr, type, &opts, 0, stream);
+	      print_scalar_formatted (valaddr, type, gdbarch,
+				      &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.
-
-		 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.  */
+                 System.Address values as a special case.  */
 
-	      struct gdbarch *gdbarch = get_objfile_arch (TYPE_OBJFILE (type));
 	      struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
 
               fprintf_filtered (stream, "(");
@@ -802,7 +808,7 @@ ada_val_print_1 (struct type *type, cons
             }
 	  else
 	    {
-	      val_print_type_code_int (type, valaddr, stream);
+	      val_print_type_code_int (type, gdbarch, valaddr, stream);
 	      if (ada_is_character_type (type))
 		{
 		  fputs_filtered (" ", stream);
@@ -816,7 +822,8 @@ ada_val_print_1 (struct type *type, cons
     case TYPE_CODE_ENUM:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr, type, options, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch,
+				  options, 0, stream);
 	  break;
 	}
       len = TYPE_NFIELDS (type);
@@ -845,17 +852,17 @@ ada_val_print_1 (struct type *type, cons
 
     case TYPE_CODE_FLAGS:
       if (options->format)
-	print_scalar_formatted (valaddr, type, options, 0, stream);
+	print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
       else
-	val_print_type_code_flags (type, valaddr, stream);
+	val_print_type_code_flags (type, gdbarch, valaddr, stream);
       break;
 
     case TYPE_CODE_FLT:
       if (options->format)
-	return c_val_print (type, valaddr0, embedded_offset, address, stream,
-			    recurse, options);
+	return c_val_print (type, gdbarch, valaddr0, embedded_offset, address,
+			    stream, recurse, options);
       else
-	ada_print_floating (valaddr0 + embedded_offset, type, stream);
+	ada_print_floating (valaddr0 + embedded_offset, type, gdbarch, stream);
       break;
 
     case TYPE_CODE_UNION:
@@ -867,13 +874,13 @@ ada_val_print_1 (struct type *type, cons
 	}
       else
 	{
-	  print_record (type, valaddr, stream, recurse, options);
+	  print_record (type, gdbarch, valaddr, stream, recurse, options);
 	  return 0;
 	}
 
     case TYPE_CODE_ARRAY:
-      return ada_val_print_array (type, valaddr, address, stream,
-				  recurse, options);
+      return ada_val_print_array (type, gdbarch, valaddr, address,
+				  stream, recurse, options);
 
     case TYPE_CODE_REF:
       /* For references, the debugger is expected to print the value as
@@ -890,9 +897,9 @@ ada_val_print_1 (struct type *type, cons
             {
               struct value *deref_val =
                 ada_value_ind (value_from_longest
-                               (lookup_pointer_type (elttype),
+                               (lookup_pointer_type (elttype), gdbarch,
                                 deref_val_int));
-              val_print (value_type (deref_val),
+              val_print (value_type (deref_val), value_arch (deref_val),
                          value_contents (deref_val), 0,
                          value_address (deref_val), stream, recurse + 1,
 			 options, current_language);
@@ -910,19 +917,20 @@ ada_val_print_1 (struct type *type, cons
 }
 
 static int
-print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
-		    struct ui_file *stream, int recurse,
+print_variant_part (struct type *type, struct gdbarch *gdbarch, int field_num,
+		    const gdb_byte *valaddr,struct ui_file *stream, int recurse,
 		    const struct value_print_options *options, int comma_needed,
 		    struct type *outer_type, const gdb_byte *outer_valaddr)
 {
   struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
-  int which = ada_which_variant_applies (var_type, outer_type, outer_valaddr);
+  int which = ada_which_variant_applies (var_type, outer_type,
+					 gdbarch, outer_valaddr);
 
   if (which < 0)
     return 0;
   else
     return print_field_values
-      (TYPE_FIELD_TYPE (var_type, which),
+      (TYPE_FIELD_TYPE (var_type, which), gdbarch,
        valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT
        + TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT,
        stream, recurse, options,
@@ -936,9 +944,11 @@ ada_value_print (struct value *val0, str
   const gdb_byte *valaddr = value_contents (val0);
   CORE_ADDR address = value_address (val0);
   struct type *type =
-    ada_to_fixed_type (value_type (val0), valaddr, address, NULL, 1);
+    ada_to_fixed_type (value_type (val0), value_arch (val0),
+		       valaddr, address, NULL, 1);
   struct value *val =
-    value_from_contents_and_address (type, valaddr, address);
+    value_from_contents_and_address (type, value_arch (val0),
+				     valaddr, address);
   struct value_print_options opts;
 
   /* If it is a pointer, indicate what it points to.  */
@@ -971,12 +981,13 @@ ada_value_print (struct value *val0, str
 
   opts = *options;
   opts.deref_ref = 1;
-  return (val_print (type, value_contents (val), 0, address,
+  return (val_print (type, value_arch (val), value_contents (val), 0, address,
 		     stream, 0, &opts, current_language));
 }
 
 static void
-print_record (struct type *type, const gdb_byte *valaddr,
+print_record (struct type *type, struct gdbarch *gdbarch,
+	      const gdb_byte *valaddr,
 	      struct ui_file *stream, int recurse,
 	      const struct value_print_options *options)
 {
@@ -984,7 +995,7 @@ print_record (struct type *type, const g
 
   fprintf_filtered (stream, "(");
 
-  if (print_field_values (type, valaddr, stream, recurse, options,
+  if (print_field_values (type, gdbarch, valaddr, stream, recurse, options,
 			  0, type, valaddr) != 0 && options->pretty)
     {
       fprintf_filtered (stream, "\n");
@@ -1009,7 +1020,8 @@ print_record (struct type *type, const g
    Returns 1 if COMMA_NEEDED or any fields were printed.  */
 
 static int
-print_field_values (struct type *type, const gdb_byte *valaddr,
+print_field_values (struct type *type, struct gdbarch *gdbarch,
+		    const gdb_byte *valaddr,
 		    struct ui_file *stream, int recurse,
 		    const struct value_print_options *options,
 		    int comma_needed,
@@ -1027,7 +1039,7 @@ print_field_values (struct type *type, c
       if (ada_is_wrapper_field (type, i))
 	{
 	  comma_needed =
-	    print_field_values (TYPE_FIELD_TYPE (type, i),
+	    print_field_values (TYPE_FIELD_TYPE (type, i), gdbarch,
 				valaddr
 				+ TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
 				stream, recurse, options,
@@ -1037,7 +1049,7 @@ print_field_values (struct type *type, c
       else if (ada_is_variant_part (type, i))
 	{
 	  comma_needed =
-	    print_variant_part (type, i, valaddr,
+	    print_variant_part (type, gdbarch, i, valaddr,
 				stream, recurse, options, comma_needed,
 				outer_type, outer_valaddr);
 	  continue;
@@ -1102,18 +1114,20 @@ print_field_values (struct type *type, c
 						  bit_pos / HOST_CHAR_BIT,
 						  bit_pos % HOST_CHAR_BIT,
 						  bit_size,
-						  TYPE_FIELD_TYPE (type, i));
+						  TYPE_FIELD_TYPE (type, i),
+						  gdbarch);
 	      opts = *options;
 	      opts.deref_ref = 0;
-	      val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
-			 stream, recurse + 1, &opts, current_language);
+	      val_print (TYPE_FIELD_TYPE (type, i), value_arch (v),
+			 value_contents (v), 0, 0, stream, recurse + 1,
+			 &opts, current_language);
 	    }
 	}
       else
 	{
 	  struct value_print_options opts = *options;
 	  opts.deref_ref = 0;
-	  ada_val_print (TYPE_FIELD_TYPE (type, i),
+	  ada_val_print (TYPE_FIELD_TYPE (type, i), gdbarch,
 			 valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
 			 0, 0, stream, recurse + 1, &opts);
 	}
Index: gdb-head/gdb/c-lang.h
===================================================================
--- gdb-head.orig/gdb/c-lang.h
+++ gdb-head/gdb/c-lang.h
@@ -68,8 +68,8 @@ extern void c_print_type (struct type *,
 
 extern void c_print_typedef (struct type *, struct symbol *, struct ui_file *);
 
-extern int c_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			struct ui_file *, int,
+extern int c_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			int, CORE_ADDR, struct ui_file *, int,
 			const struct value_print_options *);
 
 extern int c_value_print (struct value *, struct ui_file *,
@@ -80,8 +80,8 @@ extern int c_value_print (struct value *
 extern void c_printchar (int, struct type *, struct ui_file *);
 
 extern void c_printstr (struct ui_file * stream, struct type *elttype,
-			const gdb_byte *string, unsigned int length,
-			int force_ellipses,
+			struct gdbarch *gdbarch, const gdb_byte *string,
+			unsigned int length, int force_ellipses,
 			const struct value_print_options *options);
 
 extern void c_language_arch_info (struct gdbarch *gdbarch,
@@ -94,11 +94,11 @@ extern void c_type_print_base (struct ty
 /* These are in cp-valprint.c */
 
 extern void cp_print_class_member (const gdb_byte *, struct type *,
-				   struct ui_file *, char *);
+				   struct gdbarch *, struct ui_file *, char *);
 
 extern void cp_print_value_fields (struct type *, struct type *,
-				   const gdb_byte *, int, CORE_ADDR,
-				   struct ui_file *, int,
+				   struct gdbarch *, const gdb_byte *,
+				   int, CORE_ADDR, struct ui_file *, int,
 				   const struct value_print_options *,
 				   struct type **, int);
 
Index: gdb-head/gdb/cp-valprint.c
===================================================================
--- gdb-head.orig/gdb/cp-valprint.c
+++ gdb-head/gdb/cp-valprint.c
@@ -78,8 +78,9 @@ static void cp_print_static_field (struc
 				   struct ui_file *, int,
 				   const struct value_print_options *);
 
-static void cp_print_value (struct type *, struct type *, const gdb_byte *,
-			    int, CORE_ADDR, struct ui_file *, int,
+static void cp_print_value (struct type *, struct type *, struct gdbarch *,
+			    const gdb_byte *, int, CORE_ADDR,
+			    struct ui_file *, int,
 			    const struct value_print_options *, struct type **);
 
 
@@ -148,7 +149,8 @@ cp_is_vtbl_member (struct type *type)
 
 void
 cp_print_value_fields (struct type *type, struct type *real_type,
-		       const gdb_byte *valaddr, int offset, CORE_ADDR address,
+		       struct gdbarch *gdbarch, const gdb_byte *valaddr,
+		       int offset, CORE_ADDR address,
 		       struct ui_file *stream, int recurse,
 		       const struct value_print_options *options,
 		       struct type **dont_print_vb, int dont_print_statmem)
@@ -167,7 +169,7 @@ cp_print_value_fields (struct type *type
      duplicates of virtual baseclasses.  */
 
   if (n_baseclasses > 0)
-    cp_print_value (type, real_type, valaddr, offset, address, stream,
+    cp_print_value (type, real_type, gdbarch, valaddr, offset, address, stream,
 		    recurse + 1, options, dont_print_vb);
 
   /* Second, print out data fields */
@@ -267,8 +269,9 @@ cp_print_value_fields (struct type *type
 		  struct value_print_options opts = *options;
 		  opts.deref_ref = 0;
 		  v = value_from_longest
-		    (TYPE_FIELD_TYPE (type, i), 
-		     unpack_field_as_long (type, valaddr + offset, i));
+		    (TYPE_FIELD_TYPE (type, i), gdbarch,
+		     unpack_field_as_long (type, gdbarch,
+					   valaddr + offset, i));
 
 		  common_val_print (v, stream, recurse + 1, &opts,
 				    current_language);
@@ -282,7 +285,7 @@ cp_print_value_fields (struct type *type
 		}
 	      else if (field_is_static (&TYPE_FIELD (type, i)))
 		{
-		  struct value *v = value_static_field (type, i);
+		  struct value *v = value_static_field (type, gdbarch, i);
 		  if (v == NULL)
 		    fputs_filtered ("<optimized out>", stream);
 		  else
@@ -293,7 +296,7 @@ cp_print_value_fields (struct type *type
 		{
 		  struct value_print_options opts = *options;
 		  opts.deref_ref = 0;
-		  val_print (TYPE_FIELD_TYPE (type, i),
+		  val_print (TYPE_FIELD_TYPE (type, i), gdbarch,
 			     valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
 			     stream, recurse + 1, &opts,
@@ -326,7 +329,8 @@ cp_print_value_fields (struct type *type
 
 static void
 cp_print_value (struct type *type, struct type *real_type,
-		const gdb_byte *valaddr, int offset, CORE_ADDR address,
+		struct gdbarch *gdbarch, const gdb_byte *valaddr,
+		int offset, CORE_ADDR address,
 		struct ui_file *stream, int recurse,
 		const struct value_print_options *options,
 		struct type **dont_print_vb)
@@ -425,7 +429,8 @@ cp_print_value (struct type *type, struc
 	  /* Attempt to run the Python pretty-printers on the
 	     baseclass if possible.  */
 	  if (!options->raw)
-	    result = apply_val_pretty_printer (baseclass, base_valaddr,
+	    result = apply_val_pretty_printer (baseclass, gdbarch,
+					       base_valaddr,
 					       thisoffset + boffset,
 					       address + boffset,
 					       stream, recurse,
@@ -433,7 +438,7 @@ cp_print_value (struct type *type, struc
 					       current_language);
 	  	  
 	  if (!result)
-	    cp_print_value_fields (baseclass, thistype, base_valaddr,
+	    cp_print_value_fields (baseclass, thistype, gdbarch, base_valaddr,
 				   thisoffset + boffset, address + boffset,
 				   stream, recurse, options,
 				   ((struct type **)
@@ -501,7 +506,8 @@ cp_print_static_field (struct type *type
 		    sizeof (CORE_ADDR));
 
       CHECK_TYPEDEF (type);
-      cp_print_value_fields (type, type, value_contents_all (val),
+      cp_print_value_fields (type, type,
+			     value_arch (val), value_contents_all (val),
 			     value_embedded_offset (val), addr,
 			     stream, recurse, options, NULL, 1);
       return;
@@ -509,7 +515,7 @@ cp_print_static_field (struct type *type
 
   opts = *options;
   opts.deref_ref = 0;
-  val_print (type, value_contents_all (val), 
+  val_print (type, value_arch (val), value_contents_all (val),
 	     value_embedded_offset (val), value_address (val),
 	     stream, recurse, &opts, current_language);
 }
@@ -562,7 +568,8 @@ cp_find_class_member (struct type **doma
 
 void
 cp_print_class_member (const gdb_byte *valaddr, struct type *type,
-		       struct ui_file *stream, char *prefix)
+		       struct gdbarch *gdbarch, struct ui_file *stream,
+		       char *prefix)
 {
   /* VAL is a byte offset into the structure type DOMAIN.
      Find the name of the field for that offset and
Index: gdb-head/gdb/c-valprint.c
===================================================================
--- gdb-head.orig/gdb/c-valprint.c
+++ gdb-head/gdb/c-valprint.c
@@ -36,10 +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,
+  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch,
 							    address,
 							    &current_target);
 
@@ -130,7 +130,8 @@ textual_element_type (struct type *type,
    printed.  */
 
 int
-c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+c_val_print (struct type *type, struct gdbarch *gdbarch,
+	     const gdb_byte *valaddr, int embedded_offset,
 	     CORE_ADDR address, struct ui_file *stream, int recurse,
 	     const struct value_print_options *options)
 {
@@ -177,7 +178,7 @@ c_val_print (struct type *type, const gd
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, unresolved_elttype,
+	      LA_PRINT_STRING (stream, unresolved_elttype, gdbarch,
 			       valaddr + embedded_offset, len, 0, options);
 	      i = len;
 	    }
@@ -195,8 +196,9 @@ c_val_print (struct type *type, const gd
 		{
 		  i = 0;
 		}
-	      val_print_array_elements (type, valaddr + embedded_offset, address, stream,
-					recurse, options, i);
+	      val_print_array_elements (type, gdbarch,
+					valaddr + embedded_offset, address,
+					stream, recurse, options, i);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
@@ -208,11 +210,12 @@ c_val_print (struct type *type, const gd
     case TYPE_CODE_MEMBERPTR:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
-      cp_print_class_member (valaddr + embedded_offset, type, stream, "&");
+      cp_print_class_member (valaddr + embedded_offset, type, gdbarch,
+			     stream, "&");
       break;
 
     case TYPE_CODE_METHODPTR:
@@ -222,7 +225,7 @@ c_val_print (struct type *type, const gd
     case TYPE_CODE_PTR:
       if (options->format && options->format != 's')
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -233,7 +236,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);
@@ -245,7 +249,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);
@@ -260,8 +264,8 @@ c_val_print (struct type *type, const gd
 	  if (textual_element_type (unresolved_elttype, options->format)
 	      && addr != 0)
 	    {
-	      i = val_print_string (unresolved_elttype, addr, -1, stream,
-				    options);
+	      i = val_print_string (unresolved_elttype, gdbarch, addr, -1,
+				    stream, options);
 	    }
 	  else if (cp_is_vtbl_member (type))
 	    {
@@ -297,7 +301,7 @@ c_val_print (struct type *type, const gd
 		    {
 		      wtype = unresolved_elttype;
 		    }
-		  vt_val = value_at (wtype, vt_address);
+		  vt_val = value_at (wtype, gdbarch, vt_address);
 		  common_val_print (vt_val, stream, recurse + 1, options,
 				    current_language);
 		  if (options->pretty)
@@ -333,7 +337,7 @@ c_val_print (struct type *type, const gd
 	    {
 	      struct value *deref_val =
 	      value_at
-	      (TYPE_TARGET_TYPE (type),
+	      (TYPE_TARGET_TYPE (type), gdbarch,
 	       unpack_pointer (type, valaddr + embedded_offset));
 	      common_val_print (deref_val, stream, recurse, options,
 				current_language);
@@ -363,17 +367,18 @@ 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,
-			       recurse, options, NULL, 0);
+	cp_print_value_fields (type, type, gdbarch, valaddr, embedded_offset,
+			       address, stream, recurse, options, NULL, 0);
       break;
 
     case TYPE_CODE_ENUM:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -399,17 +404,18 @@ c_val_print (struct type *type, const gd
 
     case TYPE_CODE_FLAGS:
       if (options->format)
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
       else
-	val_print_type_code_flags (type, valaddr + embedded_offset, stream);
+	val_print_type_code_flags (type, gdbarch, valaddr + embedded_offset,
+				   stream);
       break;
 
     case TYPE_CODE_FUNC:
     case TYPE_CODE_METHOD:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -428,7 +434,7 @@ c_val_print (struct type *type, const gd
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -459,12 +465,13 @@ c_val_print (struct type *type, const gd
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
 	{
-	  val_print_type_code_int (type, valaddr + embedded_offset, stream);
+	  val_print_type_code_int (type, gdbarch, valaddr + embedded_offset,
+				   stream);
 	  /* C and C++ has no single byte int type, char is used instead.
 	     Since we don't know whether the value is really intended to
 	     be used as an integer or a character, print the character
@@ -484,7 +491,7 @@ c_val_print (struct type *type, const gd
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -502,21 +509,22 @@ c_val_print (struct type *type, const gd
     case TYPE_CODE_FLT:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	}
       else
 	{
-	  print_floating (valaddr + embedded_offset, type, stream);
+	  print_floating (valaddr + embedded_offset, type, gdbarch, stream);
 	}
       break;
 
     case TYPE_CODE_DECFLOAT:
       if (options->format)
-	print_scalar_formatted (valaddr + embedded_offset, type,
+	print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				options, 0, stream);
       else
-	print_decimal_floating (valaddr + embedded_offset, type, stream);
+	print_decimal_floating (valaddr + embedded_offset, type, gdbarch,
+				stream);
       break;
 
     case TYPE_CODE_VOID:
@@ -537,21 +545,21 @@ c_val_print (struct type *type, const gd
     case TYPE_CODE_COMPLEX:
       if (options->format)
 	print_scalar_formatted (valaddr + embedded_offset,
-				TYPE_TARGET_TYPE (type),
+				TYPE_TARGET_TYPE (type), gdbarch,
 				options, 0, stream);
       else
 	print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
-			stream);
+			gdbarch, stream);
       fprintf_filtered (stream, " + ");
       if (options->format)
 	print_scalar_formatted (valaddr + embedded_offset
 				+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
-				TYPE_TARGET_TYPE (type),
+				TYPE_TARGET_TYPE (type), gdbarch,
 				options, 0, stream);
       else
 	print_floating (valaddr + embedded_offset
 			+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
-			TYPE_TARGET_TYPE (type),
+			TYPE_TARGET_TYPE (type), gdbarch,
 			stream);
       fprintf_filtered (stream, " * I");
       break;
@@ -666,7 +674,7 @@ c_value_print (struct value *val, struct
 			    TYPE_NAME (real_type),
 			    full ? "" : _(" [incomplete object]"));
 	  /* Print out object: enclosing type is same as real_type if full */
-	  return val_print (value_enclosing_type (val),
+	  return val_print (value_enclosing_type (val), value_arch (val),
 			    value_contents_all (val), 0,
 			    value_address (val), stream, 0,
 			    &opts, current_language);
@@ -678,7 +686,7 @@ c_value_print (struct value *val, struct
 	  /* No RTTI information, so let's do our best */
 	  fprintf_filtered (stream, "(%s ?) ",
 			    TYPE_NAME (value_enclosing_type (val)));
-	  return val_print (value_enclosing_type (val),
+	  return val_print (value_enclosing_type (val), value_arch (val),
 			    value_contents_all (val), 0,
 			    value_address (val), stream, 0,
 			    &opts, current_language);
@@ -686,7 +694,7 @@ c_value_print (struct value *val, struct
       /* Otherwise, we end up at the return outside this "if" */
     }
 
-  return val_print (val_type, value_contents_all (val),
+  return val_print (val_type, value_arch (val), value_contents_all (val),
 		    value_embedded_offset (val),
 		    value_address (val),
 		    stream, 0, &opts, current_language);
Index: gdb-head/gdb/f-lang.h
===================================================================
--- gdb-head.orig/gdb/f-lang.h
+++ gdb-head/gdb/f-lang.h
@@ -28,8 +28,8 @@ extern void f_error (char *);	/* Defined
 extern void f_print_type (struct type *, char *, struct ui_file *, int,
 			  int);
 
-extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			struct ui_file *, int,
+extern int f_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			int, CORE_ADDR, struct ui_file *, int,
 			const struct value_print_options *);
 
 /* Language-specific data structures */
Index: gdb-head/gdb/f-valprint.c
===================================================================
--- gdb-head.orig/gdb/f-valprint.c
+++ gdb-head/gdb/f-valprint.c
@@ -163,8 +163,8 @@ f77_create_arrayprint_offset_tbl (struct
 
 static void
 f77_print_array_1 (int nss, int ndimensions, struct type *type,
-		   const gdb_byte *valaddr, CORE_ADDR address,
-		   struct ui_file *stream, int recurse,
+		   struct gdbarch *gdbarch, const gdb_byte *valaddr,
+		   CORE_ADDR address, struct ui_file *stream, int recurse,
 		   const struct value_print_options *options,
 		   int *elts)
 {
@@ -175,7 +175,8 @@ f77_print_array_1 (int nss, int ndimensi
       for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); i++)
 	{
 	  fprintf_filtered (stream, "( ");
-	  f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
+	  f77_print_array_1 (nss + 1, ndimensions,
+			     TYPE_TARGET_TYPE (type), gdbarch,
 			     valaddr + i * F77_DIM_OFFSET (nss),
 			     address + i * F77_DIM_OFFSET (nss),
 			     stream, recurse, options, elts);
@@ -189,7 +190,7 @@ f77_print_array_1 (int nss, int ndimensi
       for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max;
 	   i++, (*elts)++)
 	{
-	  val_print (TYPE_TARGET_TYPE (type),
+	  val_print (TYPE_TARGET_TYPE (type), gdbarch,
 		     valaddr + i * F77_DIM_OFFSET (ndimensions),
 		     0,
 		     address + i * F77_DIM_OFFSET (ndimensions),
@@ -209,9 +210,10 @@ f77_print_array_1 (int nss, int ndimensi
    stuff and then immediately call f77_print_array_1() */
 
 static void
-f77_print_array (struct type *type, const gdb_byte *valaddr,
-		 CORE_ADDR address, struct ui_file *stream,
-		 int recurse, const struct value_print_options *options)
+f77_print_array (struct type *type, struct gdbarch *gdbarch,
+		 const gdb_byte *valaddr, CORE_ADDR address,
+		 struct ui_file *stream, int recurse,
+		 const struct value_print_options *options)
 {
   int ndimensions;
   int elts = 0;
@@ -228,7 +230,7 @@ f77_print_array (struct type *type, cons
 
   f77_create_arrayprint_offset_tbl (type, stream);
 
-  f77_print_array_1 (1, ndimensions, type, valaddr, address, stream,
+  f77_print_array_1 (1, ndimensions, type, gdbarch, valaddr, address, stream,
 		     recurse, options, &elts);
 }
 
@@ -241,7 +243,8 @@ f77_print_array (struct type *type, cons
    printed.  */
 
 int
-f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+f_val_print (struct type *type, struct gdbarch *gdbarch,
+	     const gdb_byte *valaddr, int embedded_offset,
 	     CORE_ADDR address, struct ui_file *stream, int recurse,
 	     const struct value_print_options *options)
 {
@@ -256,20 +259,21 @@ 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,
-		       valaddr, TYPE_LENGTH (type), 0, options);
+      LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
+		       gdbarch, valaddr, TYPE_LENGTH (type), 0, options);
       break;
 
     case TYPE_CODE_ARRAY:
       fprintf_filtered (stream, "(");
-      f77_print_array (type, valaddr, address, stream, recurse, options);
+      f77_print_array (type, gdbarch, valaddr, address,
+		       stream, recurse, options);
       fprintf_filtered (stream, ")");
       break;
 
     case TYPE_CODE_PTR:
       if (options->format && options->format != 's')
 	{
-	  print_scalar_formatted (valaddr, type, options, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
 	  break;
 	}
       else
@@ -294,8 +298,8 @@ f_val_print (struct type *type, const gd
 	      && TYPE_CODE (elttype) == TYPE_CODE_INT
 	      && (options->format == 0 || options->format == 's')
 	      && addr != 0)
-	    i = val_print_string (TYPE_TARGET_TYPE (type), addr, -1, stream,
-				  options);
+	    i = val_print_string (TYPE_TARGET_TYPE (type), gdbarch, addr, -1,
+				  stream, options);
 
 	  /* Return number of characters printed, including the terminating
 	     '\0' if we reached the end.  val_print_string takes care including
@@ -322,7 +326,7 @@ f_val_print (struct type *type, const gd
 	    {
 	      struct value *deref_val =
 	      value_at
-	      (TYPE_TARGET_TYPE (type),
+	      (TYPE_TARGET_TYPE (type), gdbarch,
 	       unpack_pointer (type, valaddr + embedded_offset));
 	      common_val_print (deref_val, stream, recurse,
 				options, current_language);
@@ -335,7 +339,7 @@ f_val_print (struct type *type, const gd
     case TYPE_CODE_FUNC:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr, type, options, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
 	  break;
 	}
       /* FIXME, we should consider, at least for ANSI C language, eliminating
@@ -353,11 +357,11 @@ f_val_print (struct type *type, const gd
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr, type, &opts, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, &opts, 0, stream);
 	}
       else
 	{
-	  val_print_type_code_int (type, valaddr, stream);
+	  val_print_type_code_int (type, gdbarch, valaddr, stream);
 	  /* C and C++ has no single byte int type, char is used instead.
 	     Since we don't know whether the value is really intended to
 	     be used as an integer or a character, print the character
@@ -373,16 +377,16 @@ f_val_print (struct type *type, const gd
 
     case TYPE_CODE_FLAGS:
       if (options->format)
-	  print_scalar_formatted (valaddr, type, options, 0, stream);
+	print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
       else
-	val_print_type_code_flags (type, valaddr, stream);
+	val_print_type_code_flags (type, gdbarch, valaddr, stream);
       break;
 
     case TYPE_CODE_FLT:
       if (options->format)
-	print_scalar_formatted (valaddr, type, options, 0, stream);
+	print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
       else
-	print_floating (valaddr, type, stream);
+	print_floating (valaddr, type, gdbarch, stream);
       break;
 
     case TYPE_CODE_VOID:
@@ -404,7 +408,7 @@ f_val_print (struct type *type, const gd
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr, type, &opts, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, &opts, 0, stream);
 	}
       else
 	{
@@ -419,7 +423,8 @@ f_val_print (struct type *type, const gd
 	    {
 	      /* Bash the type code temporarily.  */
 	      TYPE_CODE (type) = TYPE_CODE_INT;
-	      f_val_print (type, valaddr, 0, address, stream, recurse, options);
+	      f_val_print (type, gdbarch, valaddr, 0, address,
+			   stream, recurse, options);
 	      /* Restore the type code so later uses work as intended. */
 	      TYPE_CODE (type) = TYPE_CODE_BOOL;
 	    }
@@ -429,9 +434,9 @@ f_val_print (struct type *type, const gd
     case TYPE_CODE_COMPLEX:
       type = TYPE_TARGET_TYPE (type);
       fputs_filtered ("(", stream);
-      print_floating (valaddr, type, stream);
+      print_floating (valaddr, type, gdbarch, stream);
       fputs_filtered (",", stream);
-      print_floating (valaddr + TYPE_LENGTH (type), type, stream);
+      print_floating (valaddr + TYPE_LENGTH (type), type, gdbarch, stream);
       fputs_filtered (")", stream);
       break;
 
@@ -450,8 +455,9 @@ f_val_print (struct type *type, const gd
       for (index = 0; index < TYPE_NFIELDS (type); index++)
         {
           int offset = TYPE_FIELD_BITPOS (type, index) / 8;
-          f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset,
-                       embedded_offset, address, stream, recurse, options);
+          f_val_print (TYPE_FIELD_TYPE (type, index), gdbarch,
+		       valaddr + offset, embedded_offset, address,
+		       stream, recurse, options);
           if (index != TYPE_NFIELDS (type) - 1)
             fputs_filtered (", ", stream);
         }
Index: gdb-head/gdb/gdbtypes.h
===================================================================
--- gdb-head.orig/gdb/gdbtypes.h
+++ gdb-head/gdb/gdbtypes.h
@@ -1274,6 +1274,7 @@ extern int field_is_static (struct field
 /* printcmd.c */
 
 extern void print_scalar_formatted (const void *, struct type *,
+				    struct gdbarch *,
 				    const struct value_print_options *,
 				    int, struct ui_file *);
 
Index: gdb-head/gdb/infcmd.c
===================================================================
--- gdb-head.orig/gdb/infcmd.c
+++ gdb-head/gdb/infcmd.c
@@ -1300,7 +1300,7 @@ print_return_value (struct type *func_ty
     case RETURN_VALUE_REGISTER_CONVENTION:
     case RETURN_VALUE_ABI_RETURNS_ADDRESS:
     case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
-      value = allocate_value (value_type);
+      value = allocate_value (value_type, gdbarch);
       gdbarch_return_value (gdbarch, func_type, value_type, stop_registers,
 			    value_contents_raw (value), NULL);
       break;
@@ -1838,7 +1838,7 @@ default_print_registers_info (struct gdb
 
 	  get_user_print_options (&opts);
 	  opts.deref_ref = 1;
-	  val_print (register_type (gdbarch, i), buffer, 0, 0,
+	  val_print (register_type (gdbarch, i), gdbarch, buffer, 0, 0,
 		     file, 0, &opts, current_language);
 
 	  fprintf_filtered (file, "\t(raw 0x");
@@ -1860,7 +1860,7 @@ default_print_registers_info (struct gdb
 	  /* Print the register in hex.  */
 	  get_formatted_print_options (&opts, 'x');
 	  opts.deref_ref = 1;
-	  val_print (register_type (gdbarch, i), buffer, 0, 0,
+	  val_print (register_type (gdbarch, i), gdbarch, buffer, 0, 0,
 		     file, 0, &opts,
 		     current_language);
           /* If not a vector register, print it also according to its
@@ -1870,7 +1870,7 @@ default_print_registers_info (struct gdb
 	      get_user_print_options (&opts);
 	      opts.deref_ref = 1;
 	      fprintf_filtered (file, "\t");
-	      val_print (register_type (gdbarch, i), buffer, 0, 0,
+	      val_print (register_type (gdbarch, i), gdbarch, buffer, 0, 0,
 			 file, 0, &opts, current_language);
 	    }
 	}
@@ -1944,7 +1944,7 @@ registers_info (char *addr_exp, int fpre
 		get_formatted_print_options (&opts, 'x');
 		print_scalar_formatted (value_contents (val),
 					check_typedef (value_type (val)),
-					&opts, 0, gdb_stdout);
+					gdbarch, &opts, 0, gdb_stdout);
 		printf_filtered ("\n");
 	      }
 	    else
Index: gdb-head/gdb/jv-lang.h
===================================================================
--- gdb-head.orig/gdb/jv-lang.h
+++ gdb-head/gdb/jv-lang.h
@@ -40,8 +40,8 @@ extern struct type *java_float_type;
 extern struct type *java_double_type;
 extern struct type *java_void_type;
 
-extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			   struct ui_file *, int,
+extern int java_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			   int, CORE_ADDR, struct ui_file *, int,
 			   const struct value_print_options *);
 
 extern int java_value_print (struct value *, struct ui_file *,
Index: gdb-head/gdb/jv-valprint.c
===================================================================
--- gdb-head.orig/gdb/jv-valprint.c
+++ gdb-head/gdb/jv-valprint.c
@@ -38,6 +38,7 @@ int
 java_value_print (struct value *val, struct ui_file *stream, 
 		  const struct value_print_options *options)
 {
+  struct gdbarch *gdbarch = value_arch (val);
   struct type *type;
   CORE_ADDR address;
   int i;
@@ -60,7 +61,7 @@ java_value_print (struct value *val, str
 	  type = type_from_class (java_class_from_object (val));
 	  type = lookup_pointer_type (type);
 
-	  val = value_at (type, address);
+	  val = value_at (type, gdbarch, address);
 	}
     }
 
@@ -94,7 +95,7 @@ java_value_print (struct value *val, str
 	    {
 	      gdb_byte *buf;
 
-	      buf = alloca (gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT);
+	      buf = alloca (gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT);
 	      fputs_filtered (", ", stream);
 	      wrap_here (n_spaces (2));
 
@@ -103,7 +104,7 @@ java_value_print (struct value *val, str
 	      else
 		{
 		  read_memory (address, buf, sizeof (buf));
-		  address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
+		  address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
 		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
                      pulls a host sized pointer out of the target and
                      then extracts that as an address (while assuming
@@ -114,7 +115,7 @@ java_value_print (struct value *val, str
 	      for (reps = 1; i + reps < length; reps++)
 		{
 		  read_memory (address, buf, sizeof (buf));
-		  address += gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT;
+		  address += gdbarch_ptr_bit (gdbarch) / HOST_CHAR_BIT;
 		  /* FIXME: cagney/2003-05-24: Bogus or what.  It
                      pulls a host sized pointer out of the target and
                      then extracts that as an address (while assuming
@@ -140,8 +141,8 @@ java_value_print (struct value *val, str
 	}
       else
 	{
-	  struct value *v = allocate_value (el_type);
-	  struct value *next_v = allocate_value (el_type);
+	  struct value *v = allocate_value (el_type, gdbarch);
+	  struct value *next_v = allocate_value (el_type, gdbarch);
 
 	  set_value_address (v, address + JAVA_OBJECT_SIZE + 4);
 	  set_value_address (next_v, value_raw_address (v));
@@ -230,8 +231,8 @@ java_value_print (struct value *val, str
 
       value_free_to_mark (mark);	/* Release unnecessary values */
 
-      val_print_string (java_char_type, data + boffset, count, stream, options);
-
+      val_print_string (java_char_type, gdbarch, data + boffset, count,
+			stream, options);
       return 0;
     }
 
@@ -247,9 +248,9 @@ java_value_print (struct value *val, str
    should not print, or zero if called from top level.  */
 
 static void
-java_print_value_fields (struct type *type, const gdb_byte *valaddr,
-			 CORE_ADDR address, struct ui_file *stream,
-			 int recurse,
+java_print_value_fields (struct type *type, struct gdbarch *gdbarch,
+			 const gdb_byte *valaddr, CORE_ADDR address,
+			 struct ui_file *stream, int recurse,
 			 const struct value_print_options *options)
 {
   int i, len, n_baseclasses;
@@ -292,8 +293,9 @@ java_print_value_fields (struct type *ty
 
 	  base_valaddr = valaddr;
 
-	  java_print_value_fields (baseclass, base_valaddr, address + boffset,
-				   stream, recurse + 1, options);
+	  java_print_value_fields (baseclass, gdbarch, base_valaddr,
+				   address + boffset, stream, recurse + 1,
+				   options);
 	  fputs_filtered (", ", stream);
 	}
 
@@ -386,8 +388,9 @@ java_print_value_fields (struct type *ty
 		{
 		  struct value_print_options opts;
 
-		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
-				   unpack_field_as_long (type, valaddr, i));
+		  v = value_from_longest (TYPE_FIELD_TYPE (type, i), gdbarch,
+					  unpack_field_as_long (type, gdbarch,
+								valaddr, i));
 
 		  opts = *options;
 		  opts.deref_ref = 0;
@@ -403,7 +406,7 @@ java_print_value_fields (struct type *ty
 		}
 	      else if (field_is_static (&TYPE_FIELD (type, i)))
 		{
-		  struct value *v = value_static_field (type, i);
+		  struct value *v = value_static_field (type, gdbarch, i);
 		  if (v == NULL)
 		    fputs_filtered ("<optimized out>", stream);
 		  else
@@ -424,7 +427,7 @@ java_print_value_fields (struct type *ty
 		{
 		  struct value_print_options opts = *options;
 		  opts.deref_ref = 0;
-		  val_print (TYPE_FIELD_TYPE (type, i),
+		  val_print (TYPE_FIELD_TYPE (type, i), gdbarch,
 			     valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
 			     stream, recurse + 1, &opts,
@@ -451,9 +454,9 @@ java_print_value_fields (struct type *ty
    printed.  */
 
 int
-java_val_print (struct type *type, const gdb_byte *valaddr,
-		int embedded_offset, CORE_ADDR address,
-		struct ui_file *stream, int recurse,
+java_val_print (struct type *type, struct gdbarch *gdbarch,
+		const gdb_byte *valaddr, int embedded_offset,
+		CORE_ADDR address, struct ui_file *stream, int recurse,
 		const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
@@ -466,7 +469,7 @@ java_val_print (struct type *type, const
     case TYPE_CODE_PTR:
       if (options->format && options->format != 's')
 	{
-	  print_scalar_formatted (valaddr, type, options, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, options, 0, stream);
 	  break;
 	}
 #if 0
@@ -514,7 +517,7 @@ java_val_print (struct type *type, const
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr, type, &opts, 0, stream);
+	  print_scalar_formatted (valaddr, type, gdbarch, &opts, 0, stream);
 	}
       else if (TYPE_CODE (type) == TYPE_CODE_CHAR
 	       || (TYPE_CODE (type) == TYPE_CODE_INT
@@ -522,17 +525,17 @@ java_val_print (struct type *type, const
 		   && strcmp (TYPE_NAME (type), "char") == 0))
 	LA_PRINT_CHAR ((int) unpack_long (type, valaddr), type, stream);
       else
-	val_print_type_code_int (type, valaddr, stream);
+	val_print_type_code_int (type, gdbarch, valaddr, stream);
       break;
 
     case TYPE_CODE_STRUCT:
-      java_print_value_fields (type, valaddr, address, stream, recurse,
-			       options);
+      java_print_value_fields (type, gdbarch, valaddr, address,
+			       stream, recurse, options);
       break;
 
     default:
-      return c_val_print (type, valaddr, embedded_offset, address, stream,
-			  recurse, options);
+      return c_val_print (type, gdbarch, valaddr, embedded_offset, address,
+			  stream, recurse, options);
     }
 
   return 0;
Index: gdb-head/gdb/language.c
===================================================================
--- gdb-head.orig/gdb/language.c
+++ gdb-head/gdb/language.c
@@ -1081,8 +1081,8 @@ unk_lang_printchar (int c, struct type *
 
 static void
 unk_lang_printstr (struct ui_file *stream, struct type *type,
-		   const gdb_byte *string, unsigned int length,
-		   int force_ellipses,
+		   struct gdbarch *gdbarch, const gdb_byte *string,
+		   unsigned int length, int force_ellipses,
 		   const struct value_print_options *options)
 {
   error (_("internal error - unimplemented function unk_lang_printstr called."));
@@ -1096,9 +1096,9 @@ unk_lang_print_type (struct type *type, 
 }
 
 static int
-unk_lang_val_print (struct type *type, const gdb_byte *valaddr,
-		    int embedded_offset, CORE_ADDR address,
-		    struct ui_file *stream, int recurse,
+unk_lang_val_print (struct type *type, struct gdbarch *gdbarch,
+		    const gdb_byte *valaddr, int embedded_offset,
+		    CORE_ADDR address, struct ui_file *stream, int recurse,
 		    const struct value_print_options *options)
 {
   error (_("internal error - unimplemented function unk_lang_val_print called."));
Index: gdb-head/gdb/language.h
===================================================================
--- gdb-head.orig/gdb/language.h
+++ gdb-head/gdb/language.h
@@ -189,8 +189,8 @@ struct language_defn
     void (*la_printchar) (int ch, struct type *chtype, struct ui_file * stream);
 
     void (*la_printstr) (struct ui_file * stream, struct type *elttype,
-			 const gdb_byte *string, unsigned int length,
-			 int force_ellipses,
+			 struct gdbarch *gdbarch, const gdb_byte *string,
+			 unsigned int length, int force_ellipses,
 			 const struct value_print_options *);
 
     void (*la_emitchar) (int ch, struct type *chtype,
@@ -210,8 +210,8 @@ struct language_defn
 
     /* Print a value using syntax appropriate for this language. */
 
-    int (*la_val_print) (struct type *, const gdb_byte *, int, CORE_ADDR,
-			 struct ui_file *, int,
+    int (*la_val_print) (struct type *, struct gdbarch *, const gdb_byte *,
+			 int, CORE_ADDR, struct ui_file *, int,
 			 const struct value_print_options *);
 
     /* Print a top-level value using syntax appropriate for this language. */
@@ -376,17 +376,17 @@ extern enum language set_language (enum 
 #define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
   (current_language->la_print_typedef(type,new_symbol,stream))
 
-#define LA_VAL_PRINT(type,valaddr,offset,addr,stream,recurse,options) \
-  (current_language->la_val_print(type,valaddr,offset,addr,stream, \
+#define LA_VAL_PRINT(type,gdbarch,valaddr,offset,addr,stream,recurse,options) \
+  (current_language->la_val_print(type,gdbarch,valaddr,offset,addr,stream, \
 				  recurse,options))
 #define LA_VALUE_PRINT(val,stream,options) \
   (current_language->la_value_print(val,stream,options))
 
 #define LA_PRINT_CHAR(ch, type, stream) \
   (current_language->la_printchar(ch, type, stream))
-#define LA_PRINT_STRING(stream, elttype, string, length, force_ellipses,options) \
-  (current_language->la_printstr(stream, elttype, string, length, \
-				 force_ellipses,options))
+#define LA_PRINT_STRING(stream,elttype,gdbarch,string,length,force_ellipses,options) \
+  (current_language->la_printstr(stream, elttype, gdbarch, string, length, \
+				 force_ellipses, options))
 #define LA_EMIT_CHAR(ch, type, stream, quoter) \
   (current_language->la_emitchar(ch, type, stream, quoter))
 #define LA_GET_STRING(value, buffer, length, encoding) \
Index: gdb-head/gdb/m2-lang.h
===================================================================
--- gdb-head.orig/gdb/m2-lang.h
+++ gdb-head/gdb/m2-lang.h
@@ -32,8 +32,8 @@ extern void m2_print_typedef (struct typ
 extern int m2_is_long_set (struct type *type);
 extern int m2_is_unbounded_array (struct type *type);
 
-extern int m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			 struct ui_file *, int,
+extern int m2_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			 int, CORE_ADDR, struct ui_file *, int,
 			 const struct value_print_options *);
 
 extern int get_long_set_bounds (struct type *type, LONGEST *low,
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -30,12 +30,13 @@
 #include "m2-lang.h"
 #include "target.h"
 
-static int print_unpacked_pointer (struct type *type,
+static int print_unpacked_pointer (struct type *type, struct gdbarch *gdbarch,
 				   CORE_ADDR address, CORE_ADDR addr,
 				   const struct value_print_options *options,
 				   struct ui_file *stream);
 static void
-m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
+m2_print_array_contents (struct type *type, struct gdbarch *gdbarch,
+			 const gdb_byte *valaddr,
 			 int embedded_offset, CORE_ADDR address,
 			 struct ui_file *stream, int recurse,
 			 const struct value_print_options *options,
@@ -46,10 +47,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,
+  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (gdbarch,
 							    address,
 							    &current_target);
 
@@ -88,9 +89,9 @@ get_long_set_bounds (struct type *type, 
 }
 
 static void
-m2_print_long_set (struct type *type, const gdb_byte *valaddr,
-		   int embedded_offset, CORE_ADDR address,
-		   struct ui_file *stream)
+m2_print_long_set (struct type *type, struct gdbarch *gdbarch,
+		   const gdb_byte *valaddr, int embedded_offset,
+		   CORE_ADDR address, struct ui_file *stream)
 {
   int empty_set        = 1;
   int element_seen     = 0;
@@ -126,7 +127,7 @@ m2_print_long_set (struct type *type, co
     {
       for (i = low_bound; i <= high_bound; i++)
 	{
-	  bitval = value_bit_index (TYPE_FIELD_TYPE (type, field),
+	  bitval = value_bit_index (TYPE_FIELD_TYPE (type, field), gdbarch,
 				    (TYPE_FIELD_BITPOS (type, field) / 8) +
 				    valaddr + embedded_offset, i);
 	  if (bitval < 0)
@@ -183,7 +184,8 @@ m2_print_long_set (struct type *type, co
 }
 
 static void
-m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
+m2_print_unbounded_array (struct type *type, struct gdbarch *gdbarch,
+			  const gdb_byte *valaddr,
 			  int embedded_offset, CORE_ADDR address,
 			  struct ui_file *stream, int recurse,
 			  const struct value_print_options *options)
@@ -201,18 +203,18 @@ m2_print_unbounded_array (struct type *t
 			 valaddr + embedded_offset);
 
   val = value_at_lazy (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
-		       addr);
-  len = unpack_field_as_long (type, valaddr + embedded_offset, 1);
+		       gdbarch, addr);
+  len = unpack_field_as_long (type, gdbarch, valaddr + embedded_offset, 1);
 
   fprintf_filtered (stream, "{");  
-  m2_print_array_contents (value_type (val), value_contents(val),
-			   value_embedded_offset (val), addr, stream,
-			   recurse, options, len);
+  m2_print_array_contents (value_type (val), value_arch (val),
+			   value_contents(val), value_embedded_offset (val),
+			   addr, stream, recurse, options, len);
   fprintf_filtered (stream, ", HIGH = %d}", (int) len);
 }
 
 static int
-print_unpacked_pointer (struct type *type,
+print_unpacked_pointer (struct type *type, struct gdbarch *gdbarch,
 			CORE_ADDR address, CORE_ADDR addr,
 			const struct value_print_options *options,
 			struct ui_file *stream)
@@ -222,7 +224,8 @@ print_unpacked_pointer (struct type *typ
   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;
     }
@@ -237,7 +240,7 @@ print_unpacked_pointer (struct type *typ
       && TYPE_CODE (elttype) == TYPE_CODE_INT
       && (options->format == 0 || options->format == 's')
       && addr != 0)
-    return val_print_string (TYPE_TARGET_TYPE (type), addr, -1,
+    return val_print_string (TYPE_TARGET_TYPE (type), gdbarch, addr, -1,
 			     stream, options);
   
   return 0;
@@ -245,6 +248,7 @@ print_unpacked_pointer (struct type *typ
 
 static void
 print_variable_at_address (struct type *type,
+			   struct gdbarch *gdbarch,
 			   const gdb_byte *valaddr,
 			   struct ui_file *stream,
 			   int recurse,
@@ -259,8 +263,8 @@ print_variable_at_address (struct type *
   
   if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
     {
-      struct value *deref_val =
-	value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
+      struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), gdbarch,
+					  unpack_pointer (type, valaddr));
       common_val_print (deref_val, stream, recurse, options, current_language);
     }
   else
@@ -275,7 +279,8 @@ print_variable_at_address (struct type *
                              separated values.  */
 
 static void
-m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
+m2_print_array_contents (struct type *type, struct gdbarch *gdbarch,
+			 const gdb_byte *valaddr,
 			 int embedded_offset, CORE_ADDR address,
 			 struct ui_file *stream, int recurse,
 			 const struct value_print_options *options,
@@ -295,11 +300,11 @@ m2_print_array_contents (struct type *ty
 	   || ((current_language->la_language == language_m2)
 	       && (TYPE_CODE (type) == TYPE_CODE_CHAR)))
 	  && (options->format == 0 || options->format == 's'))
-	val_print_string (type, address, len+1, stream, options);
+	val_print_string (type, gdbarch, address, len+1, stream, options);
       else
 	{
 	  fprintf_filtered (stream, "{");
-	  val_print_array_elements (type, valaddr + embedded_offset,
+	  val_print_array_elements (type, gdbarch, valaddr + embedded_offset,
 				    address, stream, recurse, options, 0);
 	  fprintf_filtered (stream, "}");
 	}
@@ -315,7 +320,8 @@ m2_print_array_contents (struct type *ty
    printed.  */
 
 int
-m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
+m2_val_print (struct type *type, struct gdbarch *gdbarch,
+	      const gdb_byte *valaddr, int embedded_offset,
 	      CORE_ADDR address, struct ui_file *stream, int recurse,
 	      const struct value_print_options *options)
 {
@@ -360,7 +366,7 @@ m2_val_print (struct type *type, const g
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
+	      LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type), gdbarch,
 			       valaddr + embedded_offset, len, 0,
 			       options);
 	      i = len;
@@ -368,27 +374,30 @@ m2_val_print (struct type *type, const g
 	  else
 	    {
 	      fprintf_filtered (stream, "{");
-	      val_print_array_elements (type, valaddr + embedded_offset,
-					address, stream, recurse, options, 0);
+	      val_print_array_elements (type, gdbarch,
+					valaddr + embedded_offset, address,
+					stream, recurse, options, 0);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
 	}
       /* Array of unspecified length: treat like pointer to first elt.  */
-      print_unpacked_pointer (type, address, address, options, stream);
+      print_unpacked_pointer (type, gdbarch, address, address,
+			      options, stream);
       break;
 
     case TYPE_CODE_PTR:
       if (TYPE_CONST (type))
-	print_variable_at_address (type, valaddr + embedded_offset,
+	print_variable_at_address (type, gdbarch, valaddr + embedded_offset,
 				   stream, recurse, options);
       else if (options->format && options->format != 's')
-	print_scalar_formatted (valaddr + embedded_offset, type,
+	print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				options, 0, stream);
       else
 	{
 	  addr = unpack_pointer (type, valaddr + embedded_offset);
-	  print_unpacked_pointer (type, addr, address, options, stream);
+	  print_unpacked_pointer (type, gdbarch, addr, address,
+				  options, stream);
 	}
       break;
 
@@ -409,9 +418,8 @@ m2_val_print (struct type *type, const g
 	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
 	    {
 	      struct value *deref_val =
-		value_at
-		(TYPE_TARGET_TYPE (type),
-		 unpack_pointer (type, valaddr + embedded_offset));
+		value_at (TYPE_TARGET_TYPE (type), gdbarch,
+			  unpack_pointer (type, valaddr + embedded_offset));
 	      common_val_print (deref_val, stream, recurse, options,
 				current_language);
 	    }
@@ -429,20 +437,20 @@ m2_val_print (struct type *type, const g
       /* Fall through.  */
     case TYPE_CODE_STRUCT:
       if (m2_is_long_set (type))
-	m2_print_long_set (type, valaddr, embedded_offset, address,
+	m2_print_long_set (type, gdbarch, valaddr, embedded_offset, address,
 			   stream);
       else if (m2_is_unbounded_array (type))
-	m2_print_unbounded_array (type, valaddr, embedded_offset,
+	m2_print_unbounded_array (type, gdbarch, valaddr, embedded_offset,
 				  address, stream, recurse, options);
       else
-	cp_print_value_fields (type, type, valaddr, embedded_offset,
+	cp_print_value_fields (type, type, gdbarch, valaddr, embedded_offset,
 			       address, stream, recurse, options, NULL, 0);
       break;
 
     case TYPE_CODE_ENUM:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -469,7 +477,7 @@ m2_val_print (struct type *type, const g
     case TYPE_CODE_FUNC:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -488,7 +496,7 @@ m2_val_print (struct type *type, const g
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -506,8 +514,8 @@ m2_val_print (struct type *type, const g
     case TYPE_CODE_RANGE:
       if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
 	{
-	  m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset,
-			address, stream, recurse, options);
+	  m2_val_print (TYPE_TARGET_TYPE (type), gdbarch, valaddr,
+			embedded_offset, address, stream, recurse, options);
 	  break;
 	}
       /* FIXME: create_range_type does not set the unsigned bit in a
@@ -525,11 +533,12 @@ m2_val_print (struct type *type, const g
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
-	val_print_type_code_int (type, valaddr + embedded_offset, stream);
+	val_print_type_code_int (type, gdbarch, valaddr + embedded_offset,
+				 stream);
       break;
 
     case TYPE_CODE_CHAR:
@@ -538,7 +547,7 @@ m2_val_print (struct type *type, const g
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -555,10 +564,10 @@ m2_val_print (struct type *type, const g
 
     case TYPE_CODE_FLT:
       if (options->format)
-	print_scalar_formatted (valaddr + embedded_offset, type,
+	print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				options, 0, stream);
       else
-	print_floating (valaddr + embedded_offset, type, stream);
+	print_floating (valaddr + embedded_offset, type, gdbarch, stream);
       break;
 
     case TYPE_CODE_METHOD:
@@ -597,8 +606,8 @@ m2_val_print (struct type *type, const g
 
 	  for (i = low_bound; i <= high_bound; i++)
 	    {
-	      int element = value_bit_index (type, valaddr + embedded_offset,
-					     i);
+	      int element = value_bit_index (type, gdbarch,
+					     valaddr + embedded_offset, i);
 	      if (element < 0)
 		{
 		  i = element;
@@ -614,13 +623,13 @@ m2_val_print (struct type *type, const g
 		  need_comma = 1;
 
 		  if (i + 1 <= high_bound
-		      && value_bit_index (type, valaddr + embedded_offset,
-					  ++i))
+		      && value_bit_index (type, gdbarch,
+					  valaddr + embedded_offset, ++i))
 		    {
 		      int j = i;
 		      fputs_filtered ("..", stream);
 		      while (i + 1 <= high_bound
-			     && value_bit_index (type,
+			     && value_bit_index (type, gdbarch,
 						 valaddr + embedded_offset,
 						 ++i))
 			j = i;
Index: gdb-head/gdb/mi/mi-main.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-main.c
+++ gdb-head/gdb/mi/mi-main.c
@@ -23,6 +23,7 @@
 /* Work in progress.  */
 
 #include "defs.h"
+#include "arch-utils.h"
 #include "target.h"
 #include "inferior.h"
 #include "gdb_string.h"
@@ -704,7 +705,7 @@ get_register (struct frame_info *frame, 
       struct value_print_options opts;
       get_formatted_print_options (&opts, format);
       opts.deref_ref = 1;
-      val_print (register_type (gdbarch, regnum), buffer, 0, 0,
+      val_print (register_type (gdbarch, regnum), gdbarch, buffer, 0, 0,
 		 stb->stream, 0, &opts, current_language);
       ui_out_field_stream (uiout, "value", stb);
       ui_out_stream_delete (stb);
@@ -796,7 +797,7 @@ mi_cmd_data_evaluate_expression (char *c
   /* Print the result of the expression evaluation.  */
   get_user_print_options (&opts);
   opts.deref_ref = 0;
-  val_print (value_type (val), value_contents (val),
+  val_print (value_type (val), value_arch (val), value_contents (val),
 	     value_embedded_offset (val), value_address (val),
 	     stb->stream, 0, &opts, current_language);
 
@@ -828,6 +829,7 @@ mi_cmd_data_evaluate_expression (char *c
 void
 mi_cmd_data_read_memory (char *command, char **argv, int argc)
 {
+  struct gdbarch *gdbarch = get_current_arch ();
   struct cleanup *cleanups = make_cleanup (null_cleanup, NULL);
   CORE_ADDR addr;
   long total_bytes;
@@ -971,8 +973,8 @@ mi_cmd_data_read_memory (char *command, 
 	    else
 	      {
 		ui_file_rewind (stream->stream);
-		print_scalar_formatted (mbuf + col_byte, word_type, &opts,
-					word_asize, stream->stream);
+		print_scalar_formatted (mbuf + col_byte, word_type, gdbarch,
+					&opts, word_asize, stream->stream);
 		ui_out_field_stream (uiout, NULL, stream);
 	      }
 	  }
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -4397,8 +4397,8 @@ mips_print_fp_register (struct ui_file *
       flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
 
       get_formatted_print_options (&opts, 'x');
-      print_scalar_formatted (raw_buffer, builtin_type_uint32, &opts, 'w',
-			      file);
+      print_scalar_formatted (raw_buffer, builtin_type_uint32, gdbarch,
+			      &opts, 'w', file);
 
       fprintf_filtered (file, " flt: ");
       if (inv1)
@@ -4431,8 +4431,8 @@ mips_print_fp_register (struct ui_file *
       doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
 
       get_formatted_print_options (&opts, 'x');
-      print_scalar_formatted (raw_buffer, builtin_type_uint64, &opts, 'g',
-			      file);
+      print_scalar_formatted (raw_buffer, builtin_type_uint64, gdbarch,
+			      &opts, 'g', file);
 
       fprintf_filtered (file, " flt: ");
       if (inv1)
@@ -4490,8 +4490,8 @@ mips_print_register (struct ui_file *fil
 
   get_formatted_print_options (&opts, 'x');
   print_scalar_formatted (raw_buffer + offset,
-			  register_type (gdbarch, regnum), &opts, 0,
-			  file);
+			  register_type (gdbarch, regnum), gdbarch,
+			  &opts, 0, file);
 }
 
 /* Replacement for generic do_registers_info.
Index: gdb-head/gdb/mt-tdep.c
===================================================================
--- gdb-head.orig/gdb/mt-tdep.c
+++ gdb-head/gdb/mt-tdep.c
@@ -689,7 +689,7 @@ mt_registers_info (struct gdbarch *gdbar
 				 file);
 	  get_raw_print_options (&opts);
 	  opts.deref_ref = 1;
-	  val_print (register_type (gdbarch, regnum), buf,
+	  val_print (register_type (gdbarch, regnum), gdbarch, buf,
 		     0, 0, file, 0, &opts,
 		     current_language);
 	  fputs_filtered ("\n", file);
Index: gdb-head/gdb/p-lang.h
===================================================================
--- gdb-head.orig/gdb/p-lang.h
+++ gdb-head/gdb/p-lang.h
@@ -35,8 +35,8 @@ extern void pascal_print_type (struct ty
 extern void pascal_print_typedef (struct type *, struct symbol *,
 				  struct ui_file *);
 
-extern int pascal_val_print (struct type *, const gdb_byte *, int,
-			     CORE_ADDR, struct ui_file *, int,
+extern int pascal_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			     int, CORE_ADDR, struct ui_file *, int,
 			     const struct value_print_options *);
 
 extern int pascal_value_print (struct value *, struct ui_file *,
@@ -53,8 +53,8 @@ extern int 
 
 extern void pascal_printchar (int, struct type *, struct ui_file *);
 
-extern void pascal_printstr (struct ui_file *, struct type *, const gdb_byte *,
-			     unsigned int, int,
+extern void pascal_printstr (struct ui_file *, struct type *, struct gdbarch *,
+			     const gdb_byte *, unsigned int, int,
 			     const struct value_print_options *);
 
 extern struct type **const (pascal_builtin_types[]);
@@ -67,9 +67,9 @@ extern void
 extern void
   pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
 
-extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
-					      CORE_ADDR, struct ui_file *,
-					      int,
+extern void pascal_object_print_value_fields (struct type *, struct gdbarch *,
+					      const gdb_byte *, CORE_ADDR,
+					      struct ui_file *, int,
 					      const struct value_print_options *,
 					      struct type **, int);
 
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -292,7 +292,7 @@ print_formatted (struct value *val, int 
 	  {
 	    struct type *elttype = value_type (val);
 	    next_address = (value_address (val)
-			    + val_print_string (elttype,
+			    + val_print_string (elttype, value_arch (val),
 						value_address (val), -1,
 						stream, options));
 	  }
@@ -319,7 +319,7 @@ print_formatted (struct value *val, int 
   else
     /* User specified format, so don't look to the the type to
        tell us what to do.  */
-    print_scalar_formatted (value_contents (val), type,
+    print_scalar_formatted (value_contents (val), type, value_arch (val),
 			    options, size, stream);
 }
 
@@ -350,12 +350,13 @@ float_type_from_length (struct gdbarch *
 
 void
 print_scalar_formatted (const void *valaddr, struct type *type,
+			struct gdbarch *gdbarch,
 			const struct value_print_options *options,
 			int size, struct ui_file *stream)
 {
   LONGEST val_long = 0;
   unsigned int len = TYPE_LENGTH (type);
-  enum bfd_endian byte_order = gdbarch_byte_order (current_gdbarch);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
   /* If we get here with a string format, try again without it.  Go
      all the way back to the language printers, which may call us
@@ -365,7 +366,7 @@ print_scalar_formatted (const void *vala
       struct value_print_options opts = *options;
       opts.format = 0;
       opts.deref_ref = 0;
-      val_print (type, valaddr, 0, 0, stream, 0, &opts,
+      val_print (type, gdbarch, valaddr, 0, 0, stream, 0, &opts,
 		 current_language);
       return;
     }
@@ -404,7 +405,7 @@ print_scalar_formatted (const void *vala
      same, then at this point, the value's length (in target bytes) is
      gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type).  */
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
-    len = gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT;
+    len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT;
 
   /* If we are printing it as unsigned, truncate it in case it is actually
      a negative signed value (e.g. "print/u (short)-1" should print 65535
@@ -465,17 +466,18 @@ print_scalar_formatted (const void *vala
 	opts.format = 0;
 	if (TYPE_UNSIGNED (type))
 	  value_print (value_from_longest (builtin_type_true_unsigned_char,
-					   val_long),
+					   gdbarch, val_long),
 		       stream, &opts);
 	else
-	  value_print (value_from_longest (builtin_type_true_char, val_long),
+	  value_print (value_from_longest (builtin_type_true_char,
+					   gdbarch, val_long),
 		       stream, &opts);
       }
       break;
 
     case 'f':
-      type = float_type_from_length (current_gdbarch, type);
-      print_floating (valaddr, type, stream);
+      type = float_type_from_length (gdbarch, type);
+      print_floating (valaddr, type, gdbarch, stream);
       break;
 
     case 0:
@@ -546,7 +548,7 @@ set_next_address (struct gdbarch *gdbarc
 
   /* Make address available to the user as $_.  */
   set_internalvar (lookup_internalvar ("_"),
-		   value_from_pointer (ptr_type, addr));
+		   value_from_pointer (ptr_type, gdbarch, addr));
 }
 
 /* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,
@@ -761,7 +763,7 @@ static struct type *examine_g_type;
    Fetch it from memory and print on gdb_stdout.  */
 
 static void
-do_examine (struct format_data fmt, CORE_ADDR addr)
+do_examine (struct gdbarch *gdbarch, struct format_data fmt, CORE_ADDR addr)
 {
   char format = 0;
   char size;
@@ -831,7 +833,7 @@ do_examine (struct format_data fmt, CORE
 	     the disassembler be modified so that LAST_EXAMINE_VALUE
 	     is left with the byte sequence from the last complete
 	     instruction fetched from memory? */
-	  last_examine_value = value_at_lazy (val_type, next_address);
+	  last_examine_value = value_at_lazy (val_type, gdbarch, next_address);
 
 	  if (last_examine_value)
 	    release_value (last_examine_value);
@@ -1364,7 +1366,7 @@ x_command (char *exp, int from_tty)
       do_cleanups (old_chain);
     }
 
-  do_examine (fmt, next_address);
+  do_examine (gdbarch, fmt, next_address);
 
   /* If the examine succeeds, we remember its size and format for next
      time.  */
@@ -1374,12 +1376,15 @@ x_command (char *exp, int from_tty)
   /* Set a couple of internal variables if appropriate. */
   if (last_examine_value)
     {
+      struct gdbarch *last_examine_arch = value_arch (last_examine_value);
+
       /* Make last address examined available to the user as $_.  Use
          the correct pointer type.  */
       struct type *pointer_type
 	= lookup_pointer_type (value_type (last_examine_value));
       set_internalvar (lookup_internalvar ("_"),
 		       value_from_pointer (pointer_type,
+					   last_examine_arch,
 					   last_examine_address));
 
       /* Make contents of last address examined available to the user
@@ -1626,7 +1631,7 @@ do_one_display (struct display *d)
 
       annotate_display_value ();
 
-      do_examine (d->format, addr);
+      do_examine (d->exp->gdbarch, d->format, addr);
     }
   else
     {
@@ -1884,7 +1889,7 @@ print_variable_and_value (const char *na
 
   fprintf_filtered (stream, "%s%s = ", n_spaces (2 * indent), name);
 
-  val = read_var_value (var, frame);
+  val = read_var_value (var, get_frame_arch (frame), frame);
   get_user_print_options (&opts);
   common_val_print (val, stream, indent, &opts, current_language);
   fprintf_filtered (stream, "\n");
@@ -2492,7 +2497,7 @@ printf_command (char *arg, int from_tty)
 		   casting to a DFP type.  */
 		decimal_from_string (dec, dfp_len, "0");
 
-	      dfp_value = value_from_decfloat (dfp_type, dec);
+	      dfp_value = value_from_decfloat (dfp_type, gdbarch, dec);
 
 	      dfp_ptr = (gdb_byte *) value_contents (dfp_value);
 
Index: gdb-head/gdb/p-valprint.c
===================================================================
--- gdb-head.orig/gdb/p-valprint.c
+++ gdb-head/gdb/p-valprint.c
@@ -51,9 +51,9 @@
 
 
 int
-pascal_val_print (struct type *type, const gdb_byte *valaddr,
-		  int embedded_offset, CORE_ADDR address,
-		  struct ui_file *stream, int recurse,
+pascal_val_print (struct type *type, struct gdbarch *gdbarch,
+		  const gdb_byte *valaddr, int embedded_offset,
+		  CORE_ADDR address, struct ui_file *stream, int recurse,
 		  const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
@@ -100,7 +100,7 @@ pascal_val_print (struct type *type, con
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
+	      LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type), gdbarch,
 			       valaddr + embedded_offset, len, 0,
 			       options);
 	      i = len;
@@ -119,8 +119,9 @@ pascal_val_print (struct type *type, con
 		{
 		  i = 0;
 		}
-	      val_print_array_elements (type, valaddr + embedded_offset, address, stream,
-					recurse, options, i);
+	      val_print_array_elements (type, gdbarch,
+					valaddr + embedded_offset, address,
+					stream, recurse, options, i);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
@@ -132,7 +133,7 @@ pascal_val_print (struct type *type, con
     case TYPE_CODE_PTR:
       if (options->format && options->format != 's')
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -176,7 +177,8 @@ pascal_val_print (struct type *type, con
 	      && addr != 0)
 	    {
 	      /* no wide string yet */
-	      i = val_print_string (elttype, addr, -1, stream, options);
+	      i = val_print_string (elttype, gdbarch, addr, -1,
+				    stream, options);
 	    }
 	  /* also for pointers to pascal strings */
 	  /* Note: this is Free Pascal specific:
@@ -193,7 +195,8 @@ pascal_val_print (struct type *type, con
               read_memory (addr + length_pos, buffer, length_size);
 	      string_length = extract_unsigned_integer (buffer, length_size);
               xfree (buffer);
-              i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
+              i = val_print_string (char_type, gdbarch, addr + string_pos,
+				    string_length, stream, options);
 	    }
 	  else if (pascal_object_is_vtbl_member (type))
 	    {
@@ -229,7 +232,7 @@ pascal_val_print (struct type *type, con
 		    {
 		      wtype = TYPE_TARGET_TYPE (type);
 		    }
-		  vt_val = value_at (wtype, vt_address);
+		  vt_val = value_at (wtype, gdbarch, vt_address);
 		  common_val_print (vt_val, stream, recurse + 1, options,
 				    current_language);
 		  if (options->pretty)
@@ -265,7 +268,7 @@ pascal_val_print (struct type *type, con
 	    {
 	      struct value *deref_val =
 	      value_at
-	      (TYPE_TARGET_TYPE (type),
+	      (TYPE_TARGET_TYPE (type), gdbarch,
 	       unpack_pointer (type, valaddr + embedded_offset));
 	      common_val_print (deref_val, stream, recurse + 1, options,
 				current_language);
@@ -300,10 +303,14 @@ pascal_val_print (struct type *type, con
                                      &string_pos, &char_type, NULL))
 	    {
 	      len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
-	      LA_PRINT_STRING (stream, char_type, valaddr + embedded_offset + string_pos, len, 0, options);
+	      LA_PRINT_STRING (stream, char_type, gdbarch,
+			       valaddr + embedded_offset + string_pos,
+			       len, 0, options);
 	    }
 	  else
-	    pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream,
+	    pascal_object_print_value_fields (type, gdbarch,
+					      valaddr + embedded_offset,
+					      address, stream,
 					      recurse, options, NULL, 0);
 	}
       break;
@@ -311,7 +318,7 @@ pascal_val_print (struct type *type, con
     case TYPE_CODE_ENUM:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -337,16 +344,17 @@ pascal_val_print (struct type *type, con
 
     case TYPE_CODE_FLAGS:
       if (options->format)
-	  print_scalar_formatted (valaddr + embedded_offset, type,
-				  options, 0, stream);
+	print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
+				options, 0, stream);
       else
-	val_print_type_code_flags (type, valaddr + embedded_offset, stream);
+	val_print_type_code_flags (type, gdbarch, valaddr + embedded_offset,
+				   stream);
       break;
 
     case TYPE_CODE_FUNC:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	  break;
 	}
@@ -365,7 +373,7 @@ pascal_val_print (struct type *type, con
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -399,12 +407,13 @@ pascal_val_print (struct type *type, con
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
 	{
-	  val_print_type_code_int (type, valaddr + embedded_offset, stream);
+	  val_print_type_code_int (type, gdbarch, valaddr + embedded_offset,
+				   stream);
 	}
       break;
 
@@ -414,7 +423,7 @@ pascal_val_print (struct type *type, con
 	  struct value_print_options opts = *options;
 	  opts.format = (options->format ? options->format
 			 : options->output_format);
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  &opts, 0, stream);
 	}
       else
@@ -432,12 +441,12 @@ pascal_val_print (struct type *type, con
     case TYPE_CODE_FLT:
       if (options->format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type,
+	  print_scalar_formatted (valaddr + embedded_offset, type, gdbarch,
 				  options, 0, stream);
 	}
       else
 	{
-	  print_floating (valaddr + embedded_offset, type, stream);
+	  print_floating (valaddr + embedded_offset, type, gdbarch, stream);
 	}
       break;
 
@@ -474,7 +483,8 @@ pascal_val_print (struct type *type, con
 
 	  for (i = low_bound; i <= high_bound; i++)
 	    {
-	      int element = value_bit_index (type, valaddr + embedded_offset, i);
+	      int element = value_bit_index (type, gdbarch,
+					     valaddr + embedded_offset, i);
 	      if (element < 0)
 		{
 		  i = element;
@@ -489,12 +499,16 @@ pascal_val_print (struct type *type, con
 		  print_type_scalar (range, i, stream);
 		  need_comma = 1;
 
-		  if (i + 1 <= high_bound && value_bit_index (type, valaddr + embedded_offset, ++i))
+		  if (i + 1 <= high_bound
+		      && value_bit_index (type, gdbarch,
+					  valaddr + embedded_offset, ++i))
 		    {
 		      int j = i;
 		      fputs_filtered ("..", stream);
 		      while (i + 1 <= high_bound
-			     && value_bit_index (type, valaddr + embedded_offset, ++i))
+			     && value_bit_index (type, gdbarch,
+						 valaddr + embedded_offset,
+						 ++i))
 			j = i;
 		      print_type_scalar (range, j, stream);
 		    }
@@ -580,8 +594,9 @@ static void pascal_object_print_static_f
 					      struct ui_file *, int,
 					      const struct value_print_options *);
 
-static void pascal_object_print_value (struct type *, const gdb_byte *,
-				       CORE_ADDR, struct ui_file *, int,
+static void pascal_object_print_value (struct type *, struct gdbarch *,
+				       const gdb_byte *, CORE_ADDR,
+				       struct ui_file *, int,
 				       const struct value_print_options *,
 				       struct type **);
 
@@ -636,9 +651,9 @@ pascal_object_is_vtbl_member (struct typ
    should not print, or zero if called from top level.  */
 
 void
-pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
-				  CORE_ADDR address, struct ui_file *stream,
-				  int recurse,
+pascal_object_print_value_fields (struct type *type, struct gdbarch *gdbarch,
+				  const gdb_byte *valaddr, CORE_ADDR address,
+				  struct ui_file *stream, int recurse,
 				  const struct value_print_options *options,
 				  struct type **dont_print_vb,
 				  int dont_print_statmem)
@@ -655,7 +670,7 @@ pascal_object_print_value_fields (struct
   /* Print out baseclasses such that we don't print
      duplicates of virtual baseclasses.  */
   if (n_baseclasses > 0)
-    pascal_object_print_value (type, valaddr, address, stream,
+    pascal_object_print_value (type, gdbarch, valaddr, address, stream,
 			       recurse + 1, options, dont_print_vb);
 
   if (!len && n_baseclasses == 1)
@@ -748,8 +763,9 @@ pascal_object_print_value_fields (struct
 	      else
 		{
 		  struct value_print_options opts = *options;
-		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
-				   unpack_field_as_long (type, valaddr, i));
+		  v = value_from_longest (TYPE_FIELD_TYPE (type, i), gdbarch,
+					  unpack_field_as_long (type, gdbarch,
+								valaddr, i));
 
 		  opts.deref_ref = 0;
 		  common_val_print (v, stream, recurse + 1, &opts,
@@ -766,8 +782,9 @@ pascal_object_print_value_fields (struct
 		{
 		  /* struct value *v = value_static_field (type, i); v4.17 specific */
 		  struct value *v;
-		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
-				   unpack_field_as_long (type, valaddr, i));
+		  v = value_from_longest (TYPE_FIELD_TYPE (type, i), gdbarch,
+					  unpack_field_as_long (type, gdbarch,
+								valaddr, i));
 
 		  if (v == NULL)
 		    fputs_filtered ("<optimized out>", stream);
@@ -783,7 +800,7 @@ pascal_object_print_value_fields (struct
 		     valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
 		     address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
 		     stream, format, 0, recurse + 1, pretty); */
-		  val_print (TYPE_FIELD_TYPE (type, i),
+		  val_print (TYPE_FIELD_TYPE (type, i), gdbarch,
 			     valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
 			     stream, recurse + 1, &opts,
@@ -814,9 +831,9 @@ pascal_object_print_value_fields (struct
    baseclasses.  */
 
 static void
-pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
-			   CORE_ADDR address, struct ui_file *stream,
-			   int recurse,
+pascal_object_print_value (struct type *type, struct gdbarch *gdbarch,
+			   const gdb_byte *valaddr, CORE_ADDR address,
+			   struct ui_file *stream, int recurse,
 			   const struct value_print_options *options,
 			   struct type **dont_print_vb)
 {
@@ -889,7 +906,8 @@ pascal_object_print_value (struct type *
       if (boffset == -1)
 	fprintf_filtered (stream, "<invalid address>");
       else
-	pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
+	pascal_object_print_value_fields (baseclass, gdbarch, base_valaddr,
+					  address + boffset,
 					  stream, recurse, options,
 		     (struct type **) obstack_base (&dont_print_vb_obstack),
 					  0);
@@ -953,7 +971,8 @@ pascal_object_print_static_field (struct
 		    sizeof (CORE_ADDR));
 
       CHECK_TYPEDEF (type);
-      pascal_object_print_value_fields (type, value_contents (val), addr,
+      pascal_object_print_value_fields (type, value_arch (val),
+					value_contents (val), addr,
 					stream, recurse, options, NULL, 1);
       return;
     }
Index: gdb-head/gdb/scm-lang.h
===================================================================
--- gdb-head.orig/gdb/scm-lang.h
+++ gdb-head/gdb/scm-lang.h
@@ -48,8 +48,8 @@ struct value;
 extern int scm_value_print (struct value *, struct ui_file *,
 			    const struct value_print_options *);
 
-extern int scm_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			  struct ui_file *, int,
+extern int scm_val_print (struct type *, struct gdbarch *, const gdb_byte *,
+			  int, CORE_ADDR, struct ui_file *, int,
 			  const struct value_print_options *);
 
 extern LONGEST scm_get_field (LONGEST, int, int);
Index: gdb-head/gdb/scm-valprint.c
===================================================================
--- gdb-head.orig/gdb/scm-valprint.c
+++ gdb-head/gdb/scm-valprint.c
@@ -32,29 +32,34 @@
 #include "infcall.h"
 #include "objfiles.h"
 
-static void scm_ipruk (char *, struct type *, LONGEST, struct ui_file *);
-static void scm_scmval_print (struct type *, LONGEST, struct ui_file *,
-			      int, const struct value_print_options *);
-static void scm_scmlist_print (struct type *, LONGEST, struct ui_file *,
-			       int, const struct value_print_options *);
-static int scm_inferior_print (struct type *, LONGEST, struct ui_file *,
-			       int, const struct value_print_options *);
+static void scm_ipruk (char *, struct type *, struct gdbarch *,
+		       LONGEST, struct ui_file *);
+static void scm_scmval_print (struct type *, struct gdbarch *,
+			      LONGEST, struct ui_file *, int,
+			      const struct value_print_options *);
+static void scm_scmlist_print (struct type *, struct gdbarch *,
+			       LONGEST, struct ui_file *, int,
+			       const struct value_print_options *);
+static int scm_inferior_print (struct type *, struct gdbarch *,
+			       LONGEST, struct ui_file *, int,
+			       const struct value_print_options *);
 
 /* Prints the SCM value VALUE by invoking the inferior, if appropraite.
    Returns >= 0 on success;  return -1 if the inferior cannot/should not
    print VALUE. */
 
 static int
-scm_inferior_print (struct type *type, LONGEST value, struct ui_file *stream,
-		    int recurse, const struct value_print_options *options)
+scm_inferior_print (struct type *type, struct gdbarch *gdbarch, LONGEST value,
+		    struct ui_file *stream, int recurse,
+		    const struct value_print_options *options)
 {
   struct value *func, *arg, *result;
   struct symbol *gdb_output_sym, *gdb_output_len_sym;
   char *output;
   int ret, output_len;
 
-  func = find_function_in_inferior (current_gdbarch, "gdb_print");
-  arg = value_from_longest (type, value);
+  func = find_function_in_inferior (gdbarch, "gdb_print");
+  arg = value_from_longest (type, gdbarch, value);
 
   result = call_function_by_hand (func, 1, &arg);
   ret = (int) value_as_long (result);
@@ -76,7 +81,7 @@ scm_inferior_print (struct type *type, L
 		       (char *) &output_len, sizeof (output_len));
 
 	  output = (char *) alloca (output_len);
-	  remote_buffer = value_at (type,
+	  remote_buffer = value_at (type, gdbarch,
 				    SYMBOL_VALUE_ADDRESS (gdb_output_sym));
 	  read_memory (value_as_address (remote_buffer),
 		       output, output_len);
@@ -128,7 +133,7 @@ static char *scm_isymnames[] =
 };
 
 static void
-scm_scmlist_print (struct type *type, LONGEST svalue,
+scm_scmlist_print (struct type *type, struct gdbarch *gdbarch, LONGEST svalue,
 		   struct ui_file *stream, int recurse,
 		   const struct value_print_options *options)
 {
@@ -139,7 +144,8 @@ scm_scmlist_print (struct type *type, LO
       fputs_filtered ("...", stream);
       return;
     }
-  scm_scmval_print (type, SCM_CAR (svalue), stream, recurse + 1, options);
+  scm_scmval_print (type, gdbarch, SCM_CAR (svalue),
+		    stream, recurse + 1, options);
   svalue = SCM_CDR (svalue);
   for (; SCM_NIMP (svalue); svalue = SCM_CDR (svalue))
     {
@@ -151,19 +157,21 @@ scm_scmlist_print (struct type *type, LO
 	  fputs_filtered ("...", stream);
 	  return;
 	}
-      scm_scmval_print (type, SCM_CAR (svalue), stream, recurse + 1, options);
+      scm_scmval_print (type, gdbarch, SCM_CAR (svalue),
+			stream, recurse + 1, options);
     }
   if (SCM_NNULLP (svalue))
     {
       fputs_filtered (" . ", stream);
-      scm_scmval_print (type, svalue, stream, recurse + 1, options);
+      scm_scmval_print (type, gdbarch, svalue,
+			stream, recurse + 1, options);
     }
 #undef SCM_SIZE
 }
 
 static void
-scm_ipruk (char *hdr, struct type *type, LONGEST ptr,
-	   struct ui_file *stream)
+scm_ipruk (char *hdr, struct type *type, struct gdbarch *gdbarch,
+	   LONGEST ptr, struct ui_file *stream)
 {
 #define SCM_SIZE (TYPE_LENGTH (type))
   fprintf_filtered (stream, "#<unknown-%s", hdr);
@@ -175,8 +183,8 @@ scm_ipruk (char *hdr, struct type *type,
 }
 
 static void
-scm_scmval_print (struct type *type, LONGEST svalue,
-		  struct ui_file *stream, int recurse,
+scm_scmval_print (struct type *type, struct gdbarch *gdbarch,
+		  LONGEST svalue, struct ui_file *stream, int recurse,
 		  const struct value_print_options *options)
 {
 #define SCM_SIZE (TYPE_LENGTH (type))
@@ -193,7 +201,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;
 	}
@@ -221,7 +229,7 @@ taloop:
       goto taloop;
     default:
     idef:
-      scm_ipruk ("immediate", type, svalue, stream);
+      scm_ipruk ("immediate", type, gdbarch, svalue, stream);
       break;
     case 0:
 
@@ -249,13 +257,14 @@ taloop:
 	case scm_tcs_cons_imcar:
 	case scm_tcs_cons_nimcar:
 	  fputs_filtered ("(", stream);
-	  scm_scmlist_print (type, svalue, stream, recurse + 1, options);
+	  scm_scmlist_print (type, gdbarch, svalue,
+			     stream, recurse + 1, options);
 	  fputs_filtered (")", stream);
 	  break;
 	case scm_tcs_closures:
 	  fputs_filtered ("#<CLOSURE ", stream);
-	  scm_scmlist_print (type, SCM_CODE (svalue), stream,
-			     recurse + 1, options);
+	  scm_scmlist_print (type, gdbarch, SCM_CODE (svalue),
+			     stream, recurse + 1, options);
 	  fputs_filtered (">", stream);
 	  break;
 	case scm_tc7_string:
@@ -310,7 +319,8 @@ taloop:
 	      {
 		if (i > 0)
 		  fputs_filtered (" ", stream);
-		scm_scmval_print (type, scm_get_field (elements, i, SCM_SIZE),
+		scm_scmval_print (type, gdbarch,
+				  scm_get_field (elements, i, SCM_SIZE),
 				  stream, recurse + 1, options);
 	      }
 	    fputs_filtered (")", stream);
@@ -397,7 +407,7 @@ taloop:
 #if 0
 	punk:
 #endif
-	  scm_ipruk ("type", type, svalue, stream);
+	  scm_ipruk ("type", type, gdbarch, svalue, stream);
 	}
       break;
     }
@@ -405,21 +415,22 @@ taloop:
 }
 
 int
-scm_val_print (struct type *type, const gdb_byte *valaddr,
-	       int embedded_offset, CORE_ADDR address,
-	       struct ui_file *stream, int recurse,
+scm_val_print (struct type *type, struct gdbarch *gdbarch,
+	       const gdb_byte *valaddr, int embedded_offset,
+	       CORE_ADDR address, struct ui_file *stream, int recurse,
 	       const struct value_print_options *options)
 {
   if (is_scmvalue_type (type))
     {
       LONGEST svalue = extract_signed_integer (valaddr, TYPE_LENGTH (type));
 
-      if (scm_inferior_print (type, svalue, stream, recurse, options) >= 0)
+      if (scm_inferior_print (type, gdbarch, svalue,
+			      stream, recurse, options) >= 0)
 	{
 	}
       else
 	{
-	  scm_scmval_print (type, svalue, stream, recurse, options);
+	  scm_scmval_print (type, gdbarch, svalue, stream, recurse, options);
 	}
 
       gdb_flush (stream);
@@ -427,7 +438,8 @@ scm_val_print (struct type *type, const 
     }
   else
     {
-      return c_val_print (type, valaddr, 0, address, stream, recurse, options);
+      return c_val_print (type, gdbarch, valaddr, 0, address,
+			  stream, recurse, options);
     }
 }
 
Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -2105,12 +2105,12 @@ sh64_do_register (struct gdbarch *gdbarc
 
   get_formatted_print_options (&opts, 'x');
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
+  val_print (register_type (gdbarch, regnum), gdbarch, raw_buffer, 0, 0,
 	     file, 0, &opts, current_language);
   fprintf_filtered (file, "\t");
   get_formatted_print_options (&opts, 0);
   opts.deref_ref = 1;
-  val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
+  val_print (register_type (gdbarch, regnum), gdbarch, raw_buffer, 0, 0,
 	     file, 0, &opts, current_language);
   fprintf_filtered (file, "\n");
 }
Index: gdb-head/gdb/tui/tui-regs.c
===================================================================
--- gdb-head.orig/gdb/tui/tui-regs.c
+++ gdb-head/gdb/tui/tui-regs.c
@@ -698,7 +698,7 @@ tui_register_format (struct frame_info *
       fprintf_filtered (stream, "%-14s ", name);
       get_frame_register (frame, regnum, buf);
       get_formatted_print_options (&opts, 'f');
-      print_scalar_formatted (buf, type, &opts, len, stream);
+      print_scalar_formatted (buf, type, gdbarch, &opts, len, stream);
     }
   else
     {
Index: gdb-head/gdb/valprint.c
===================================================================
--- gdb-head.orig/gdb/valprint.c
+++ gdb-head/gdb/valprint.c
@@ -260,9 +260,9 @@ scalar_type_p (struct type *type)
 
 
 int
-val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-	   CORE_ADDR address, struct ui_file *stream, int recurse,
-	   const struct value_print_options *options,
+val_print (struct type *type, struct gdbarch *gdbarch, const gdb_byte *valaddr,
+	   int embedded_offset, CORE_ADDR address, struct ui_file *stream,
+	   int recurse, const struct value_print_options *options,
 	   const struct language_defn *language)
 {
   volatile struct gdb_exception except;
@@ -289,7 +289,7 @@ val_print (struct type *type, const gdb_
 
   if (!options->raw)
     {
-      ret = apply_val_pretty_printer (type, valaddr, embedded_offset,
+      ret = apply_val_pretty_printer (type, gdbarch, valaddr, embedded_offset,
 				      address, stream, recurse, options,
 				      language);
       if (ret)
@@ -306,8 +306,8 @@ val_print (struct type *type, const gdb_
 
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
-      ret = language->la_val_print (type, valaddr, embedded_offset, address,
-				    stream, recurse, &local_opts);
+      ret = language->la_val_print (type, gdbarch, valaddr, embedded_offset,
+				    address, stream, recurse, &local_opts);
     }
   if (except.reason < 0)
     fprintf_filtered (stream, _("<error reading variable>"));
@@ -361,7 +361,8 @@ common_val_print (struct value *val, str
   if (!value_check_printable (val, stream))
     return 0;
 
-  return val_print (value_type (val), value_contents_all (val),
+  return val_print (value_type (val), value_arch (val),
+		    value_contents_all (val),
 		    value_embedded_offset (val), value_address (val),
 		    stream, recurse, options, language);
 }
@@ -380,7 +381,7 @@ value_print (struct value *val, struct u
 
   if (!options->raw)
     {
-      int r = apply_val_pretty_printer (value_type (val),
+      int r = apply_val_pretty_printer (value_type (val), value_arch (val),
 					value_contents_all (val),
 					value_embedded_offset (val),
 					value_address (val),
@@ -398,10 +399,10 @@ value_print (struct value *val, struct u
    value.  STREAM is where to print the value.  */
 
 void
-val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
-			 struct ui_file *stream)
+val_print_type_code_int (struct type *type, struct gdbarch *gdbarch,
+			 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 (gdbarch);
 
   if (TYPE_LENGTH (type) > sizeof (LONGEST))
     {
@@ -431,8 +432,8 @@ val_print_type_code_int (struct type *ty
 }
 
 void
-val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
-			   struct ui_file *stream)
+val_print_type_code_flags (struct type *type, struct gdbarch *gdbarch,
+			   const gdb_byte *valaddr, struct ui_file *stream)
 {
   ULONGEST val = unpack_long (type, valaddr);
   int bitpos, nfields = TYPE_NFIELDS (type);
@@ -530,7 +531,7 @@ longest_to_int (LONGEST arg)
 
 void
 print_floating (const gdb_byte *valaddr, struct type *type,
-		struct ui_file *stream)
+		struct gdbarch *gdbarch, struct ui_file *stream)
 {
   DOUBLEST doub;
   int inv;
@@ -603,7 +604,7 @@ print_floating (const gdb_byte *valaddr,
 
 void
 print_decimal_floating (const gdb_byte *valaddr, struct type *type,
-			struct ui_file *stream)
+			struct gdbarch *gdbarch, struct ui_file *stream)
 {
   char decstr[MAX_DECIMAL_STRING];
   unsigned len = TYPE_LENGTH (type);
@@ -1076,8 +1077,8 @@ get_array_bounds (struct type *type, lon
    at INDEX of an array whose index type is INDEX_TYPE.  */
     
 void  
-maybe_print_array_index (struct type *index_type, LONGEST index,
-                         struct ui_file *stream,
+maybe_print_array_index (struct type *index_type, struct gdbarch *gdbarch,
+			 LONGEST index, struct ui_file *stream,
 			 const struct value_print_options *options)
 {
   struct value *index_value;
@@ -1085,7 +1086,7 @@ maybe_print_array_index (struct type *in
   if (!options->print_array_indexes)
     return; 
     
-  index_value = value_from_longest (index_type, index);
+  index_value = value_from_longest (index_type, gdbarch, index);
 
   LA_PRINT_ARRAY_INDEX (index_value, stream, options);
 }
@@ -1100,9 +1101,9 @@ maybe_print_array_index (struct type *in
  */
 
 void
-val_print_array_elements (struct type *type, const gdb_byte *valaddr,
-			  CORE_ADDR address, struct ui_file *stream,
-			  int recurse,
+val_print_array_elements (struct type *type, struct gdbarch *gdbarch,
+			  const gdb_byte *valaddr, CORE_ADDR address,
+			  struct ui_file *stream, int recurse,
 			  const struct value_print_options *options,
 			  unsigned int i)
 {
@@ -1165,7 +1166,7 @@ val_print_array_elements (struct type *t
 	    }
 	}
       wrap_here (n_spaces (2 + 2 * recurse));
-      maybe_print_array_index (index_type, i + low_bound_index,
+      maybe_print_array_index (index_type, gdbarch, i + low_bound_index,
                                stream, options);
 
       rep1 = i + 1;
@@ -1179,7 +1180,8 @@ val_print_array_elements (struct type *t
 
       if (reps > options->repeat_count_threshold)
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen,
+	  val_print (elttype, gdbarch, valaddr + i * eltlen, 0,
+		     address + i * eltlen,
 		     stream, recurse + 1, options, current_language);
 	  annotate_elt_rep (reps);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
@@ -1190,7 +1192,8 @@ val_print_array_elements (struct type *t
 	}
       else
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, address + i * eltlen,
+	  val_print (elttype, gdbarch, valaddr + i * eltlen, 0,
+		     address + i * eltlen,
 		     stream, recurse + 1, options, current_language);
 	  annotate_elt ();
 	  things_printed++;
@@ -1382,8 +1385,8 @@ read_string (CORE_ADDR addr, int len, in
    whichever is smaller.  */
 
 int
-val_print_string (struct type *elttype, CORE_ADDR addr, int len,
-		  struct ui_file *stream,
+val_print_string (struct type *elttype, struct gdbarch *gdbarch,
+		  CORE_ADDR addr, int len, struct ui_file *stream,
 		  const struct value_print_options *options)
 {
   int force_ellipsis = 0;	/* Force ellipsis to be printed if nonzero.  */
@@ -1447,7 +1450,8 @@ val_print_string (struct type *elttype, 
 	{
 	  fputs_filtered (" ", stream);
 	}
-      LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width, force_ellipsis, options);
+      LA_PRINT_STRING (stream, elttype, gdbarch, buffer, bytes_read / width,
+		       force_ellipsis, options);
     }
 
   if (errcode != 0)
Index: gdb-head/gdb/valprint.h
===================================================================
--- gdb-head.orig/gdb/valprint.h
+++ gdb-head/gdb/valprint.h
@@ -112,21 +112,22 @@ extern void get_formatted_print_options 
 extern int get_array_bounds (struct type *type, long *low_bound,
 			     long *high_bound);
 
-extern void maybe_print_array_index (struct type *index_type, LONGEST index,
+extern void maybe_print_array_index (struct type *index_type,
+				     struct gdbarch *gdbarch, LONGEST index,
                                      struct ui_file *stream,
 				     const struct value_print_options *options);
 
-extern void val_print_array_elements (struct type *, const gdb_byte *,
-				      CORE_ADDR, struct ui_file *, int,
+extern void val_print_array_elements (struct type *, struct gdbarch *,
+				      const gdb_byte *, CORE_ADDR,
+				      struct ui_file *, int,
 				      const struct value_print_options *,
 				      unsigned int);
 
-extern void val_print_type_code_int (struct type *, const gdb_byte *,
-				     struct ui_file *);
+extern void val_print_type_code_int (struct type *, struct gdbarch *,
+				     const gdb_byte *, struct ui_file *);
 
-extern void val_print_type_code_flags (struct type *type,
-				       const gdb_byte *valaddr,
-				       struct ui_file *stream);
+extern void val_print_type_code_flags (struct type *, struct gdbarch *,
+				       const gdb_byte *, struct ui_file *);
 
 extern void print_binary_chars (struct ui_file *, const gdb_byte *,
 				unsigned int, enum bfd_endian);
Index: gdb-head/gdb/value.h
===================================================================
--- gdb-head.orig/gdb/value.h
+++ gdb-head/gdb/value.h
@@ -53,9 +53,10 @@ void value_remove_from_list (struct valu
 
 struct value *value_next (struct value *);
 
-/* Type of the value.  */
+/* Type and architecture of the value.  */
 
 extern struct type *value_type (struct value *);
+extern struct gdbarch *value_arch (struct value *);
 
 /* This is being used to change the type of an existing value, that
    code should instead be creating a new value with the changed type
@@ -180,10 +181,11 @@ struct lval_funcs
   void (*free_closure) (struct value *v);
 };
 
-/* Create a computed lvalue, with type TYPE, function pointers FUNCS,
-   and closure CLOSURE.  */
+/* Create a computed lvalue, with type TYPE, architecture GDBARCH,
+   function pointers FUNCS, and closure CLOSURE.  */
 
 extern struct value *allocate_computed_value (struct type *type,
+					      struct gdbarch *gdbarch,
                                               struct lval_funcs *funcs,
                                               void *closure);
 
@@ -329,37 +331,53 @@ extern DOUBLEST unpack_double (struct ty
 			       int *invp);
 extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
 extern LONGEST unpack_field_as_long (struct type *type,
+				     struct gdbarch *gdbarch,
 				     const gdb_byte *valaddr,
 				     int fieldno);
 
 extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num);
 
-extern struct value *value_from_longest (struct type *type, LONGEST num);
-extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
-extern struct value *value_from_double (struct type *type, DOUBLEST num);
+extern struct value *value_from_longest (struct type *type,
+					 struct gdbarch *gdbarch, LONGEST num);
+extern struct value *value_from_pointer (struct type *type,
+					 struct gdbarch *gdbarch,
+					 CORE_ADDR addr);
+extern struct value *value_from_double (struct type *type,
+					struct gdbarch *gdbarch, DOUBLEST num);
 extern struct value *value_from_decfloat (struct type *type,
+					  struct gdbarch *gdbarch,
 					  const gdb_byte *decbytes);
 
-extern struct value *value_at (struct type *type, CORE_ADDR addr);
-extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
+extern struct value *value_at (struct type *type, struct gdbarch *gdbarch,
+			       CORE_ADDR addr);
+extern struct value *value_at_lazy (struct type *type,
+				    struct gdbarch *gdbarch, CORE_ADDR addr);
 
 extern struct value *value_from_contents_and_address (struct type *,
+						      struct gdbarch *,
 						      const gdb_byte *,
 						      CORE_ADDR);
 
 extern struct value *default_value_from_register (struct type *type,
+						  struct gdbarch *val_arch,
 						  int regnum,
 						  struct frame_info *frame);
 
-extern struct value *value_from_register (struct type *type, int regnum,
+extern struct value *value_from_register (struct type *type,
+					  struct gdbarch *val_arch,
+					  int regnum,
 					  struct frame_info *frame);
 
 extern CORE_ADDR address_from_register (struct type *type, int regnum,
 					struct frame_info *frame);
 
-extern struct value *value_of_variable (struct symbol *var, struct block *b);
-
-extern struct value *address_of_variable (struct symbol *var, struct block *b);
+extern struct value *value_of_variable (struct symbol *var,
+					struct gdbarch *gdbarch,
+					struct block *b);
+
+extern struct value *address_of_variable (struct symbol *var,
+					  struct gdbarch *gdbarch,
+					  struct block *b);
 
 extern struct value *value_of_register (int regnum, struct frame_info *frame);
 
@@ -368,23 +386,31 @@ struct value *value_of_register_lazy (st
 extern int symbol_read_needs_frame (struct symbol *);
 
 extern struct value *read_var_value (struct symbol *var,
+				     struct gdbarch *gdbarch,
 				     struct frame_info *frame);
 
-extern struct value *allocate_value (struct type *type);
-extern struct value *allocate_value_lazy (struct type *type);
+extern struct value *allocate_value (struct type *type,
+				     struct gdbarch *gdbarch);
+extern struct value *allocate_value_lazy (struct type *type,
+					  struct gdbarch *gdbarch);
 extern void allocate_value_contents (struct value *value);
 
-extern struct value *allocate_repeat_value (struct type *type, int count);
+extern struct value *allocate_repeat_value (struct type *type,
+					    struct gdbarch *gdbarch,
+					    int count);
 
 extern struct value *value_mark (void);
 
 extern void value_free_to_mark (struct value *mark);
 
-extern struct value *value_cstring (char *ptr, int len,
+extern struct value *value_cstring (struct gdbarch *gdbarch,
+				    char *ptr, int len,
 				    struct type *char_type);
-extern struct value *value_string (char *ptr, int len,
+extern struct value *value_string (struct gdbarch *gdbarch,
+				   char *ptr, int len,
 				   struct type *char_type);
-extern struct value *value_bitstring (char *ptr, int len);
+extern struct value *value_bitstring (struct gdbarch *gdbarch,
+				      char *ptr, int len);
 
 extern struct value *value_array (int lowbound, int highbound,
 				  struct value **elemvec);
@@ -429,11 +455,13 @@ extern struct value *value_struct_elt (s
 				       char *err);
 
 extern struct value *value_aggregate_elt (struct type *curtype,
+					  struct gdbarch *gdbarch,
 					  char *name,
 					  int want_address,
 					  enum noside noside);
 
-extern struct value *value_static_field (struct type *type, int fieldno);
+extern struct value *value_static_field (struct type *type,
+					 struct gdbarch *gdbarch, int fieldno);
 
 extern struct fn_field *value_find_oload_method_list (struct value **, char *,
 						      int, int *,
@@ -462,9 +490,11 @@ extern struct value *value_cast_pointers
 
 extern struct value *value_cast (struct type *type, struct value *arg2);
 
-extern struct value *value_zero (struct type *type, enum lval_type lv);
+extern struct value *value_zero (struct type *type, struct gdbarch *gdbarch,
+				 enum lval_type lv);
 
-extern struct value *value_one (struct type *type, enum lval_type lv);
+extern struct value *value_one (struct type *type, struct gdbarch *gdbarch,
+				enum lval_type lv);
 
 extern struct value *value_repeat (struct value *arg1, int count);
 
@@ -479,8 +509,8 @@ extern struct value *register_value_bein
 
 extern int value_in (struct value *element, struct value *set);
 
-extern int value_bit_index (struct type *type, const gdb_byte *addr,
-			    int index);
+extern int value_bit_index (struct type *type, struct gdbarch *gdbarch,
+			    const gdb_byte *addr, int index);
 
 extern int using_struct_return (struct gdbarch *gdbarch,
 				struct type *func_type,
@@ -520,7 +550,8 @@ extern void binop_promote (const struct 
 
 extern struct value *access_value_history (int num);
 
-extern struct value *value_of_internalvar (struct internalvar *var);
+extern struct value *value_of_internalvar (struct gdbarch *gdbarch,
+					   struct internalvar *var);
 
 extern int get_internalvar_integer (struct internalvar *var, LONGEST *l);
 
@@ -539,7 +570,8 @@ extern struct internalvar *lookup_only_i
 
 extern struct internalvar *create_internalvar (const char *name);
 
-typedef struct value * (*internalvar_make_value) (struct internalvar *);
+typedef struct value * (*internalvar_make_value) (struct gdbarch *gdbarch,
+						  struct internalvar *var);
 
 extern struct internalvar *
   create_internalvar_type_lazy (char *name, internalvar_make_value fun);
@@ -565,7 +597,8 @@ extern struct value *value_x_unop (struc
 				   enum noside noside);
 
 extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f,
-				     int j, struct type *type, int offset);
+				     int j, struct type *type, int offset,
+				     struct gdbarch *gdbarch);
 
 extern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
 				 struct value *arg2);
@@ -582,8 +615,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 gdbarch *gdbarch, gdb_byte *addr,
+			  LONGEST fieldval, int bitpos, int bitsize);
 
 extern void type_print (struct type *type, char *varstring,
 			struct ui_file *stream, int show);
@@ -598,9 +631,10 @@ extern void print_longest (struct ui_fil
 			   int use_local, LONGEST val);
 
 extern void print_floating (const gdb_byte *valaddr, struct type *type,
-			    struct ui_file *stream);
+			    struct gdbarch *gdbarch, struct ui_file *stream);
 
 extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
+				    struct gdbarch *gdbarch,
 				    struct ui_file *stream);
 
 extern int value_print (struct value *val, struct ui_file *stream,
@@ -612,7 +646,8 @@ extern void value_print_array_elements (
 
 extern struct value *value_release_to_mark (struct value *mark);
 
-extern int val_print (struct type *type, const gdb_byte *valaddr,
+extern int val_print (struct type *type, struct gdbarch *gdbarch,
+		      const gdb_byte *valaddr,
 		      int embedded_offset, CORE_ADDR address,
 		      struct ui_file *stream, int recurse,
 		      const struct value_print_options *options,
@@ -623,8 +658,8 @@ extern int common_val_print (struct valu
 			     const struct value_print_options *options,
 			     const struct language_defn *language);
 
-extern int val_print_string (struct type *elttype, CORE_ADDR addr, int len,
-			     struct ui_file *stream,
+extern int val_print_string (struct type *elttype, struct gdbarch *gdbarch,
+			     CORE_ADDR addr, int len, struct ui_file *stream,
 			     const struct value_print_options *options);
 
 extern void print_variable_and_value (const char *name,
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 gdbarch *, char *, LONGEST, int, int);
 
 static struct type *desc_base_type (struct type *);
 
@@ -168,10 +168,11 @@ static struct type *to_fixed_variant_bra
 						  const gdb_byte *,
                                                   CORE_ADDR, struct value *);
 
-static struct type *to_fixed_array_type (struct type *, struct value *, int);
+static struct type *to_fixed_array_type (struct type *, struct gdbarch *,
+					 struct value *, int);
 
-static struct type *to_fixed_range_type (char *, struct value *,
-                                         struct objfile *);
+static struct type *to_fixed_range_type (char *, struct gdbarch *,
+					 struct value *, struct objfile *);
 
 static struct type *to_static_fixed_type (struct type *);
 static struct type *static_unwrap_type (struct type *type);
@@ -187,12 +188,13 @@ 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 (struct gdbarch *, gdb_byte *, int,
+		       const gdb_byte *, int, int);
 
 static struct value *coerce_unspec_val_to_type (struct value *,
                                                 struct type *);
 
-static struct value *get_var_value (char *, char *);
+static struct value *get_var_value (struct gdbarch *, char *, char *);
 
 static int lesseq_defined_than (struct symbol *, struct symbol *);
 
@@ -222,7 +224,8 @@ static struct value *ada_value_primitive
 static int find_struct_field (char *, struct type *, int,
                               struct type **, int *, int *, int *, int *);
 
-static struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR,
+static struct value *ada_to_fixed_value_create (struct type *,
+						struct gdbarch *, CORE_ADDR,
                                                 struct value *);
 
 static struct value *ada_to_fixed_value (struct value *);
@@ -481,7 +484,7 @@ coerce_unspec_val_to_type (struct value 
          trying to allocate some memory for it.  */
       check_size (type);
 
-      result = allocate_value (type);
+      result = allocate_value (type, value_arch (val));
       set_value_component_location (result, val);
       set_value_bitsize (result, value_bitsize (val));
       set_value_bitpos (result, value_bitpos (val));
@@ -1219,9 +1222,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 gdbarch *gdbarch, char *addr,
+		      LONGEST fieldval, int bitpos, int bitsize)
 {
-  modify_field (addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
+  modify_field (gdbarch, addr + bitpos / 8, fieldval, bitpos % 8, bitsize);
 }
 
 
@@ -1287,7 +1291,8 @@ thin_data_pntr (struct value *val)
   if (TYPE_CODE (type) == TYPE_CODE_PTR)
     return value_cast (data_type, value_copy (val));
   else
-    return value_from_longest (data_type, value_address (val));
+    return value_from_longest (data_type, value_arch (val),
+			       value_address (val));
 }
 
 /* True iff TYPE indicates a "thick" array pointer type.  */
@@ -1356,6 +1361,7 @@ desc_bounds (struct value *arr)
 
       return
         value_from_longest (lookup_pointer_type (bounds_type),
+			    value_arch (arr),
                             addr - TYPE_LENGTH (bounds_type));
     }
 
@@ -1831,7 +1837,7 @@ decode_packed_array (struct value *arr)
       return NULL;
     }
 
-  if (gdbarch_bits_big_endian (current_gdbarch)
+  if (gdbarch_bits_big_endian (value_arch (arr))
       && ada_is_modular_type (value_type (arr)))
     {
        /* This is a (right-justified) modular type representing a packed
@@ -1853,7 +1859,7 @@ decode_packed_array (struct value *arr)
 					    bit_pos / HOST_CHAR_BIT,
 					    bit_pos % HOST_CHAR_BIT,
 					    bit_size,
-					    type);
+					    type, value_arch (arr));
     }
 
   return coerce_unspec_val_to_type (arr, type);
@@ -1904,8 +1910,8 @@ value_subscript_packed (struct value *ar
   elt_off = elt_total_bit_offset / HOST_CHAR_BIT;
   bit_off = elt_total_bit_offset % HOST_CHAR_BIT;
 
-  v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off,
-                                      bits, elt_type);
+  v = ada_value_primitive_packed_val (arr, NULL, elt_off, bit_off, bits,
+				      elt_type, value_arch (arr));
   return v;
 }
 
@@ -1938,7 +1944,7 @@ has_negatives (struct type *type)
 struct value *
 ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
 				long offset, int bit_offset, int bit_size,
-                                struct type *type)
+				struct type *type, struct gdbarch *gdbarch)
 {
   struct value *v;
   int src,                      /* Index into the source area */
@@ -1955,25 +1961,25 @@ 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 (gdbarch) ? -1 : 1;
 
   type = ada_check_typedef (type);
 
   if (obj == NULL)
     {
-      v = allocate_value (type);
+      v = allocate_value (type, gdbarch);
       bytes = (unsigned char *) (valaddr + offset);
     }
   else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj))
     {
-      v = value_at (type,
+      v = value_at (type, gdbarch,
                     value_address (obj) + offset);
       bytes = (unsigned char *) alloca (len);
       read_memory (value_address (v), bytes, len);
     }
   else
     {
-      v = allocate_value (type);
+      v = allocate_value (type, gdbarch);
       bytes = (unsigned char *) value_contents (obj) + offset;
     }
 
@@ -2004,7 +2010,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 (gdbarch))
     {
       src = len - 1;
       if (has_negatives (type)
@@ -2089,8 +2095,8 @@ ada_value_primitive_packed_val (struct v
    TARGET, starting at bit offset TARG_OFFSET.  SOURCE and TARGET must
    not overlap.  */
 static void
-move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source,
-	   int src_offset, int n)
+move_bits (struct gdbarch *gdbarch, gdb_byte *target, int targ_offset,
+	   const gdb_byte *source, int src_offset, int n)
 {
   unsigned int accum, mask;
   int accum_bits, chunk_size;
@@ -2099,7 +2105,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 (gdbarch_bits_big_endian (gdbarch))
     {
       accum = (unsigned char) *source;
       source += 1;
@@ -2191,12 +2197,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))
-        move_bits (buffer, value_bitpos (toval),
+      if (gdbarch_bits_big_endian (value_arch (toval)))
+        move_bits (value_arch (toval), buffer, value_bitpos (toval),
 		   value_contents (fromval), from_size - bits, bits);
       else
-        move_bits (buffer, value_bitpos (toval), value_contents (fromval),
-                   0, bits);
+        move_bits (value_arch (toval), buffer, value_bitpos (toval),
+		   value_contents (fromval), 0, bits);
       write_memory (to_addr, buffer, len);
       if (deprecated_memory_changed_hook)
 	deprecated_memory_changed_hook (to_addr, len);
@@ -2235,14 +2241,16 @@ value_assign_to_component (struct value 
   else
     bits = value_bitsize (component);
 
-  if (gdbarch_bits_big_endian (current_gdbarch))
-    move_bits (value_contents_writeable (container) + offset_in_container, 
+  if (gdbarch_bits_big_endian (value_arch (container)))
+    move_bits (value_arch (container),
+	       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);
   else
-    move_bits (value_contents_writeable (container) + offset_in_container, 
+    move_bits (value_arch (container),
+	       value_contents_writeable (container) + offset_in_container,
 	       value_bitpos (container) + bit_offset_in_container,
 	       value_contents (val), 0, bits);
 }	       
@@ -2296,7 +2304,8 @@ ada_value_ptr_subscript (struct value *a
       get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb);
       idx = value_pos_atr (builtin_type_int32, ind[k]);
       if (lwb != 0)
-	idx = value_binop (idx, value_from_longest (value_type (idx), lwb),
+	idx = value_binop (idx, value_from_longest (value_type (idx),
+						    value_arch (idx), lwb),
 			   BINOP_SUB);
 
       arr = value_ptradd (arr, idx);
@@ -2322,7 +2331,7 @@ ada_value_slice_from_ptr (struct value *
                        low, high);
   struct type *slice_type =
     create_array_type (NULL, TYPE_TARGET_TYPE (type), index_type);
-  return value_at_lazy (slice_type, base);
+  return value_at_lazy (slice_type, value_arch (array_ptr), base);
 }
 
 
@@ -2449,8 +2458,8 @@ ada_index_type (struct type *type, int n
    run-time quantities other than discriminants.  */
 
 static LONGEST
-ada_array_bound_from_type (struct type * arr_type, int n, int which,
-                           struct type ** typep)
+ada_array_bound_from_type (struct type *arr_type, struct gdbarch *gdbarch,
+			   int n, int which, struct type **typep)
 {
   struct type *type, *index_type_desc, *index_type;
   LONGEST retval;
@@ -2475,7 +2484,7 @@ ada_array_bound_from_type (struct type *
   index_type_desc = ada_find_parallel_type (type, "___XA");
   if (index_type_desc != NULL)
     index_type = to_fixed_range_type (TYPE_FIELD_NAME (index_type_desc, n - 1),
-				      NULL, TYPE_OBJFILE (arr_type));
+				      gdbarch, NULL, TYPE_OBJFILE (arr_type));
   else
     {
       while (n > 1)
@@ -2523,8 +2532,9 @@ ada_array_bound (struct value *arr, int 
   else if (ada_is_simple_array_type (arr_type))
     {
       struct type *type;
-      LONGEST v = ada_array_bound_from_type (arr_type, n, which, &type);
-      return value_from_longest (type, v);
+      LONGEST v = ada_array_bound_from_type (arr_type, value_arch (arr),
+					     n, which, &type);
+      return value_from_longest (type, value_arch (arr), v);
     }
   else
     return desc_one_bound (desc_bounds (arr), n, which);
@@ -2548,13 +2558,13 @@ ada_array_length (struct value *arr, int
     {
       struct type *type;
       LONGEST v =
-        ada_array_bound_from_type (arr_type, n, 1, &type) -
-        ada_array_bound_from_type (arr_type, n, 0, NULL) + 1;
-      return value_from_longest (type, v);
+        ada_array_bound_from_type (arr_type, value_arch (arr), n, 1, &type) -
+        ada_array_bound_from_type (arr_type, value_arch (arr), n, 0, NULL) + 1;
+      return value_from_longest (type, value_arch (arr), v);
     }
   else
     return
-      value_from_longest (builtin_type_int32,
+      value_from_longest (builtin_type_int32, value_arch (arr),
                           value_as_long (desc_one_bound (desc_bounds (arr),
                                                          n, 1))
                           - value_as_long (desc_one_bound (desc_bounds (arr),
@@ -2565,13 +2575,14 @@ ada_array_length (struct value *arr, int
    with bounds LOW to LOW-1.  */
 
 static struct value *
-empty_array (struct type *arr_type, int low)
+empty_array (struct type *arr_type, struct gdbarch *gdbarch, int low)
 {
   struct type *index_type =
     create_range_type (NULL, TYPE_TARGET_TYPE (TYPE_INDEX_TYPE (arr_type)),
                        low, low - 1);
   struct type *elt_type = ada_array_element_type (arr_type, 1);
-  return allocate_value (create_array_type (NULL, elt_type, index_type));
+  return allocate_value (create_array_type (NULL, elt_type, index_type),
+			 gdbarch);
 }
 
 
@@ -3757,30 +3768,31 @@ ensure_lval (struct value *val, CORE_ADD
 {
   if (! VALUE_LVAL (val))
     {
+      struct gdbarch *gdbarch = value_arch (val);
       int len = TYPE_LENGTH (ada_check_typedef (value_type (val)));
 
       /* The following is taken from the structure-return code in
 	 call_function_by_hand. FIXME: Therefore, some refactoring seems 
 	 indicated. */
-      if (gdbarch_inner_than (current_gdbarch, 1, 2))
+      if (gdbarch_inner_than (gdbarch, 1, 2))
 	{
 	  /* Stack grows downward.  Align SP and value_address (val) after
 	     reserving sufficient space. */
 	  *sp -= len;
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	  set_value_address (val, *sp);
 	}
       else
 	{
 	  /* Stack grows upward.  Align the frame, allocate space, and
 	     then again, re-align the frame. */
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	  set_value_address (val, *sp);
 	  *sp += len;
-	  if (gdbarch_frame_align_p (current_gdbarch))
-	    *sp = gdbarch_frame_align (current_gdbarch, *sp);
+	  if (gdbarch_frame_align_p (gdbarch))
+	    *sp = gdbarch_frame_align (gdbarch, *sp);
 	}
       VALUE_LVAL (val) = lval_memory;
 
@@ -3824,7 +3836,7 @@ ada_convert_actual (struct value *actual
             {
               struct value *val;
               actual_type = ada_check_typedef (value_type (actual));
-              val = allocate_value (actual_type);
+              val = allocate_value (actual_type, value_arch (actual));
               memcpy ((char *) value_contents_raw (val),
                       (char *) value_contents (actual),
                       TYPE_LENGTH (actual_type));
@@ -3854,17 +3866,19 @@ make_array_descriptor (struct type *type
 {
   struct type *bounds_type = desc_bounds_type (type);
   struct type *desc_type = desc_base_type (type);
-  struct value *descriptor = allocate_value (desc_type);
-  struct value *bounds = allocate_value (bounds_type);
+  struct value *descriptor = allocate_value (desc_type, value_arch (arr));
+  struct value *bounds = allocate_value (bounds_type, value_arch (arr));
   int i;
 
   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_arch (bounds),
+			    value_contents_writeable (bounds),
                             value_as_long (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_arch (bounds),
+			    value_contents_writeable (bounds),
                             value_as_long (ada_array_bound (arr, i, 1)),
                             desc_bound_bitpos (bounds_type, i, 1),
                             desc_bound_bitsize (bounds_type, i, 1));
@@ -3872,12 +3886,14 @@ make_array_descriptor (struct type *type
 
   bounds = ensure_lval (bounds, sp);
 
-  modify_general_field (value_contents_writeable (descriptor),
+  modify_general_field (value_arch (descriptor),
+			value_contents_writeable (descriptor),
                         value_address (ensure_lval (arr, sp)),
                         fat_pntr_data_bitpos (desc_type),
                         fat_pntr_data_bitsize (desc_type));
 
-  modify_general_field (value_contents_writeable (descriptor),
+  modify_general_field (value_arch (descriptor),
+			value_contents_writeable (descriptor),
                         value_address (bounds),
                         fat_pntr_bounds_bitpos (desc_type),
                         fat_pntr_bounds_bitsize (desc_type));
@@ -5479,6 +5495,7 @@ ada_value_tag (struct value *val)
 
 static struct value *
 value_tag_from_contents_and_address (struct type *type,
+				     struct gdbarch *gdbarch,
 				     const gdb_byte *valaddr,
                                      CORE_ADDR address)
 {
@@ -5492,7 +5509,8 @@ value_tag_from_contents_and_address (str
 				  : valaddr + tag_byte_offset);
       CORE_ADDR address1 = (address == 0) ? 0 : address + tag_byte_offset;
 
-      return value_from_contents_and_address (tag_type, valaddr1, address1);
+      return value_from_contents_and_address (tag_type, gdbarch,
+					      valaddr1, address1);
     }
   return NULL;
 }
@@ -5565,7 +5583,8 @@ ada_tag_name_2 (struct tag_args *args)
   if (valp == NULL)
     return 0;
   val = value_ind (value_ptradd (valp,
-				 value_from_longest (builtin_type_int8, -1)));
+				 value_from_longest (builtin_type_int8,
+						     value_arch (valp), -1)));
   if (val == NULL)
     return 0;
   val = ada_value_struct_elt (val, "expanded_name", 1);
@@ -5859,7 +5878,8 @@ ada_value_primitive_field (struct value 
 
       return ada_value_primitive_packed_val (arg1, value_contents (arg1),
                                              offset + bit_pos / 8,
-                                             bit_pos % 8, bit_size, type);
+                                             bit_pos % 8, bit_size,
+					     type, value_arch (arg1));
     }
   else
     return value_primitive_field (arg1, offset, fieldno, arg_type);
@@ -6137,7 +6157,8 @@ ada_value_struct_elt (struct value *arg,
       else
         address = unpack_pointer (t, value_contents (arg));
 
-      t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL, 1);
+      t1 = ada_to_fixed_type (ada_get_base_type (t1), value_arch (arg),
+			      NULL, address, NULL, 1);
       if (find_struct_field (name, t1, 0,
                              &field_type, &byte_offset, &bit_offset,
                              &bit_size, NULL))
@@ -6150,10 +6171,12 @@ ada_value_struct_elt (struct value *arg,
                 arg = ada_value_ind (arg);
               v = ada_value_primitive_packed_val (arg, NULL, byte_offset,
                                                   bit_offset, bit_size,
-                                                  field_type);
+                                                  field_type,
+						  value_arch (arg));
             }
           else
-            v = value_at_lazy (field_type, address + byte_offset);
+            v = value_at_lazy (field_type, value_arch (arg),
+			       address + byte_offset);
         }
     }
 
@@ -6334,6 +6357,7 @@ is_unchecked_variant (struct type *var_t
 
 int
 ada_which_variant_applies (struct type *var_type, struct type *outer_type,
+			   struct gdbarch *outer_gdbarch,
                            const gdb_byte *outer_valaddr)
 {
   int others_clause;
@@ -6343,7 +6367,8 @@ ada_which_variant_applies (struct type *
   struct value *discrim;
   LONGEST discrim_val;
 
-  outer = value_from_contents_and_address (outer_type, outer_valaddr, 0);
+  outer = value_from_contents_and_address
+	    (outer_type, outer_gdbarch, outer_valaddr, 0);
   discrim = ada_value_struct_elt (outer, discrim_name, 1);
   if (discrim == NULL)
     return -1;
@@ -6727,6 +6752,7 @@ empty_record (struct objfile *objfile)
 
 struct type *
 ada_template_to_fixed_record_type_1 (struct type *type,
+				     struct gdbarch *gdbarch,
 				     const gdb_byte *valaddr,
                                      CORE_ADDR address, struct value *dval0,
                                      int keep_dynamic_fields)
@@ -6791,7 +6817,8 @@ ada_template_to_fixed_record_type_1 (str
 		 GDB may fail to allocate a value for it. So check the
 		 size first before creating the value.  */
 	      check_size (rtype);
-	      dval = value_from_contents_and_address (rtype, valaddr, address);
+	      dval = value_from_contents_and_address (rtype, gdbarch,
+						      valaddr, address);
 	    }
           else
             dval = dval0;
@@ -6804,8 +6831,8 @@ ada_template_to_fixed_record_type_1 (str
              loop.  */
           TYPE_FIELD_TYPE (rtype, f) =
             ada_to_fixed_type
-            (ada_get_base_type
-             (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f))),
+            (ada_get_base_type (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, f))),
+             gdbarch,
              cond_offset_host (valaddr, off / TARGET_CHAR_BIT),
              cond_offset_target (address, off / TARGET_CHAR_BIT), dval, 0);
           TYPE_FIELD_NAME (rtype, f) = TYPE_FIELD_NAME (type, f);
@@ -6841,7 +6868,8 @@ ada_template_to_fixed_record_type_1 (str
       off = TYPE_FIELD_BITPOS (rtype, variant_field);
 
       if (dval0 == NULL)
-        dval = value_from_contents_and_address (rtype, valaddr, address);
+	dval = value_from_contents_and_address (rtype, gdbarch,
+						valaddr, address);
       else
         dval = dval0;
 
@@ -6901,10 +6929,11 @@ ada_template_to_fixed_record_type_1 (str
    of 1.  */
 
 static struct type *
-template_to_fixed_record_type (struct type *type, const gdb_byte *valaddr,
-                               CORE_ADDR address, struct value *dval0)
+template_to_fixed_record_type (struct type *type, struct gdbarch *gdbarch,
+			       const gdb_byte *valaddr, CORE_ADDR address,
+			       struct value *dval0)
 {
-  return ada_template_to_fixed_record_type_1 (type, valaddr,
+  return ada_template_to_fixed_record_type_1 (type, gdbarch, valaddr,
                                               address, dval0, 1);
 }
 
@@ -6968,8 +6997,9 @@ template_to_static_fixed_type (struct ty
    contains the necessary discriminant values.  */
 
 static struct type *
-to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr,
-                                   CORE_ADDR address, struct value *dval0)
+to_record_with_fixed_variant_part (struct type *type, struct gdbarch *gdbarch,
+				   const gdb_byte *valaddr, CORE_ADDR address,
+				   struct value *dval0)
 {
   struct value *mark = value_mark ();
   struct value *dval;
@@ -6982,7 +7012,7 @@ to_record_with_fixed_variant_part (struc
     return type;
 
   if (dval0 == NULL)
-    dval = value_from_contents_and_address (type, valaddr, address);
+    dval = value_from_contents_and_address (type, gdbarch, valaddr, address);
   else
     dval = dval0;
 
@@ -7046,8 +7076,9 @@ to_record_with_fixed_variant_part (struc
    shortcut and suspect the compiler should be altered.  FIXME.  */
 
 static struct type *
-to_fixed_record_type (struct type *type0, const gdb_byte *valaddr,
-                      CORE_ADDR address, struct value *dval)
+to_fixed_record_type (struct type *type0, struct gdbarch *gdbarch,
+		      const gdb_byte *valaddr, CORE_ADDR address,
+		      struct value *dval)
 {
   struct type *templ_type;
 
@@ -7057,13 +7088,14 @@ to_fixed_record_type (struct type *type0
   templ_type = dynamic_template_type (type0);
 
   if (templ_type != NULL)
-    return template_to_fixed_record_type (templ_type, valaddr, address, dval);
+    return template_to_fixed_record_type (templ_type, gdbarch,
+					  valaddr, address, dval);
   else if (variant_field_index (type0) >= 0)
     {
       if (dval == NULL && valaddr == NULL && address == 0)
         return type0;
-      return to_record_with_fixed_variant_part (type0, valaddr, address,
-                                                dval);
+      return to_record_with_fixed_variant_part (type0, gdbarch,
+						valaddr, address, dval);
     }
   else
     {
@@ -7101,20 +7133,20 @@ to_fixed_variant_branch_type (struct typ
 
   if (is_unchecked_variant (var_type, value_type (dval)))
       return var_type0;
-  which =
-    ada_which_variant_applies (var_type,
-                               value_type (dval), value_contents (dval));
+  which = ada_which_variant_applies (var_type,
+				     value_type (dval), value_arch (dval),
+				     value_contents (dval));
 
   if (which < 0)
     return empty_record (TYPE_OBJFILE (var_type));
   else if (is_dynamic_field (var_type, which))
     return to_fixed_record_type
-      (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (var_type, which)),
-       valaddr, address, dval);
+	    (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (var_type, which)),
+	     value_arch (dval), valaddr, address, dval);
   else if (variant_field_index (TYPE_FIELD_TYPE (var_type, which)) >= 0)
-    return
-      to_fixed_record_type
-      (TYPE_FIELD_TYPE (var_type, which), valaddr, address, dval);
+    return to_fixed_record_type
+	     (TYPE_FIELD_TYPE (var_type, which),
+	      value_arch (dval), valaddr, address, dval);
   else
     return TYPE_FIELD_TYPE (var_type, which);
 }
@@ -7128,8 +7160,8 @@ to_fixed_variant_branch_type (struct typ
    varsize_limit.  */
 
 static struct type *
-to_fixed_array_type (struct type *type0, struct value *dval,
-                     int ignore_too_big)
+to_fixed_array_type (struct type *type0, struct gdbarch *gdbarch,
+		     struct value *dval, int ignore_too_big)
 {
   struct type *index_type_desc;
   struct type *result;
@@ -7153,7 +7185,8 @@ to_fixed_array_type (struct type *type0,
          the elements of an array of a tagged type should all be of
          the same type specified in the debugging info.  No need to
          consult the object tag.  */
-      struct type *elt_type = ada_to_fixed_type (elt_type0, 0, 0, dval, 1);
+      struct type *elt_type
+	= ada_to_fixed_type (elt_type0, gdbarch, 0, 0, dval, 1);
 
       if (elt_type0 == elt_type)
         result = type0;
@@ -7181,13 +7214,13 @@ to_fixed_array_type (struct type *type0,
          the elements of an array of a tagged type should all be of
          the same type specified in the debugging info.  No need to
          consult the object tag.  */
-      result =
-        ada_to_fixed_type (ada_check_typedef (elt_type0), 0, 0, dval, 1);
+      result = ada_to_fixed_type (ada_check_typedef (elt_type0),
+				  gdbarch, 0, 0, dval, 1);
       for (i = TYPE_NFIELDS (index_type_desc) - 1; i >= 0; i -= 1)
         {
           struct type *range_type =
             to_fixed_range_type (TYPE_FIELD_NAME (index_type_desc, i),
-                                 dval, TYPE_OBJFILE (type0));
+                                 gdbarch, dval, TYPE_OBJFILE (type0));
           result = create_array_type (alloc_type (TYPE_OBJFILE (type0)),
                                       result, range_type);
         }
@@ -7213,8 +7246,9 @@ to_fixed_array_type (struct type *type0,
    So we return the tagged type without consulting the tag.  */
    
 static struct type *
-ada_to_fixed_type_1 (struct type *type, const gdb_byte *valaddr,
-                   CORE_ADDR address, struct value *dval, int check_tag)
+ada_to_fixed_type_1 (struct type *type, struct gdbarch *gdbarch,
+		     const gdb_byte *valaddr, CORE_ADDR address,
+		     struct value *dval, int check_tag)
 {
   type = ada_check_typedef (type);
   switch (TYPE_CODE (type))
@@ -7225,7 +7259,7 @@ ada_to_fixed_type_1 (struct type *type, 
       {
         struct type *static_type = to_static_fixed_type (type);
         struct type *fixed_record_type =
-          to_fixed_record_type (type, valaddr, address, NULL);
+          to_fixed_record_type (type, gdbarch, valaddr, address, NULL);
         /* If STATIC_TYPE is a tagged type and we know the object's address,
            then we can determine its tag, and compute the object's actual
            type from there. Note that we have to use the fixed record
@@ -7237,11 +7271,11 @@ ada_to_fixed_type_1 (struct type *type, 
           {
             struct type *real_type =
               type_from_tag (value_tag_from_contents_and_address
-                             (fixed_record_type,
-                              valaddr,
-                              address));
+                             (fixed_record_type, gdbarch,
+                              valaddr, address));
             if (real_type != NULL)
-              return to_fixed_record_type (real_type, valaddr, address, NULL);
+              return to_fixed_record_type (real_type, gdbarch,
+					   valaddr, address, NULL);
           }
 
         /* Check to see if there is a parallel ___XVZ variable.
@@ -7286,7 +7320,7 @@ ada_to_fixed_type_1 (struct type *type, 
         return fixed_record_type;
       }
     case TYPE_CODE_ARRAY:
-      return to_fixed_array_type (type, dval, 1);
+      return to_fixed_array_type (type, gdbarch, dval, 1);
     case TYPE_CODE_UNION:
       if (dval == NULL)
         return type;
@@ -7300,12 +7334,13 @@ ada_to_fixed_type_1 (struct type *type, 
    ada_to_fixed_type_1 would return the type referenced by TYPE.  */
 
 struct type *
-ada_to_fixed_type (struct type *type, const gdb_byte *valaddr,
-                   CORE_ADDR address, struct value *dval, int check_tag)
+ada_to_fixed_type (struct type *type, struct gdbarch *gdbarch,
+		   const gdb_byte *valaddr, CORE_ADDR address,
+		   struct value *dval, int check_tag)
 
 {
   struct type *fixed_type =
-    ada_to_fixed_type_1 (type, valaddr, address, dval, check_tag);
+    ada_to_fixed_type_1 (type, gdbarch, valaddr, address, dval, check_tag);
 
   if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF
       && TYPE_TARGET_TYPE (type) == fixed_type)
@@ -7412,14 +7447,14 @@ ada_check_typedef (struct type *type)
    creation of struct values].  */
 
 static struct value *
-ada_to_fixed_value_create (struct type *type0, CORE_ADDR address,
-                           struct value *val0)
+ada_to_fixed_value_create (struct type *type0, struct gdbarch *gdbarch,
+		           CORE_ADDR address, struct value *val0)
 {
-  struct type *type = ada_to_fixed_type (type0, 0, address, NULL, 1);
+  struct type *type = ada_to_fixed_type (type0, gdbarch, 0, address, NULL, 1);
   if (type == type0 && val0 != NULL)
     return val0;
   else
-    return value_from_contents_and_address (type, 0, address);
+    return value_from_contents_and_address (type, gdbarch, 0, address);
 }
 
 /* A value representing VAL, but with a standard (static-sized) type
@@ -7429,7 +7464,7 @@ ada_to_fixed_value_create (struct type *
 static struct value *
 ada_to_fixed_value (struct value *val)
 {
-  return ada_to_fixed_value_create (value_type (val),
+  return ada_to_fixed_value_create (value_type (val), value_arch (val),
                                     value_address (val),
                                     val);
 }
@@ -7512,7 +7547,7 @@ pos_atr (struct value *arg)
 static struct value *
 value_pos_atr (struct type *type, struct value *arg)
 {
-  return value_from_longest (type, pos_atr (arg));
+  return value_from_longest (type, value_arch (arg), pos_atr (arg));
 }
 
 /* Evaluate the TYPE'VAL attribute applied to ARG.  */
@@ -7530,10 +7565,11 @@ value_val_atr (struct type *type, struct
       long pos = value_as_long (arg);
       if (pos < 0 || pos >= TYPE_NFIELDS (type))
         error (_("argument to 'VAL out of range"));
-      return value_from_longest (type, TYPE_FIELD_BITPOS (type, pos));
+      return value_from_longest (type, value_arch (arg),
+				 TYPE_FIELD_BITPOS (type, pos));
     }
   else
-    return value_from_longest (type, value_as_long (arg));
+    return value_from_longest (type, value_arch (arg), value_as_long (arg));
 }
 
 
@@ -7775,7 +7811,7 @@ unwrap_value (struct value *val)
 
       return
         coerce_unspec_val_to_type
-        (val, ada_to_fixed_type (raw_real_type, 0,
+        (val, ada_to_fixed_type (raw_real_type, value_arch (val), 0,
                                  value_address (val),
                                  NULL, 1));
     }
@@ -7798,7 +7834,7 @@ cast_to_fixed (struct type *type, struct
       val = ada_float_to_fixed (type, argd);
     }
 
-  return value_from_longest (type, val);
+  return value_from_longest (type, value_arch (arg), val);
 }
 
 static struct value *
@@ -7806,7 +7842,7 @@ cast_from_fixed (struct type *type, stru
 {
   DOUBLEST val = ada_fixed_to_float (value_type (arg),
                                      value_as_long (arg));
-  return value_from_double (type, val);
+  return value_from_double (type, value_arch (arg), val);
 }
 
 /* Coerce VAL as necessary for assignment to an lval of type TYPE, and
@@ -7892,7 +7928,7 @@ ada_value_binop (struct value *arg1, str
       v = 0;
     }
 
-  val = allocate_value (type1);
+  val = allocate_value (type1, value_arch (arg1));
   store_unsigned_integer (value_contents_raw (val),
                           TYPE_LENGTH (value_type (val)), v);
   return val;
@@ -7966,7 +8002,8 @@ assign_component (struct value *containe
   struct value *elt;
   if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY)
     {
-      struct value *index_val = value_from_longest (builtin_type_int32, index);
+      struct value *index_val
+	= value_from_longest (builtin_type_int32, value_arch (lhs), index);
       elt = unwrap_value (ada_value_subscript (lhs, 1, &index_val));
     }
   else
@@ -8362,7 +8399,7 @@ ada_evaluate_subexp (struct type *expect
         goto nosideret;
       if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
         return (value_from_longest
-                 (value_type (arg1),
+                 (value_type (arg1), value_arch (arg1),
                   value_as_long (arg1) + value_as_long (arg2)));
       if ((ada_is_fixed_point_type (value_type (arg1))
            || ada_is_fixed_point_type (value_type (arg2)))
@@ -8384,7 +8421,7 @@ ada_evaluate_subexp (struct type *expect
         goto nosideret;
       if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
         return (value_from_longest
-                 (value_type (arg1),
+                 (value_type (arg1), value_arch (arg1),
                   value_as_long (arg1) - value_as_long (arg2)));
       if ((ada_is_fixed_point_type (value_type (arg1))
            || ada_is_fixed_point_type (value_type (arg2)))
@@ -8410,7 +8447,7 @@ ada_evaluate_subexp (struct type *expect
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
         {
           binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
-          return value_zero (value_type (arg1), not_lval);
+          return value_zero (value_type (arg1), value_arch (arg1), not_lval);
         }
       else
         {
@@ -8439,7 +8476,7 @@ ada_evaluate_subexp (struct type *expect
       if (op == BINOP_NOTEQUAL)
         tem = !tem;
       type = language_bool_type (exp->language_defn, exp->gdbarch);
-      return value_from_longest (type, (LONGEST) tem);
+      return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 
     case UNOP_NEG:
       arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
@@ -8526,14 +8563,14 @@ ada_evaluate_subexp (struct type *expect
                  incomplete, for instance.  */
               actual_type = type;
 
-            return value_zero (actual_type, not_lval);
+            return value_zero (actual_type, value_arch (arg1), not_lval);
           }
 
           *pos += 4;
           return value_zero
             (to_static_fixed_type
              (static_unwrap_type (SYMBOL_TYPE (exp->elts[pc + 2].symbol))),
-             not_lval);
+             exp->gdbarch, not_lval);
         }
       else
         {
@@ -8599,7 +8636,7 @@ ada_evaluate_subexp (struct type *expect
         {
         case TYPE_CODE_FUNC:
           if (noside == EVAL_AVOID_SIDE_EFFECTS)
-            return allocate_value (TYPE_TARGET_TYPE (type));
+            return allocate_value (TYPE_TARGET_TYPE (type), exp->gdbarch);
           return call_function_by_hand (argvec[0], nargs, argvec + 1);
         case TYPE_CODE_STRUCT:
           {
@@ -8612,7 +8649,8 @@ ada_evaluate_subexp (struct type *expect
             if (arity != nargs)
               error (_("wrong number of subscripts; expecting %d"), arity);
             if (noside == EVAL_AVOID_SIDE_EFFECTS)
-              return value_zero (ada_aligned_type (type), lval_memory);
+              return value_zero (ada_aligned_type (type),
+				 exp->gdbarch, lval_memory);
             return
               unwrap_value (ada_value_subscript
                             (argvec[0], nargs, argvec + 1));
@@ -8624,21 +8662,24 @@ ada_evaluate_subexp (struct type *expect
               if (type == NULL)
                 error (_("element type of array unknown"));
               else
-                return value_zero (ada_aligned_type (type), lval_memory);
+                return value_zero (ada_aligned_type (type),
+				   exp->gdbarch, lval_memory);
             }
           return
             unwrap_value (ada_value_subscript
                           (ada_coerce_to_simple_array (argvec[0]),
                            nargs, argvec + 1));
         case TYPE_CODE_PTR:     /* Pointer to array */
-          type = to_fixed_array_type (TYPE_TARGET_TYPE (type), NULL, 1);
+          type = to_fixed_array_type (TYPE_TARGET_TYPE (type),
+				      value_arch (argvec[0]), NULL, 1);
           if (noside == EVAL_AVOID_SIDE_EFFECTS)
             {
               type = ada_array_element_type (type, nargs);
               if (type == NULL)
                 error (_("element type of array unknown"));
               else
-                return value_zero (ada_aligned_type (type), lval_memory);
+                return value_zero (ada_aligned_type (type),
+				   exp->gdbarch, lval_memory);
             }
           return
             unwrap_value (ada_value_ptr_subscript (argvec[0], type,
@@ -8686,7 +8727,8 @@ ada_evaluate_subexp (struct type *expect
         if (noside == EVAL_AVOID_SIDE_EFFECTS
             && ada_is_array_descriptor_type (ada_check_typedef
                                              (value_type (array))))
-          return empty_array (ada_type_of_array (array, 0), low_bound);
+          return empty_array (ada_type_of_array (array, 0),
+			      value_arch (array), low_bound);
 
         array = ada_coerce_to_simple_array_ptr (array);
 
@@ -8708,12 +8750,12 @@ ada_evaluate_subexp (struct type *expect
           {
             if (high_bound < low_bound || noside == EVAL_AVOID_SIDE_EFFECTS)
               return empty_array (TYPE_TARGET_TYPE (value_type (array)),
-                                  low_bound);
+                                  value_arch (array), low_bound);
             else
               {
                 struct type *arr_type0 =
                   to_fixed_array_type (TYPE_TARGET_TYPE (value_type (array)),
-                                       NULL, 1);
+                                       value_arch (array), NULL, 1);
                 return ada_value_slice_from_ptr (array, arr_type0,
                                                  longest_to_int (low_bound),
                                                  longest_to_int (high_bound));
@@ -8722,7 +8764,8 @@ ada_evaluate_subexp (struct type *expect
         else if (noside == EVAL_AVOID_SIDE_EFFECTS)
           return array;
         else if (high_bound < low_bound)
-          return empty_array (value_type (array), low_bound);
+          return empty_array (value_type (array),
+			      value_arch (array), low_bound);
         else
           return ada_value_slice (array, longest_to_int (low_bound),
 				  longest_to_int (high_bound));
@@ -8742,16 +8785,16 @@ ada_evaluate_subexp (struct type *expect
           lim_warning (_("Membership test incompletely implemented; "
 			 "always returns true"));
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) 1);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) 1);
 
         case TYPE_CODE_RANGE:
-	  arg2 = value_from_longest (type, TYPE_LOW_BOUND (type));
-	  arg3 = value_from_longest (type, TYPE_HIGH_BOUND (type));
+	  arg2 = value_from_longest (type, exp->gdbarch, TYPE_LOW_BOUND (type));
+	  arg3 = value_from_longest (type, exp->gdbarch, TYPE_HIGH_BOUND (type));
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
 	  return
-	    value_from_longest (type,
+	    value_from_longest (type, exp->gdbarch,
                                 (value_less (arg1, arg3)
                                  || value_equal (arg1, arg3))
                                 && (value_less (arg2, arg1)
@@ -8769,7 +8812,7 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	{
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_zero (type, not_lval);
+	  return value_zero (type, exp->gdbarch, not_lval);
 	}
 
       tem = longest_to_int (exp->elts[pc + 1].longconst);
@@ -8784,7 +8827,7 @@ ada_evaluate_subexp (struct type *expect
       binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
       type = language_bool_type (exp->language_defn, exp->gdbarch);
       return
-        value_from_longest (type,
+        value_from_longest (type, exp->gdbarch,
                             (value_less (arg1, arg3)
                              || value_equal (arg1, arg3))
                             && (value_less (arg2, arg1)
@@ -8802,7 +8845,7 @@ ada_evaluate_subexp (struct type *expect
       binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
       type = language_bool_type (exp->language_defn, exp->gdbarch);
       return
-        value_from_longest (type,
+        value_from_longest (type, exp->gdbarch,
                             (value_less (arg1, arg3)
                              || value_equal (arg1, arg3))
                             && (value_less (arg2, arg1)
@@ -8850,7 +8893,7 @@ ada_evaluate_subexp (struct type *expect
                 if (type == NULL)
                   error
                     (_("attempt to take bound of something that is not an array"));
-                return allocate_value (type);
+                return allocate_value (type, exp->gdbarch);
               }
 
             switch (op)
@@ -8872,7 +8915,8 @@ ada_evaluate_subexp (struct type *expect
             range_type = NULL;
             if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
               range_type =
-                to_fixed_range_type (name, NULL, TYPE_OBJFILE (type_arg));
+                to_fixed_range_type (name, exp->gdbarch, NULL,
+				     TYPE_OBJFILE (type_arg));
             if (range_type == NULL)
               range_type = type_arg;
             switch (op)
@@ -8880,11 +8924,11 @@ ada_evaluate_subexp (struct type *expect
               default:
                 error (_("unexpected attribute encountered"));
               case OP_ATR_FIRST:
-		return value_from_longest 
-		  (range_type, discrete_type_low_bound (range_type));
+		return value_from_longest (range_type, exp->gdbarch,
+					   discrete_type_low_bound (range_type));
               case OP_ATR_LAST:
-                return value_from_longest
-		  (range_type, discrete_type_high_bound (range_type));
+                return value_from_longest (range_type, exp->gdbarch,
+					   discrete_type_high_bound (range_type));
               case OP_ATR_LENGTH:
                 error (_("the 'length attribute applies only to array types"));
               }
@@ -8907,22 +8951,26 @@ ada_evaluate_subexp (struct type *expect
               error
                 (_("attempt to take bound of something that is not an array"));
             if (noside == EVAL_AVOID_SIDE_EFFECTS)
-              return allocate_value (type);
+              return allocate_value (type, exp->gdbarch);
 
             switch (op)
               {
               default:
                 error (_("unexpected attribute encountered"));
               case OP_ATR_FIRST:
-                low = ada_array_bound_from_type (type_arg, tem, 0, &type);
-                return value_from_longest (type, low);
+                low = ada_array_bound_from_type
+			(type_arg, exp->gdbarch, tem, 0, &type);
+                return value_from_longest (type, exp->gdbarch, low);
               case OP_ATR_LAST:
-                high = ada_array_bound_from_type (type_arg, tem, 1, &type);
-                return value_from_longest (type, high);
+                high = ada_array_bound_from_type
+			 (type_arg, exp->gdbarch, tem, 1, &type);
+                return value_from_longest (type, exp->gdbarch, high);
               case OP_ATR_LENGTH:
-                low = ada_array_bound_from_type (type_arg, tem, 0, &type);
-                high = ada_array_bound_from_type (type_arg, tem, 1, NULL);
-                return value_from_longest (type, high - low + 1);
+                low = ada_array_bound_from_type
+			(type_arg, exp->gdbarch, tem, 0, &type);
+                high = ada_array_bound_from_type
+			 (type_arg, exp->gdbarch, tem, 1, NULL);
+                return value_from_longest (type, exp->gdbarch, high - low + 1);
               }
           }
       }
@@ -8933,7 +8981,7 @@ ada_evaluate_subexp (struct type *expect
         goto nosideret;
 
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (ada_tag_type (arg1), not_lval);
+        return value_zero (ada_tag_type (arg1), value_arch (arg1), not_lval);
 
       return ada_value_tag (arg1);
 
@@ -8945,7 +8993,7 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (value_type (arg1), not_lval);
+        return value_zero (value_type (arg1), value_arch (arg1), not_lval);
       else
 	{
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
@@ -8964,7 +9012,7 @@ ada_evaluate_subexp (struct type *expect
         if (!ada_is_modular_type (type_arg))
           error (_("'modulus must be applied to modular type"));
 
-        return value_from_longest (TYPE_TARGET_TYPE (type_arg),
+        return value_from_longest (TYPE_TARGET_TYPE (type_arg), exp->gdbarch,
                                    ada_modulus (type_arg));
       }
 
@@ -8976,7 +9024,7 @@ ada_evaluate_subexp (struct type *expect
         goto nosideret;
       type = builtin_type (exp->gdbarch)->builtin_int;
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	return value_zero (type, not_lval);
+	return value_zero (type, exp->gdbarch, not_lval);
       else
 	return value_pos_atr (type, arg1);
 
@@ -8993,9 +9041,9 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (builtin_type_int32, not_lval);
+        return value_zero (builtin_type_int32, exp->gdbarch, not_lval);
       else
-        return value_from_longest (builtin_type_int32,
+        return value_from_longest (builtin_type_int32, exp->gdbarch,
                                    TARGET_CHAR_BIT * TYPE_LENGTH (type));
 
     case OP_ATR_VAL:
@@ -9005,7 +9053,7 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (type, not_lval);
+        return value_zero (type, exp->gdbarch, not_lval);
       else
         return value_val_atr (type, arg1);
 
@@ -9015,7 +9063,7 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return value_zero (value_type (arg1), not_lval);
+        return value_zero (value_type (arg1), value_arch (arg1), not_lval);
       else
 	{
 	  /* For integer exponentiation operations,
@@ -9040,7 +9088,8 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       unop_promote (exp->language_defn, exp->gdbarch, &arg1);
-      if (value_less (arg1, value_zero (value_type (arg1), not_lval)))
+      if (value_less (arg1, value_zero (value_type (arg1),
+					value_arch (arg1), not_lval)))
         return value_neg (arg1);
       else
         return arg1;
@@ -9058,7 +9107,7 @@ ada_evaluate_subexp (struct type *expect
               struct type *arrType = ada_type_of_array (arg1, 0);
               if (arrType == NULL)
                 error (_("Attempt to dereference null array pointer."));
-              return value_at_lazy (arrType, 0);
+              return value_at_lazy (arrType, value_arch (arg1), 0);
             }
           else if (TYPE_CODE (type) == TYPE_CODE_PTR
                    || TYPE_CODE (type) == TYPE_CODE_REF
@@ -9069,19 +9118,19 @@ ada_evaluate_subexp (struct type *expect
                 (ada_aligned_type
                  (ada_check_typedef (TYPE_TARGET_TYPE (type))));
               check_size (type);
-              return value_zero (type, lval_memory);
+              return value_zero (type, value_arch (arg1), lval_memory);
             }
           else if (TYPE_CODE (type) == TYPE_CODE_INT)
 	    {
 	      /* GDB allows dereferencing an int.  */
 	      if (expect_type == NULL)
 		return value_zero (builtin_type (exp->gdbarch)->builtin_int,
-				   lval_memory);
+				   exp->gdbarch, lval_memory);
 	      else
 		{
 		  expect_type = 
 		    to_static_fixed_type (ada_aligned_type (expect_type));
-		  return value_zero (expect_type, lval_memory);
+		  return value_zero (expect_type, exp->gdbarch, lval_memory);
 		}
 	    }
           else
@@ -9100,7 +9149,7 @@ ada_evaluate_subexp (struct type *expect
 					      arg1));
 	  else
 	    return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
-				  (CORE_ADDR) value_as_address (arg1));
+				  exp->gdbarch, value_as_address (arg1));
         }
 
       if (ada_is_array_descriptor_type (type))
@@ -9128,14 +9177,16 @@ ada_evaluate_subexp (struct type *expect
                    in some extension of the type.  Return an object of 
                    "type" void, which will match any formal 
                    (see ada_type_match). */
-                return value_zero (builtin_type_void, lval_memory);
+                return value_zero (builtin_type_void,
+				   exp->gdbarch, lval_memory);
             }
           else
             type =
               ada_lookup_struct_elt_type (type1, &exp->elts[pc + 2].string, 1,
                                           0, NULL);
 
-          return value_zero (ada_aligned_type (type), lval_memory);
+          return value_zero (ada_aligned_type (type),
+			     exp->gdbarch, lval_memory);
         }
       else
         return
@@ -9149,7 +9200,7 @@ ada_evaluate_subexp (struct type *expect
       if (noside == EVAL_SKIP)
         goto nosideret;
       else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-        return allocate_value (exp->elts[pc + 1].type);
+        return allocate_value (exp->elts[pc + 1].type, exp->gdbarch);
       else
         error (_("Attempt to use a type name as an expression"));
 
@@ -9179,7 +9230,7 @@ ada_evaluate_subexp (struct type *expect
     }
 
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type_int8, exp->gdbarch, (LONGEST) 1);
 }
 
 
@@ -9323,16 +9374,16 @@ ada_vax_float_type_suffix (struct type *
    ada_is_vax_floating_type (TYPE).  */
 
 struct value *
-ada_vax_float_print_function (struct type *type)
+ada_vax_float_print_function (struct type *type, struct gdbarch *gdbarch)
 {
   switch (ada_vax_float_type_suffix (type))
     {
     case 'F':
-      return get_var_value ("DEBUG_STRING_F", 0);
+      return get_var_value (gdbarch, "DEBUG_STRING_F", 0);
     case 'D':
-      return get_var_value ("DEBUG_STRING_D", 0);
+      return get_var_value (gdbarch, "DEBUG_STRING_D", 0);
     case 'G':
-      return get_var_value ("DEBUG_STRING_G", 0);
+      return get_var_value (gdbarch, "DEBUG_STRING_G", 0);
     default:
       error (_("invalid VAX floating-point type"));
     }
@@ -9390,7 +9441,7 @@ scan_discrim_bound (char *str, int k, st
    otherwise causes an error with message ERR_MSG.  */
 
 static struct value *
-get_var_value (char *name, char *err_msg)
+get_var_value (struct gdbarch *gdbarch, char *name, char *err_msg)
 {
   struct ada_symbol_info *syms;
   int nsyms;
@@ -9406,7 +9457,7 @@ get_var_value (char *name, char *err_msg
         error (("%s"), err_msg);
     }
 
-  return value_of_variable (syms[0].sym, syms[0].block);
+  return value_of_variable (syms[0].sym, gdbarch, syms[0].block);
 }
 
 /* Value of integer variable named NAME in the current environment.  If
@@ -9416,7 +9467,9 @@ get_var_value (char *name, char *err_msg
 LONGEST
 get_int_var_value (char *name, int *flag)
 {
-  struct value *var_val = get_var_value (name, 0);
+  /* We don't really care which architecture to use here, as the value
+     will be converted to an integer immediately below.  */
+  struct value *var_val = get_var_value (target_gdbarch, name, 0);
 
   if (var_val == 0)
     {
@@ -9442,7 +9495,8 @@ get_int_var_value (char *name, int *flag
    the named range type.  */
 
 static struct type *
-to_fixed_range_type (char *name, struct value *dval, struct objfile *objfile)
+to_fixed_range_type (char *name, struct gdbarch *gdbarch,
+		     struct value *dval, struct objfile *objfile)
 {
   struct type *raw_type = ada_find_any_type (name);
   struct type *base_type;
@@ -9451,7 +9505,7 @@ to_fixed_range_type (char *name, struct 
   /* Also search primitive types if type symbol could not be found.  */
   if (raw_type == NULL)
     raw_type = language_lookup_primitive_type_by_name
-		(language_def (language_ada), current_gdbarch, name);
+		(language_def (language_ada), gdbarch, name);
 
   if (raw_type == NULL)
     base_type = builtin_type_int32;
Index: gdb-head/gdb/ada-tasks.c
===================================================================
--- gdb-head.orig/gdb/ada-tasks.c
+++ gdb-head/gdb/ada-tasks.c
@@ -384,7 +384,8 @@ get_tcb_types_info (struct type **atcb_t
       /* Get a static representation of the type record
          Ada_Task_Control_Block.  */
       type = atcb_sym->type;
-      type = ada_template_to_fixed_record_type_1 (type, NULL, 0, NULL, 0);
+      type = ada_template_to_fixed_record_type_1 (type, target_gdbarch,
+						  NULL, 0, NULL, 0);
     }
 
   if (common_atcb_sym == NULL || common_atcb_sym->type == NULL)
@@ -479,7 +480,8 @@ read_atcb (CORE_ADDR task_id, struct ada
     get_tcb_types_info (&atcb_type, &atcb_common_type, &atcb_ll_type,
                         &atcb_call_type, &fieldno);
 
-  tcb_value = value_from_contents_and_address (atcb_type, NULL, task_id);
+  tcb_value = value_from_contents_and_address (atcb_type, target_gdbarch,
+					       NULL, task_id);
   common_value = value_field (tcb_value, fieldno.common);
 
   /* Fill in the task_id.  */
@@ -576,7 +578,8 @@ read_atcb (CORE_ADDR task_id, struct ada
       if (call != 0)
         {
           call_val =
-            value_from_contents_and_address (atcb_call_type, NULL, call);
+            value_from_contents_and_address (atcb_call_type, target_gdbarch,
+					     NULL, call);
           task_info->caller_task =
             value_as_address (value_field (call_val, fieldno.call_self));
         }
Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -329,7 +329,7 @@ alpha_push_dummy_call (struct gdbarch *g
 
 	      /* Construct the indirection.  */
 	      arg_type = lookup_pointer_type (arg_type);
-	      arg = value_from_pointer (arg_type, sp);
+	      arg = value_from_pointer (arg_type, value_arch (arg), sp);
 	    }
 	  break;
 
@@ -350,7 +350,7 @@ alpha_push_dummy_call (struct gdbarch *g
 
 	      /* Construct the indirection.  */
 	      arg_type = lookup_pointer_type (arg_type);
-	      arg = value_from_pointer (arg_type, sp);
+	      arg = value_from_pointer (arg_type, value_arch (arg), sp);
 	    }
 	  break;
 
Index: gdb-head/gdb/ax-gdb.c
===================================================================
--- gdb-head.orig/gdb/ax-gdb.c
+++ gdb-head/gdb/ax-gdb.c
@@ -61,9 +61,11 @@
    struct agent_expr * --- agent expression buffer to generate code into
    struct axs_value * --- describes value left on top of stack  */
 
-static struct value *const_var_ref (struct symbol *var);
-static struct value *const_expr (union exp_element **pc);
-static struct value *maybe_const_expr (union exp_element **pc);
+static struct value *const_var_ref (struct symbol *var, struct gdbarch *);
+static struct value *const_expr (struct expression *exp,
+				 union exp_element **pc);
+static struct value *maybe_const_expr (struct expression *exp,
+				       union exp_element **pc);
 
 static void gen_traced_pop (struct agent_expr *, struct axs_value *);
 
@@ -163,17 +165,19 @@ static void agent_command (char *exp, in
    proletariat?  */
 
 static struct value *
-const_var_ref (struct symbol *var)
+const_var_ref (struct symbol *var, struct gdbarch *gdbarch)
 {
   struct type *type = SYMBOL_TYPE (var);
 
   switch (SYMBOL_CLASS (var))
     {
     case LOC_CONST:
-      return value_from_longest (type, (LONGEST) SYMBOL_VALUE (var));
+      return value_from_longest (type, gdbarch,
+				 (LONGEST) SYMBOL_VALUE (var));
 
     case LOC_LABEL:
-      return value_from_pointer (type, (CORE_ADDR) SYMBOL_VALUE_ADDRESS (var));
+      return value_from_pointer (type, gdbarch,
+				 (CORE_ADDR) SYMBOL_VALUE_ADDRESS (var));
 
     default:
       return 0;
@@ -186,7 +190,7 @@ const_var_ref (struct symbol *var)
    advanced to the end of it.  If we return zero, *PC could be
    anywhere.  */
 static struct value *
-const_expr (union exp_element **pc)
+const_expr (struct expression *exp, union exp_element **pc)
 {
   enum exp_opcode op = (*pc)->opcode;
   struct value *v1;
@@ -198,12 +202,12 @@ const_expr (union exp_element **pc)
 	struct type *type = (*pc)[1].type;
 	LONGEST k = (*pc)[2].longconst;
 	(*pc) += 4;
-	return value_from_longest (type, k);
+	return value_from_longest (type, exp->gdbarch, k);
       }
 
     case OP_VAR_VALUE:
       {
-	struct value *v = const_var_ref ((*pc)[2].symbol);
+	struct value *v = const_var_ref ((*pc)[2].symbol, exp->gdbarch);
 	(*pc) += 4;
 	return v;
       }
@@ -212,7 +216,7 @@ const_expr (union exp_element **pc)
 
     case UNOP_NEG:
       (*pc)++;
-      v1 = const_expr (pc);
+      v1 = const_expr (exp, pc);
       if (v1)
 	return value_neg (v1);
       else
@@ -227,10 +231,10 @@ const_expr (union exp_element **pc)
 /* Like const_expr, but guarantee also that *PC is undisturbed if the
    expression is not constant.  */
 static struct value *
-maybe_const_expr (union exp_element **pc)
+maybe_const_expr (struct expression *exp, union exp_element **pc)
 {
   union exp_element *tentative_pc = *pc;
-  struct value *v = const_expr (&tentative_pc);
+  struct value *v = const_expr (exp, &tentative_pc);
 
   /* If we got a value, then update the real PC.  */
   if (v)
@@ -1378,7 +1382,7 @@ gen_repeat (struct expression *exp, unio
 
   /* Evaluate the length; it had better be a constant.  */
   {
-    struct value *v = const_expr (pc);
+    struct value *v = const_expr (exp, pc);
     int length;
 
     if (!v)
@@ -1445,7 +1449,7 @@ gen_expr (struct expression *exp, union 
 
   /* If we're looking at a constant expression, just push its value.  */
   {
-    struct value *v = maybe_const_expr (pc);
+    struct value *v = maybe_const_expr (exp, pc);
 
     if (v)
       {
Index: gdb-head/gdb/dummy-frame.c
===================================================================
--- gdb-head.orig/gdb/dummy-frame.c
+++ gdb-head/gdb/dummy-frame.c
@@ -245,7 +245,7 @@ dummy_frame_prev_register (struct frame_
 
   /* Describe the register's location.  Generic dummy frames always
      have the register value in an ``expression''.  */
-  reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+  reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
 
   /* Use the regcache_cooked_read() method so that it, on the fly,
      constructs either a raw or pseudo register from the raw
Index: gdb-head/gdb/dwarf2expr.c
===================================================================
--- gdb-head.orig/gdb/dwarf2expr.c
+++ gdb-head/gdb/dwarf2expr.c
@@ -629,10 +629,10 @@ execute_stack_op (struct dwarf_expr_cont
 	    first = dwarf_expr_fetch (ctx, 0);
 	    dwarf_expr_pop (ctx);
 
-	    val1 = value_from_longest
-		     (unsigned_address_type (ctx->addr_size), first);
-	    val2 = value_from_longest
-		     (unsigned_address_type (ctx->addr_size), second);
+	    val1 = value_from_longest (unsigned_address_type (ctx->addr_size),
+				       ctx->gdbarch, first);
+	    val2 = value_from_longest (unsigned_address_type (ctx->addr_size),
+				       ctx->gdbarch, second);
 
 	    switch (op)
 	      {
@@ -666,7 +666,8 @@ execute_stack_op (struct dwarf_expr_cont
 	      case DW_OP_shra:
 		binop = BINOP_RSH;
 		val1 = value_from_longest
-			 (signed_address_type (ctx->addr_size), first);
+			 (signed_address_type (ctx->addr_size),
+			  ctx->gdbarch, first);
 		break;
 	      case DW_OP_xor:
 		binop = BINOP_BITWISE_XOR;
Index: gdb-head/gdb/dwarf2loc.c
===================================================================
--- gdb-head.orig/gdb/dwarf2loc.c
+++ gdb-head/gdb/dwarf2loc.c
@@ -195,7 +195,8 @@ dwarf_expr_tls_address (void *baton, COR
    SIZE, to find the current location of variable VAR in the context
    of FRAME.  */
 static struct value *
-dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame,
+dwarf2_evaluate_loc_desc (struct symbol *var, struct gdbarch *gdbarch,
+			  struct frame_info *frame,
 			  gdb_byte *data, unsigned short size,
 			  struct dwarf2_per_cu_data *per_cu)
 {
@@ -205,7 +206,7 @@ dwarf2_evaluate_loc_desc (struct symbol 
 
   if (size == 0)
     {
-      retval = allocate_value (SYMBOL_TYPE (var));
+      retval = allocate_value (SYMBOL_TYPE (var), gdbarch);
       VALUE_LVAL (retval) = not_lval;
       set_value_optimized_out (retval, 1);
       return retval;
@@ -230,7 +231,7 @@ dwarf2_evaluate_loc_desc (struct symbol 
       long offset = 0;
       bfd_byte *contents;
 
-      retval = allocate_value (SYMBOL_TYPE (var));
+      retval = allocate_value (SYMBOL_TYPE (var), gdbarch);
       contents = value_contents_raw (retval);
       for (i = 0; i < ctx->num_pieces; i++)
 	{
@@ -255,13 +256,14 @@ dwarf2_evaluate_loc_desc (struct symbol 
       struct gdbarch *arch = get_frame_arch (frame);
       CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
       int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
-      retval = value_from_register (SYMBOL_TYPE (var), gdb_regnum, frame);
+      retval = value_from_register (SYMBOL_TYPE (var), gdbarch,
+				    gdb_regnum, frame);
     }
   else
     {
       CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
 
-      retval = allocate_value (SYMBOL_TYPE (var));
+      retval = allocate_value (SYMBOL_TYPE (var), gdbarch);
       VALUE_LVAL (retval) = lval_memory;
       set_value_lazy (retval, 1);
       set_value_address (retval, address);
@@ -436,14 +438,13 @@ dwarf2_tracepoint_var_ref (struct symbol
 /* Return the value of SYMBOL in FRAME using the DWARF-2 expression
    evaluator to calculate the location.  */
 static struct value *
-locexpr_read_variable (struct symbol *symbol, struct frame_info *frame)
+locexpr_read_variable (struct symbol *symbol, struct gdbarch *gdbarch,
+		       struct frame_info *frame)
 {
   struct dwarf2_locexpr_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
-  struct value *val;
-  val = dwarf2_evaluate_loc_desc (symbol, frame, dlbaton->data, dlbaton->size,
-				  dlbaton->per_cu);
-
-  return val;
+  return dwarf2_evaluate_loc_desc (symbol, gdbarch, frame,
+				   dlbaton->data, dlbaton->size,
+				   dlbaton->per_cu);
 }
 
 /* Return non-zero iff we need a frame to evaluate SYMBOL.  */
@@ -547,7 +548,8 @@ const struct symbol_computed_ops dwarf2_
 /* Return the value of SYMBOL in FRAME using the DWARF-2 expression
    evaluator to calculate the location.  */
 static struct value *
-loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
+loclist_read_variable (struct symbol *symbol, struct gdbarch *gdbarch,
+		       struct frame_info *frame)
 {
   struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
   struct value *val;
@@ -559,12 +561,12 @@ loclist_read_variable (struct symbol *sy
 				   : 0);
   if (data == NULL)
     {
-      val = allocate_value (SYMBOL_TYPE (symbol));
+      val = allocate_value (SYMBOL_TYPE (symbol), gdbarch);
       VALUE_LVAL (val) = not_lval;
       set_value_optimized_out (val, 1);
     }
   else
-    val = dwarf2_evaluate_loc_desc (symbol, frame, data, size,
+    val = dwarf2_evaluate_loc_desc (symbol, gdbarch, frame, data, size,
 				    dlbaton->per_cu);
 
   return val;
Index: gdb-head/gdb/eval.c
===================================================================
--- gdb-head.orig/gdb/eval.c
+++ gdb-head/gdb/eval.c
@@ -357,7 +357,7 @@ 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),
+	    modify_field (value_arch (struct_val), addr, value_as_long (val),
 			  bitpos % 8, bitsize);
 	  else
 	    memcpy (addr, value_contents (val),
@@ -685,7 +685,7 @@ evaluate_subexp_standard (struct type *e
       (*pos) += 4 + BYTES_TO_EXP_ELEM (tem + 1);
       if (noside == EVAL_SKIP)
 	goto nosideret;
-      arg1 = value_aggregate_elt (exp->elts[pc + 1].type,
+      arg1 = value_aggregate_elt (exp->elts[pc + 1].type, exp->gdbarch,
 				  &exp->elts[pc + 3].string,
 				  0, noside);
       if (arg1 == NULL)
@@ -694,17 +694,17 @@ evaluate_subexp_standard (struct type *e
 
     case OP_LONG:
       (*pos) += 3;
-      return value_from_longest (exp->elts[pc + 1].type,
+      return value_from_longest (exp->elts[pc + 1].type, exp->gdbarch,
 				 exp->elts[pc + 2].longconst);
 
     case OP_DOUBLE:
       (*pos) += 3;
-      return value_from_double (exp->elts[pc + 1].type,
+      return value_from_double (exp->elts[pc + 1].type, exp->gdbarch,
 				exp->elts[pc + 2].doubleconst);
 
     case OP_DECFLOAT:
       (*pos) += 3;
-      return value_from_decfloat (exp->elts[pc + 1].type,
+      return value_from_decfloat (exp->elts[pc + 1].type, exp->gdbarch,
 				  exp->elts[pc + 2].decfloatconst);
 
     case OP_VAR_VALUE:
@@ -727,14 +727,15 @@ evaluate_subexp_standard (struct type *e
 
 	TRY_CATCH (except, RETURN_MASK_ERROR)
 	  {
-	    ret = value_of_variable (exp->elts[pc + 2].symbol,
+	    ret = value_of_variable (exp->elts[pc + 2].symbol, exp->gdbarch,
 				     exp->elts[pc + 1].block);
 	  }
 
 	if (except.reason < 0)
 	  {
 	    if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	      ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol), not_lval);
+	      ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
+				exp->gdbarch, not_lval);
 	    else
 	      throw_exception (except);
 	  }
@@ -767,7 +768,8 @@ evaluate_subexp_standard (struct type *e
 	if (noside == EVAL_AVOID_SIDE_EFFECTS
 	    && regno < gdbarch_num_regs (exp->gdbarch)
 			+ gdbarch_num_pseudo_regs (exp->gdbarch))
-	  val = value_zero (register_type (exp->gdbarch, regno), not_lval);
+	  val = value_zero (register_type (exp->gdbarch, regno),
+			    exp->gdbarch, not_lval);
 	else
 	  val = value_of_register (regno, get_selected_frame (NULL));
 	if (val == NULL)
@@ -778,11 +780,13 @@ evaluate_subexp_standard (struct type *e
     case OP_BOOL:
       (*pos) += 2;
       type = language_bool_type (exp->language_defn, exp->gdbarch);
-      return value_from_longest (type, exp->elts[pc + 1].longconst);
+      return value_from_longest (type, exp->gdbarch,
+				 exp->elts[pc + 1].longconst);
 
     case OP_INTERNALVAR:
       (*pos) += 2;
-      return value_of_internalvar (exp->elts[pc + 1].internalvar);
+      return value_of_internalvar (exp->gdbarch,
+				   exp->elts[pc + 1].internalvar);
 
     case OP_STRING:
       tem = longest_to_int (exp->elts[pc + 1].longconst);
@@ -790,7 +794,7 @@ evaluate_subexp_standard (struct type *e
       if (noside == EVAL_SKIP)
 	goto nosideret;
       type = language_string_char_type (exp->language_defn, exp->gdbarch);
-      return value_string (&exp->elts[pc + 2].string, tem, type);
+      return value_string (exp->gdbarch, &exp->elts[pc + 2].string, tem, type);
 
     case OP_OBJC_NSSTRING:		/* Objective C Foundation Class NSString constant.  */
       tem = longest_to_int (exp->elts[pc + 1].longconst);
@@ -807,7 +811,7 @@ evaluate_subexp_standard (struct type *e
 	+= 3 + BYTES_TO_EXP_ELEM ((tem + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
       if (noside == EVAL_SKIP)
 	goto nosideret;
-      return value_bitstring (&exp->elts[pc + 2].string, tem);
+      return value_bitstring (exp->gdbarch, &exp->elts[pc + 2].string, tem);
       break;
 
     case OP_ARRAY:
@@ -820,7 +824,7 @@ evaluate_subexp_standard (struct type *e
       if (expect_type != NULL_TYPE && noside != EVAL_SKIP
 	  && TYPE_CODE (type) == TYPE_CODE_STRUCT)
 	{
-	  struct value *rec = allocate_value (expect_type);
+	  struct value *rec = allocate_value (expect_type, exp->gdbarch);
 	  memset (value_contents_raw (rec), '\0', TYPE_LENGTH (type));
 	  return evaluate_struct_tuple (rec, exp, pos, noside, nargs);
 	}
@@ -830,7 +834,7 @@ evaluate_subexp_standard (struct type *e
 	{
 	  struct type *range_type = TYPE_INDEX_TYPE (type);
 	  struct type *element_type = TYPE_TARGET_TYPE (type);
-	  struct value *array = allocate_value (expect_type);
+	  struct value *array = allocate_value (expect_type, exp->gdbarch);
 	  int element_size = TYPE_LENGTH (check_typedef (element_type));
 	  LONGEST low_bound, high_bound, index;
 	  if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0)
@@ -878,7 +882,7 @@ evaluate_subexp_standard (struct type *e
       if (expect_type != NULL_TYPE && noside != EVAL_SKIP
 	  && TYPE_CODE (type) == TYPE_CODE_SET)
 	{
-	  struct value *set = allocate_value (expect_type);
+	  struct value *set = allocate_value (expect_type, exp->gdbarch);
 	  gdb_byte *valaddr = value_contents_raw (set);
 	  struct type *element_type = TYPE_INDEX_TYPE (type);
 	  struct type *check_type = element_type;
@@ -941,7 +945,7 @@ evaluate_subexp_standard (struct type *e
 	      for (; range_low <= range_high; range_low++)
 		{
 		  int bit_index = (unsigned) range_low % TARGET_CHAR_BIT;
-		  if (gdbarch_bits_big_endian (current_gdbarch))
+		  if (gdbarch_bits_big_endian (value_arch (set)))
 		    bit_index = TARGET_CHAR_BIT - 1 - bit_index;
 		  valaddr[(unsigned) range_low / TARGET_CHAR_BIT]
 		    |= 1 << bit_index;
@@ -1011,7 +1015,7 @@ evaluate_subexp_standard (struct type *e
 	  sel[len] = 0;		/* Make sure it's terminated.  */
 
 	selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr;
-	return value_from_longest (selector_type,
+	return value_from_longest (selector_type, exp->gdbarch,
 				   lookup_child_selector (exp->gdbarch, sel));
       }
 
@@ -1058,7 +1062,7 @@ evaluate_subexp_standard (struct type *e
 	target = evaluate_subexp (selector_type, exp, pos, sub_no_side);
 
 	if (value_as_long (target) == 0)
- 	  return value_from_longest (long_type, 0);
+ 	  return value_from_longest (long_type, exp->gdbarch, 0);
 	
 	if (lookup_minimal_symbol ("objc_msg_lookup", 0, 0))
 	  gnu_runtime = 1;
@@ -1084,9 +1088,12 @@ evaluate_subexp_standard (struct type *e
 	    msg_send_stret
 	      = find_function_in_inferior (exp->gdbarch, "objc_msg_lookup");
 
-	    msg_send = value_from_pointer (type, value_as_address (msg_send));
-	    msg_send_stret = value_from_pointer (type, 
-					value_as_address (msg_send_stret));
+	    msg_send
+	      = value_from_pointer (type, exp->gdbarch,
+				    value_as_address (msg_send));
+	    msg_send_stret
+	      = value_from_pointer (type, exp->gdbarch,
+				    value_as_address (msg_send_stret));
 	  }
 	else
 	  {
@@ -1125,8 +1132,10 @@ evaluate_subexp_standard (struct type *e
 
 	argvec[0] = msg_send;
 	argvec[1] = target;
-	argvec[2] = value_from_longest (long_type, responds_selector);
-	argvec[3] = value_from_longest (long_type, selector);
+	argvec[2] = value_from_longest (long_type, exp->gdbarch,
+					responds_selector);
+	argvec[3] = value_from_longest (long_type, exp->gdbarch,
+					selector);
 	argvec[4] = 0;
 
 	ret = call_function_by_hand (argvec[0], 3, argvec + 1);
@@ -1147,8 +1156,10 @@ evaluate_subexp_standard (struct type *e
 
 	argvec[0] = msg_send;
 	argvec[1] = target;
-	argvec[2] = value_from_longest (long_type, method_selector);
-	argvec[3] = value_from_longest (long_type, selector);
+	argvec[2] = value_from_longest (long_type, exp->gdbarch,
+					method_selector);
+	argvec[3] = value_from_longest (long_type, exp->gdbarch,
+					selector);
 	argvec[4] = 0;
 
 	ret = call_function_by_hand (argvec[0], 3, argvec + 1);
@@ -1168,7 +1179,7 @@ evaluate_subexp_standard (struct type *e
 
 	    sym = find_pc_function (addr);
 	    if (sym != NULL) 
-	      method = value_of_variable (sym, 0);
+	      method = value_of_variable (sym, exp->gdbarch, 0);
 	  }
 
 	/* If we found a method with symbol information, check to see
@@ -1254,9 +1265,9 @@ evaluate_subexp_standard (struct type *e
 	    if (type)
 	    {
 	      if ((TYPE_CODE (type) == TYPE_CODE_ERROR) && expect_type)
-		return allocate_value (expect_type);
+		return allocate_value (expect_type, exp->gdbarch);
 	      else
-		return allocate_value (type);
+		return allocate_value (type, exp->gdbarch);
 	    }
 	    else
 	      error (_("Expression of type other than \"method returning ...\" used as a method"));
@@ -1268,7 +1279,7 @@ evaluate_subexp_standard (struct type *e
 
 	argvec[0] = called_method;
 	argvec[1] = target;
-	argvec[2] = value_from_longest (long_type, selector);
+	argvec[2] = value_from_longest (long_type, exp->gdbarch, selector);
 	/* User-supplied arguments.  */
 	for (tem = 0; tem < nargs; tem++)
 	  argvec[tem + 3] = evaluate_subexp_with_coercion (exp, pos, noside);
@@ -1328,7 +1339,7 @@ evaluate_subexp_standard (struct type *e
 	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	    {
 	      struct type *method_type = check_typedef (value_type (arg1));
-	      arg1 = value_zero (method_type, not_lval);
+	      arg1 = value_zero (method_type, value_arch (arg1), not_lval);
 	    }
 	  else
 	    arg1 = cplus_method_ptr_to_value (&arg2, arg1);
@@ -1446,6 +1457,7 @@ evaluate_subexp_standard (struct type *e
 	 	 of the ``this'' pointer if necessary, so modify argvec[1] to
 		 reflect any ``this'' changes.  */
 	      arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
+					 value_arch (temp),
 					 value_address (temp)
 					 + value_embedded_offset (temp));
 	      argvec[1] = arg2;	/* the ``this'' pointer */
@@ -1520,7 +1532,8 @@ evaluate_subexp_standard (struct type *e
 	  TYPE_TARGET_TYPE (value_type (argvec[0]));
 
 	  if (ftype)
-	    return allocate_value (TYPE_TARGET_TYPE (value_type (argvec[0])));
+	    return allocate_value (TYPE_TARGET_TYPE (value_type (argvec[0])),
+				   value_arch (argvec[0]));
 	  else
 	    error (_("Expression of type other than \"Function returning ...\" used as function"));
 	}
@@ -1619,7 +1632,7 @@ evaluate_subexp_standard (struct type *e
 	return value_zero (lookup_struct_elt_type (value_type (arg1),
 						   &exp->elts[pc + 2].string,
 						   0),
-			   lval_memory);
+			   value_arch (arg1), lval_memory);
       else
 	{
 	  struct value *temp = arg1;
@@ -1664,7 +1677,7 @@ evaluate_subexp_standard (struct type *e
 	return value_zero (lookup_struct_elt_type (value_type (arg1),
 						   &exp->elts[pc + 2].string,
 						   0),
-			   lval_memory);
+			   value_arch (arg1), lval_memory);
       else
 	{
 	  struct value *temp = arg1;
@@ -1689,7 +1702,8 @@ evaluate_subexp_standard (struct type *e
 	{
 	case TYPE_CODE_METHODPTR:
 	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	    return value_zero (TYPE_TARGET_TYPE (type), not_lval);
+	    return value_zero (TYPE_TARGET_TYPE (type),
+			       exp->gdbarch, not_lval);
 	  else
 	    {
 	      arg2 = cplus_method_ptr_to_value (&arg1, arg2);
@@ -1705,6 +1719,7 @@ evaluate_subexp_standard (struct type *e
 	  mem_offset = value_as_long (arg2);
 
 	  arg3 = value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
+				     value_arch (arg1),
 				     value_as_long (arg1) + mem_offset);
 	  return value_ind (arg3);
 
@@ -1792,7 +1807,8 @@ evaluate_subexp_standard (struct type *e
 	    {
 	      /* FIXME -- should be ptrdiff_t */
 	      type = builtin_type (exp->gdbarch)->builtin_long;
-	      return value_from_longest (type, value_ptrdiff (arg1, arg2));
+	      return value_from_longest (type, exp->gdbarch,
+					 value_ptrdiff (arg1, arg2));
 	    }
 	  else
 	    return value_ptrsub (arg1, arg2);
@@ -1837,7 +1853,8 @@ evaluate_subexp_standard (struct type *e
 	    {
 	      struct value *v_one, *retval;
 
-	      v_one = value_one (value_type (arg2), not_lval);
+	      v_one = value_one (value_type (arg2),
+				 value_arch (arg2), not_lval);
 	      binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one);
 	      retval = value_binop (arg1, v_one, op);
 	      return retval;
@@ -1889,7 +1906,8 @@ evaluate_subexp_standard (struct type *e
 	    }
 
 	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	    return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
+	    return value_zero (TYPE_TARGET_TYPE (type),
+			       value_arch (arg1), VALUE_LVAL (arg1));
 	  else
 	    return value_subscript (arg1, arg2);
 	}
@@ -1900,7 +1918,7 @@ evaluate_subexp_standard (struct type *e
       if (noside == EVAL_SKIP)
 	goto nosideret;
       type = language_bool_type (exp->language_defn, exp->gdbarch);
-      return value_from_longest (type, (LONGEST) value_in (arg1, arg2));
+      return value_from_longest (type, exp->gdbarch, value_in (arg1, arg2));
 
     case MULTI_SUBSCRIPT:
       (*pos) += 2;
@@ -1931,7 +1949,8 @@ evaluate_subexp_standard (struct type *e
 	      type = TYPE_TARGET_TYPE (check_typedef (value_type (arg1)));
 	      if (type != NULL)
 		{
-		  arg1 = value_zero (type, VALUE_LVAL (arg1));
+		  arg1 = value_zero (type,
+				     value_arch (arg1), VALUE_LVAL (arg1));
 		  noside = EVAL_SKIP;
 		  continue;
 		}
@@ -2043,7 +2062,8 @@ evaluate_subexp_standard (struct type *e
 
 	/* Construct a value node with the value of the offset */
 
-	arg2 = value_from_longest (builtin_type_int32, offset_item);
+	arg2 = value_from_longest (builtin_type_int32, exp->gdbarch,
+				   offset_item);
 
 	/* Let us now play a dirty trick: we will take arg1 
 	   which is a value node pointing to the topmost level
@@ -2079,7 +2099,7 @@ evaluate_subexp_standard (struct type *e
 	  arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
 				  (tem ? EVAL_SKIP : noside));
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type,
+	  return value_from_longest (type, exp->gdbarch,
 			     (LONGEST) (!tem && !value_logical_not (arg2)));
 	}
 
@@ -2106,7 +2126,7 @@ evaluate_subexp_standard (struct type *e
 	  arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
 				  (!tem ? EVAL_SKIP : noside));
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type,
+	  return value_from_longest (type, exp->gdbarch,
 			     (LONGEST) (!tem || !value_logical_not (arg2)));
 	}
 
@@ -2124,7 +2144,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_equal (arg1, arg2);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 	}
 
     case BINOP_NOTEQUAL:
@@ -2141,7 +2161,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_equal (arg1, arg2);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) ! tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) ! tem);
 	}
 
     case BINOP_LESS:
@@ -2158,7 +2178,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_less (arg1, arg2);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 	}
 
     case BINOP_GTR:
@@ -2175,7 +2195,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_less (arg2, arg1);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 	}
 
     case BINOP_GEQ:
@@ -2192,7 +2212,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_less (arg2, arg1) || value_equal (arg1, arg2);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 	}
 
     case BINOP_LEQ:
@@ -2209,7 +2229,7 @@ evaluate_subexp_standard (struct type *e
 	  binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
 	  tem = value_less (arg1, arg2) || value_equal (arg1, arg2);
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) tem);
+	  return value_from_longest (type, exp->gdbarch, (LONGEST) tem);
 	}
 
     case BINOP_REPEAT:
@@ -2222,8 +2242,8 @@ evaluate_subexp_standard (struct type *e
 	error (_("Non-integral right operand for \"@\" operator."));
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
 	{
-	  return allocate_repeat_value (value_type (arg1),
-				     longest_to_int (value_as_long (arg2)));
+	  return allocate_repeat_value (value_type (arg1), value_arch (arg1),
+					longest_to_int (value_as_long (arg2)));
 	}
       else
 	return value_repeat (arg1, longest_to_int (value_as_long (arg2)));
@@ -2280,7 +2300,8 @@ evaluate_subexp_standard (struct type *e
       else
 	{
 	  type = language_bool_type (exp->language_defn, exp->gdbarch);
-	  return value_from_longest (type, (LONGEST) value_logical_not (arg1));
+	  return value_from_longest (type, exp->gdbarch,
+				     (LONGEST) value_logical_not (arg1));
 	}
 
     case UNOP_IND:
@@ -2304,11 +2325,11 @@ evaluate_subexp_standard (struct type *e
 	      || TYPE_CODE (type) == TYPE_CODE_ARRAY
 	    )
 	    return value_zero (TYPE_TARGET_TYPE (type),
-			       lval_memory);
+			       value_arch (arg1), lval_memory);
 	  else if (TYPE_CODE (type) == TYPE_CODE_INT)
 	    /* GDB allows dereferencing an int.  */
-	    return value_zero (builtin_type (exp->gdbarch)->builtin_int,
-			       lval_memory);
+	    return value_zero (builtin_type (value_arch (arg1))->builtin_int,
+			       value_arch (arg1), lval_memory);
 	  else
 	    error (_("Attempt to take contents of a non-pointer value."));
 	}
@@ -2318,8 +2339,8 @@ evaluate_subexp_standard (struct type *e
 	 do.  "long long" variables are rare enough that
 	 BUILTIN_TYPE_LONGEST would seem to be a mistake.  */
       if (TYPE_CODE (type) == TYPE_CODE_INT)
-	return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
-			      (CORE_ADDR) value_as_address (arg1));
+	return value_at_lazy (builtin_type (value_arch (arg1))->builtin_int,
+			      value_arch (arg1), value_as_address (arg1));
       return value_ind (arg1);
 
     case UNOP_ADDR:
@@ -2362,10 +2383,11 @@ evaluate_subexp_standard (struct type *e
       if (noside == EVAL_SKIP)
 	goto nosideret;
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	return value_zero (exp->elts[pc + 1].type, lval_memory);
+	return value_zero (exp->elts[pc + 1].type,
+			   value_arch (arg1), lval_memory);
       else
 	return value_at_lazy (exp->elts[pc + 1].type,
-			      value_as_address (arg1));
+			      value_arch (arg1), value_as_address (arg1));
 
     case UNOP_MEMVAL_TLS:
       (*pos) += 3;
@@ -2373,13 +2395,15 @@ evaluate_subexp_standard (struct type *e
       if (noside == EVAL_SKIP)
 	goto nosideret;
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	return value_zero (exp->elts[pc + 2].type, lval_memory);
+	return value_zero (exp->elts[pc + 2].type,
+			   value_arch (arg1), lval_memory);
       else
 	{
 	  CORE_ADDR tls_addr;
 	  tls_addr = target_translate_tls_address (exp->elts[pc + 1].objfile,
 						   value_as_address (arg1));
-	  return value_at_lazy (exp->elts[pc + 2].type, tls_addr);
+	  return value_at_lazy (exp->elts[pc + 2].type,
+				value_arch (arg1), tls_addr);
 	}
 
     case UNOP_PREINCREMENT:
@@ -2392,7 +2416,7 @@ evaluate_subexp_standard (struct type *e
 	}
       else
 	{
-	  arg2 = value_from_longest (builtin_type_uint8, (LONGEST) 1);
+	  arg2 = value_from_longest (builtin_type_uint8, value_arch (arg1), 1);
 	  if (ptrmath_type_p (value_type (arg1)))
 	    arg2 = value_ptradd (arg1, arg2);
 	  else
@@ -2415,7 +2439,7 @@ evaluate_subexp_standard (struct type *e
 	}
       else
 	{
-	  arg2 = value_from_longest (builtin_type_uint8, (LONGEST) 1);
+	  arg2 = value_from_longest (builtin_type_uint8, value_arch (arg1), 1);
 	  if (ptrmath_type_p (value_type (arg1)))
 	    arg2 = value_ptrsub (arg1, arg2);
 	  else
@@ -2438,7 +2462,7 @@ evaluate_subexp_standard (struct type *e
 	}
       else
 	{
-	  arg2 = value_from_longest (builtin_type_uint8, (LONGEST) 1);
+	  arg2 = value_from_longest (builtin_type_uint8, value_arch (arg1), 1);
 	  if (ptrmath_type_p (value_type (arg1)))
 	    arg2 = value_ptradd (arg1, arg2);
 	  else
@@ -2462,7 +2486,7 @@ evaluate_subexp_standard (struct type *e
 	}
       else
 	{
-	  arg2 = value_from_longest (builtin_type_uint8, (LONGEST) 1);
+	  arg2 = value_from_longest (builtin_type_uint8, value_arch (arg1), 1);
 	  if (ptrmath_type_p (value_type (arg1)))
 	    arg2 = value_ptrsub (arg1, arg2);
 	  else
@@ -2500,7 +2524,7 @@ evaluate_subexp_standard (struct type *e
 	  check_typedef (type);
 	  if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
 	    type = TYPE_TARGET_TYPE (type);
-	  return allocate_value (type);
+	  return allocate_value (type, exp->gdbarch);
 	}
       else
         error (_("Attempt to use a type name as an expression"));
@@ -2520,7 +2544,7 @@ GDB does not (yet) know how to evaluate 
     }
 
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type_int8, exp->gdbarch, 1);
 }
 
 /* Evaluate a subexpression of EXP, at index *POS,
@@ -2584,15 +2608,16 @@ evaluate_subexp_for_address (struct expr
 	    error (_("Attempt to take address of register or constant."));
 
 	  return
-	    value_zero (type, not_lval);
+	    value_zero (type, exp->gdbarch, not_lval);
 	}
       else
-	return address_of_variable (var, exp->elts[pc + 1].block);
+	return address_of_variable (var, exp->gdbarch,
+				    exp->elts[pc + 1].block);
 
     case OP_SCOPE:
       tem = longest_to_int (exp->elts[pc + 2].longconst);
       (*pos) += 5 + BYTES_TO_EXP_ELEM (tem + 1);
-      x = value_aggregate_elt (exp->elts[pc + 1].type,
+      x = value_aggregate_elt (exp->elts[pc + 1].type, exp->gdbarch,
 			       &exp->elts[pc + 3].string,
 			       1, noside);
       if (x == NULL)
@@ -2609,10 +2634,10 @@ evaluate_subexp_for_address (struct expr
 
 	  if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
 	    return value_zero (lookup_pointer_type (value_type (x)),
-			       not_lval);
+			       exp->gdbarch, not_lval);
 	  else if (TYPE_CODE (type) == TYPE_CODE_REF)
 	    return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
-			       not_lval);
+			       exp->gdbarch, not_lval);
 	  else
 	    error (_("Attempt to take address of value not located in memory."));
 	}
@@ -2655,7 +2680,8 @@ evaluate_subexp_with_coercion (struct ex
 	  && CAST_IS_CONVERSION)
 	{
 	  (*pos) += 4;
-	  val = address_of_variable (var, exp->elts[pc + 1].block);
+	  val = address_of_variable (var, exp->gdbarch,
+				     exp->elts[pc + 1].block);
 	  return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
 			     val);
 	}
@@ -2698,22 +2724,25 @@ evaluate_subexp_for_sizeof (struct expre
 	  && TYPE_CODE (type) != TYPE_CODE_ARRAY)
 	error (_("Attempt to take contents of a non-pointer value."));
       type = check_typedef (TYPE_TARGET_TYPE (type));
-      return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
+      return value_from_longest (size_type, exp->gdbarch,
+				 (LONGEST) TYPE_LENGTH (type));
 
     case UNOP_MEMVAL:
       (*pos) += 3;
       type = check_typedef (exp->elts[pc + 1].type);
-      return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
+      return value_from_longest (size_type, exp->gdbarch,
+				 (LONGEST) TYPE_LENGTH (type));
 
     case OP_VAR_VALUE:
       (*pos) += 4;
       type = check_typedef (SYMBOL_TYPE (exp->elts[pc + 2].symbol));
       return
-	value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
+	value_from_longest (size_type, exp->gdbarch,
+			    (LONGEST) TYPE_LENGTH (type));
 
     default:
       val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
-      return value_from_longest (size_type,
+      return value_from_longest (size_type, exp->gdbarch,
 				 (LONGEST) TYPE_LENGTH (value_type (val)));
     }
 }
Index: gdb-head/gdb/expprint.c
===================================================================
--- gdb-head.orig/gdb/expprint.c
+++ gdb-head/gdb/expprint.c
@@ -97,7 +97,7 @@ print_subexp_standard (struct expression
 	struct value_print_options opts;
 	get_raw_print_options (&opts);
 	(*pos) += 3;
-	value_print (value_from_longest (exp->elts[pc + 1].type,
+	value_print (value_from_longest (exp->elts[pc + 1].type, exp->gdbarch,
 					 exp->elts[pc + 2].longconst),
 		     stream, &opts);
       }
@@ -108,7 +108,7 @@ print_subexp_standard (struct expression
 	struct value_print_options opts;
 	get_raw_print_options (&opts);
 	(*pos) += 3;
-	value_print (value_from_double (exp->elts[pc + 1].type,
+	value_print (value_from_double (exp->elts[pc + 1].type, exp->gdbarch,
 					exp->elts[pc + 2].doubleconst),
 		     stream, &opts);
       }
@@ -187,7 +187,8 @@ print_subexp_standard (struct expression
 	   additional parameter to LA_PRINT_STRING.  -fnf */
 	get_user_print_options (&opts);
 	LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
-			 &exp->elts[pc + 2].string, nargs, 0, &opts);
+			 exp->gdbarch, &exp->elts[pc + 2].string, nargs, 0,
+			 &opts);
       }
       return;
 
@@ -206,7 +207,8 @@ print_subexp_standard (struct expression
 	fputs_filtered ("@\"", stream);
 	get_user_print_options (&opts);
 	LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
-			 &exp->elts[pc + 2].string, nargs, 0, &opts);
+			 exp->gdbarch, &exp->elts[pc + 2].string, nargs, 0,
+			 &opts);
 	fputs_filtered ("\"", stream);
       }
       return;
@@ -292,7 +294,7 @@ print_subexp_standard (struct expression
 	  struct value_print_options opts;
 	  get_user_print_options (&opts);
 	  LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char,
-			   tempstr, nargs - 1, 0, &opts);
+			   exp->gdbarch, tempstr, nargs - 1, 0, &opts);
 	  (*pos) = pc;
 	}
       else
@@ -423,7 +425,7 @@ print_subexp_standard (struct expression
 	     Swallow the OP_LONG (including both its opcodes); ignore
 	     its type; print the value in the type of the MEMVAL.  */
 	  (*pos) += 4;
-	  val = value_at_lazy (exp->elts[pc + 1].type,
+	  val = value_at_lazy (exp->elts[pc + 1].type, exp->gdbarch,
 			       (CORE_ADDR) exp->elts[pc + 5].longconst);
 	  get_raw_print_options (&opts);
 	  value_print (val, stream, &opts);
Index: gdb-head/gdb/findcmd.c
===================================================================
--- gdb-head.orig/gdb/findcmd.c
+++ gdb-head/gdb/findcmd.c
@@ -299,7 +299,8 @@ find_command (char *args, int from_tty)
     {
       struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
       set_internalvar (lookup_internalvar ("_"),
-		       value_from_pointer (ptr_type, last_found_addr));
+		       value_from_pointer (ptr_type, gdbarch,
+					   last_found_addr));
     }
 
   if (found_count == 0)
Index: gdb-head/gdb/findvar.c
===================================================================
--- gdb-head.orig/gdb/findvar.c
+++ gdb-head/gdb/findvar.c
@@ -270,7 +270,7 @@ value_of_register (int regnum, struct fr
 
   frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
 
-  reg_val = allocate_value (register_type (gdbarch, regnum));
+  reg_val = allocate_value (register_type (gdbarch, regnum), gdbarch);
 
   memcpy (value_contents_raw (reg_val), raw_buffer,
 	  register_size (gdbarch, regnum));
@@ -298,7 +298,7 @@ value_of_register_lazy (struct frame_inf
   /* We should have a valid (i.e. non-sentinel) frame.  */
   gdb_assert (frame_id_p (get_frame_id (frame)));
 
-  reg_val = allocate_value (register_type (gdbarch, regnum));
+  reg_val = allocate_value (register_type (gdbarch, regnum), gdbarch);
   VALUE_LVAL (reg_val) = lval_register;
   VALUE_REGNUM (reg_val) = regnum;
   VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
@@ -388,7 +388,8 @@ symbol_read_needs_frame (struct symbol *
    If the variable cannot be found, return a zero pointer.  */
 
 struct value *
-read_var_value (struct symbol *var, struct frame_info *frame)
+read_var_value (struct symbol *var, struct gdbarch *gdbarch,
+		struct frame_info *frame)
 {
   struct value *v;
   struct type *type = SYMBOL_TYPE (var);
@@ -401,7 +402,7 @@ read_var_value (struct symbol *var, stru
     v = NULL;
   else
     {
-      v = allocate_value (type);
+      v = allocate_value (type, gdbarch);
       VALUE_LVAL (v) = lval_memory;	/* The most likely possibility.  */
     }
 
@@ -464,7 +465,7 @@ read_var_value (struct symbol *var, stru
 	if (!argref)
 	  return 0;
 	argref += SYMBOL_VALUE (var);
-	ref = value_at (lookup_pointer_type (type), argref);
+	ref = value_at (lookup_pointer_type (type), gdbarch, argref);
 	addr = value_as_address (ref);
 	break;
       }
@@ -496,8 +497,7 @@ read_var_value (struct symbol *var, stru
 	if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
 	  {
 	    regval = value_from_register (lookup_pointer_type (type),
-					  regno,
-					  frame);
+					  gdbarch, regno, frame);
 
 	    if (regval == NULL)
 	      error (_("Value of register variable not available."));
@@ -507,7 +507,7 @@ read_var_value (struct symbol *var, stru
 	  }
 	else
 	  {
-	    regval = value_from_register (type, regno, frame);
+	    regval = value_from_register (type, gdbarch, regno, frame);
 
 	    if (regval == NULL)
 	      error (_("Value of register variable not available."));
@@ -522,7 +522,7 @@ read_var_value (struct symbol *var, stru
 	 Unfortunately DWARF 2 stores the frame-base (instead of the
 	 function) location in a function's symbol.  Oops!  For the
 	 moment enable this when/where applicable.  */
-      return SYMBOL_COMPUTED_OPS (var)->read_variable (var, frame);
+      return SYMBOL_COMPUTED_OPS (var)->read_variable (var, gdbarch, frame);
 
     case LOC_UNRESOLVED:
       {
@@ -563,12 +563,12 @@ read_var_value (struct symbol *var, stru
 /* Install default attributes for register values.  */
 
 struct value *
-default_value_from_register (struct type *type, int regnum,
-			     struct frame_info *frame)
+default_value_from_register (struct type *type, struct gdbarch *val_arch,
+			     int regnum, struct frame_info *frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   int len = TYPE_LENGTH (type);
-  struct value *value = allocate_value (type);
+  struct value *value = allocate_value (type, val_arch);
 
   VALUE_LVAL (value) = lval_register;
   VALUE_FRAME_ID (value) = get_frame_id (frame);
@@ -591,7 +591,8 @@ default_value_from_register (struct type
 /* Return a value of type TYPE, stored in register REGNUM, in frame FRAME.  */
 
 struct value *
-value_from_register (struct type *type, int regnum, struct frame_info *frame)
+value_from_register (struct type *type, struct gdbarch *val_arch,
+		     int regnum, struct frame_info *frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct type *type1 = check_typedef (type);
@@ -606,7 +607,7 @@ value_from_register (struct type *type, 
          the corresponding [integer] type (see Alpha).  The assumption
          is that gdbarch_register_to_value populates the entire value
          including the location.  */
-      v = allocate_value (type);
+      v = allocate_value (type, val_arch);
       VALUE_LVAL (v) = lval_register;
       VALUE_FRAME_ID (v) = get_frame_id (frame);
       VALUE_REGNUM (v) = regnum;
@@ -618,7 +619,7 @@ value_from_register (struct type *type, 
       int len = TYPE_LENGTH (type);
 
       /* Construct the value.  */
-      v = gdbarch_value_from_register (gdbarch, type, regnum, frame);
+      v = gdbarch_value_from_register (gdbarch, type, val_arch, regnum, frame);
 
       /* Get the data.  */
       if (!get_frame_register_bytes (frame, regnum, value_offset (v), len,
@@ -638,7 +639,7 @@ address_from_register (struct type *type
   struct value *value;
   CORE_ADDR result;
 
-  value = value_from_register (type, regnum, frame);
+  value = value_from_register (type, get_frame_arch (frame), regnum, frame);
   gdb_assert (value);
 
   result = value_as_address (value);
Index: gdb-head/gdb/frame-unwind.c
===================================================================
--- gdb-head.orig/gdb/frame-unwind.c
+++ gdb-head/gdb/frame-unwind.c
@@ -129,7 +129,7 @@ frame_unwind_got_optimized (struct frame
   struct gdbarch *gdbarch = frame_arch_unwind (frame);
   struct value *reg_val;
 
-  reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+  reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
   set_value_optimized_out (reg_val, 1);
   return reg_val;
 }
@@ -151,7 +151,7 @@ frame_unwind_got_memory (struct frame_in
 {
   struct gdbarch *gdbarch = frame_arch_unwind (frame);
 
-  return value_at_lazy (register_type (gdbarch, regnum), addr);
+  return value_at_lazy (register_type (gdbarch, regnum), gdbarch, addr);
 }
 
 /* Return a value which indicates that FRAME's saved version of
@@ -164,7 +164,7 @@ frame_unwind_got_constant (struct frame_
   struct gdbarch *gdbarch = frame_arch_unwind (frame);
   struct value *reg_val;
 
-  reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+  reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
   store_unsigned_integer (value_contents_writeable (reg_val),
 			  register_size (gdbarch, regnum), val);
   return reg_val;
@@ -176,7 +176,7 @@ frame_unwind_got_bytes (struct frame_inf
   struct gdbarch *gdbarch = frame_arch_unwind (frame);
   struct value *reg_val;
 
-  reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+  reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
   memcpy (value_contents_raw (reg_val), buf, register_size (gdbarch, regnum));
   return reg_val;
 }
@@ -192,7 +192,7 @@ frame_unwind_got_address (struct frame_i
   struct gdbarch *gdbarch = frame_arch_unwind (frame);
   struct value *reg_val;
 
-  reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
+  reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
   pack_long (value_contents_writeable (reg_val),
 	     register_type (gdbarch, regnum), addr);
   return reg_val;
Index: gdb-head/gdb/gcore.c
===================================================================
--- gdb-head.orig/gdb/gcore.c
+++ gdb-head/gdb/gcore.c
@@ -274,7 +274,8 @@ derive_heap_segment (bfd *abfd, bfd_vma 
   else
     return 0;
 
-  zero = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
+  zero = value_from_longest (builtin_type (gdbarch)->builtin_int,
+			     gdbarch, 0);
   gdb_assert (zero);
   sbrk = call_function_by_hand (sbrk, 1, &zero);
   if (sbrk == NULL)
Index: gdb-head/gdb/gnu-v2-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v2-abi.c
+++ gdb-head/gdb/gnu-v2-abi.c
@@ -89,6 +89,7 @@ gnuv2_virtual_fn_field (struct value **a
 {
   struct value *arg1 = *arg1p;
   struct type *type1 = check_typedef (value_type (arg1));
+  struct gdbarch *gdbarch = value_arch (arg1);
   struct type *entry_type;
   /* First, get the virtual function table pointer.  That comes
      with a strange type, so cast it to type `pointer to long' (which
@@ -97,7 +98,7 @@ gnuv2_virtual_fn_field (struct value **a
   struct value *entry;
   struct value *vfn;
   struct value *vtbl;
-  struct value *vi = value_from_longest (builtin_type_int32,
+  struct value *vi = value_from_longest (builtin_type_int32, gdbarch,
 				     (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j));
   struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j);
   struct type *context;
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -264,7 +264,7 @@ gnuv3_rtti_type (struct value *value,
   vtable_address
     = value_as_address (value_field (value, values_type_vptr_fieldno));
   vtable
-    = value_at_lazy (vtable_type,
+    = value_at_lazy (vtable_type, gdbarch,
 		     vtable_address - vtable_address_point_offset (gdbarch));
   
   /* Find the linker symbol for this vtable.  */
@@ -338,12 +338,13 @@ gnuv3_get_vtable (struct gdbarch *gdbarc
 
   /* Load it from the start of the class.  */
   vtable_pointer_address = value_as_address (value_addr (container));
-  vtable_pointer = value_at (vtable_pointer_type, vtable_pointer_address);
+  vtable_pointer = value_at (vtable_pointer_type, gdbarch,
+			     vtable_pointer_address);
   vtable_address = value_as_address (vtable_pointer);
 
   /* Correct it to point at the start of the virtual table, rather
      than the address point.  */
-  return value_at_lazy (vtable_type,
+  return value_at_lazy (vtable_type, gdbarch,
 			vtable_address - vtable_address_point_offset (gdbarch));
 }
 
@@ -359,7 +360,8 @@ gnuv3_get_virtual_fn (struct gdbarch *gd
 
   /* Fetch the appropriate function pointer from the vtable.  */
   vfn = value_subscript (value_field (vtable, vtable_field_virtual_functions),
-                         value_from_longest (builtin_type_int32, vtable_index));
+                         value_from_longest (builtin_type_int32, gdbarch,
+					     vtable_index));
 
   /* If this architecture uses function descriptors directly in the vtable,
      then the address of the vtable entry is actually a "function pointer"
@@ -467,11 +469,13 @@ gnuv3_baseclass_offset (struct type *typ
     error (_("Illegal vptr offset in class %s"),
 	   TYPE_NAME (vbasetype) ? TYPE_NAME (vbasetype) : "<unknown>");
 
-  vtable_address = value_as_address (value_at_lazy (ptr_type, address));
+  vtable_address
+    = value_as_address (value_at_lazy (ptr_type, gdbarch, address));
   vtable
-    = value_at_lazy (vtable_type,
+    = value_at_lazy (vtable_type, gdbarch,
 		     vtable_address - vtable_address_point_offset (gdbarch));
-  offset_val = value_from_longest (builtin_type_int32, cur_base_offset);
+  offset_val = value_from_longest (builtin_type_int32, gdbarch,
+				   cur_base_offset);
   vbase_array = value_field (vtable, vtable_field_vcall_and_vbase_offsets);
   base_offset = value_as_long (value_subscript (vbase_array, offset_val));
   return base_offset;
@@ -724,7 +728,7 @@ gnuv3_method_ptr_to_value (struct value 
      instance.  */
   *this_p = value_cast (builtin_type (gdbarch)->builtin_data_ptr, *this_p);
   adjval = value_from_longest (builtin_type (gdbarch)->builtin_long,
-			       adjustment);
+			       gdbarch, adjustment);
   *this_p = value_ptradd (*this_p, adjval);
   *this_p = value_cast (final_type, *this_p);
 
@@ -736,7 +740,8 @@ gnuv3_method_ptr_to_value (struct value 
 				   method_type, voffset);
     }
   else
-    return value_from_pointer (lookup_pointer_type (method_type), ptr_value);
+    return value_from_pointer (lookup_pointer_type (method_type),
+			       gdbarch, ptr_value);
 }
 
 /* Determine if we are currently in a C++ thunk.  If so, get the address
Index: gdb-head/gdb/infcall.c
===================================================================
--- gdb-head.orig/gdb/infcall.c
+++ gdb-head/gdb/infcall.c
@@ -206,6 +206,7 @@ value_arg_coerce (struct gdbarch *gdbarc
 CORE_ADDR
 find_function_addr (struct value *function, struct type **retval_type)
 {
+  struct gdbarch *gdbarch = value_arch (function);
   struct type *ftype = check_typedef (value_type (function));
   enum type_code code = TYPE_CODE (ftype);
   struct type *value_type = NULL;
@@ -227,7 +228,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 = gdbarch_convert_from_func_ptr_addr (gdbarch,
 							funaddr,
 							&current_target);
 	  value_type = TYPE_TARGET_TYPE (ftype);
@@ -249,7 +250,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 = gdbarch_convert_from_func_ptr_addr (gdbarch,
 							    funaddr,
 							    &current_target);
 	      if (funaddr != nfunaddr)
@@ -265,7 +266,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
@@ -674,7 +675,7 @@ call_function_by_hand (struct value *fun
       /* Add the new argument to the front of the argument list.  */
       new_args = xmalloc (sizeof (struct value *) * (nargs + 1));
       new_args[0] = value_from_pointer (lookup_pointer_type (values_type),
-					struct_addr);
+					gdbarch, struct_addr);
       memcpy (&new_args[1], &args[0], sizeof (struct value *) * nargs);
       args = new_args;
       nargs++;
@@ -925,12 +926,12 @@ When the function is done executing, GDB
     /* Figure out the value returned by the function.  */
 
     if (lang_struct_return)
-      retval = value_at (values_type, struct_addr);
+      retval = value_at (values_type, gdbarch, struct_addr);
     else if (TYPE_CODE (target_values_type) == TYPE_CODE_VOID)
       {
 	/* If the function returns void, don't bother fetching the
 	   return value.  */
-	retval = allocate_value (values_type);
+	retval = allocate_value (values_type, gdbarch);
       }
     else
       {
@@ -940,12 +941,12 @@ When the function is done executing, GDB
 	  case RETURN_VALUE_REGISTER_CONVENTION:
 	  case RETURN_VALUE_ABI_RETURNS_ADDRESS:
 	  case RETURN_VALUE_ABI_PRESERVES_ADDRESS:
-	    retval = allocate_value (values_type);
+	    retval = allocate_value (values_type, gdbarch);
 	    gdbarch_return_value (gdbarch, value_type (function), values_type,
 				  retbuf, value_contents_raw (retval), NULL);
 	    break;
 	  case RETURN_VALUE_STRUCT_CONVENTION:
-	    retval = value_at (values_type, struct_addr);
+	    retval = value_at (values_type, gdbarch, struct_addr);
 	    break;
 	  }
       }
Index: gdb-head/gdb/jv-lang.c
===================================================================
--- gdb-head.orig/gdb/jv-lang.c
+++ gdb-head/gdb/jv-lang.c
@@ -228,7 +228,7 @@ java_class_from_object (struct value *ob
   if (TYPE_CODE (value_type (obj_val)) == TYPE_CODE_PTR
       && TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (obj_val))) == 0)
     obj_val = value_at (get_java_object_type (),
-			value_as_address (obj_val));
+			value_arch (obj_val), value_as_address (obj_val));
 
   vtable_val = value_struct_elt (&obj_val, NULL, "vtable", NULL, "structure");
   return value_struct_elt (&vtable_val, NULL, "class", NULL, "structure");
@@ -898,7 +898,7 @@ evaluate_subexp_java (struct type *expec
 	    el_type = lookup_pointer_type (el_type);
 
 	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	    return value_zero (el_type, VALUE_LVAL (arg1));
+	    return value_zero (el_type, value_arch (arg1), VALUE_LVAL (arg1));
 	  address = value_as_address (arg1);
 	  address += JAVA_OBJECT_SIZE;
 	  read_memory (address, buf4, 4);
@@ -908,12 +908,13 @@ evaluate_subexp_java (struct type *expec
 	    error (_("array index (%ld) out of bounds (length: %ld)"),
 		   index, length);
 	  address = (address + 4) + index * TYPE_LENGTH (el_type);
-	  return value_at (el_type, address);
+	  return value_at (el_type, value_arch (arg1), address);
 	}
       else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
 	{
 	  if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	    return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
+	    return value_zero (TYPE_TARGET_TYPE (type),
+			       value_arch (arg1), VALUE_LVAL (arg1));
 	  else
 	    return value_subscript (arg1, arg2);
 	}
@@ -942,7 +943,7 @@ evaluate_subexp_java (struct type *expec
 standard:
   return evaluate_subexp_standard (expect_type, exp, pos, noside);
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type_int8, exp->gdbarch, 1);
 }
 
 static char *java_demangle (const char *mangled, int options)
Index: gdb-head/gdb/linux-fork.c
===================================================================
--- gdb-head.orig/gdb/linux-fork.c
+++ gdb-head/gdb/linux-fork.c
@@ -596,7 +596,8 @@ checkpoint_command (char *args, int from
   if (!fork_fn)
     error (_("checkpoint: can't find fork function in inferior."));
 
-  ret = value_from_longest (builtin_type (gdbarch)->builtin_int, 0);
+  ret = value_from_longest (builtin_type (gdbarch)->builtin_int,
+			    gdbarch, 0);
   old_chain = save_detach_fork (&temp_detach_fork);
   detach_fork = 0;
   ret = call_function_by_hand (fork_fn, 0, &ret);
Index: gdb-head/gdb/m2-lang.c
===================================================================
--- gdb-head.orig/gdb/m2-lang.c
+++ gdb-head/gdb/m2-lang.c
@@ -103,7 +103,8 @@ m2_printchar (int c, struct type *type, 
    be replaced with a true Modula version.  */
 
 static void
-m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+m2_printstr (struct ui_file *stream, struct type *type,
+	     struct gdbarch *gdbarch, const gdb_byte *string,
 	     unsigned int length, int force_ellipses,
 	     const struct value_print_options *options)
 {
@@ -266,7 +267,8 @@ evaluate_subexp_modula2 (struct type *ex
 	  }
 
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	return value_zero (TYPE_TARGET_TYPE (type), VALUE_LVAL (arg1));
+	return value_zero (TYPE_TARGET_TYPE (type),
+			   value_arch (arg1), VALUE_LVAL (arg1));
       else
 	return value_subscript (arg1, arg2);
 
@@ -275,7 +277,7 @@ evaluate_subexp_modula2 (struct type *ex
     }
 
  nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type_int8, exp->gdbarch, 1);
 }
 
 
Index: gdb-head/gdb/objc-lang.c
===================================================================
--- gdb-head.orig/gdb/objc-lang.c
+++ gdb-head/gdb/objc-lang.c
@@ -130,7 +130,8 @@ lookup_objc_class (struct gdbarch *gdbar
       return 0;
     }
 
-  classval = value_string (classname, strlen (classname) + 1, char_type);
+  classval = value_string (gdbarch,
+			   classname, strlen (classname) + 1, char_type);
   classval = value_coerce_array (classval);
   return (CORE_ADDR) value_as_long (call_function_by_hand (function, 
 							   1, &classval));
@@ -158,7 +159,7 @@ lookup_child_selector (struct gdbarch *g
       return 0;
     }
 
-  selstring = value_coerce_array (value_string (selname, 
+  selstring = value_coerce_array (value_string (gdbarch, selname,
 						strlen (selname) + 1, char_type));
   return value_as_long (call_function_by_hand (function, 1, &selstring));
 }
@@ -175,7 +176,7 @@ value_nsstring (struct gdbarch *gdbarch,
   if (!target_has_execution)
     return 0;		/* Can't call into inferior to create NSString.  */
 
-  stringValue[2] = value_string(ptr, len, char_type);
+  stringValue[2] = value_string(gdbarch, ptr, len, char_type);
   stringValue[2] = value_coerce_array(stringValue[2]);
   /* _NSNewStringFromCString replaces "istr" after Lantern2A.  */
   if (lookup_minimal_symbol("_NSNewStringFromCString", 0, 0))
@@ -195,9 +196,9 @@ value_nsstring (struct gdbarch *gdbarch,
       type = builtin_type (gdbarch)->builtin_long;
 
       stringValue[0] = value_from_longest 
-	(type, lookup_objc_class (gdbarch, "NSString"));
+	(type, gdbarch, lookup_objc_class (gdbarch, "NSString"));
       stringValue[1] = value_from_longest 
-	(type, lookup_child_selector (gdbarch, "stringWithCString:"));
+	(type, gdbarch, lookup_child_selector (gdbarch, "stringWithCString:"));
       nsstringValue = call_function_by_hand(function, 3, &stringValue[0]);
     }
   else
@@ -343,8 +344,8 @@ objc_printchar (int c, struct type *type
 
 static void
 objc_printstr (struct ui_file *stream, struct type *type,
-	       const gdb_byte *string, unsigned int length,
-	       int force_ellipses,
+	       struct gdbarch *gdbarch, const gdb_byte *string,
+	       unsigned int length, int force_ellipses,
 	       const struct value_print_options *options)
 {
   unsigned int i;
Index: gdb-head/gdb/python/python-value.c
===================================================================
--- gdb-head.orig/gdb/python/python-value.c
+++ gdb-head/gdb/python/python-value.c
@@ -437,6 +437,7 @@ valpy_binop (enum valpy_opcode opcode, P
 		    /* A ptrdiff_t for the target would be preferable
 		       here.  */
 		    res_val = value_from_longest (builtin_type_pyint,
+						  python_gdbarch,
 						  value_ptrdiff (arg1, arg2));
 		else
 		  res_val = value_ptrsub (arg1, arg2);
@@ -552,7 +553,7 @@ static PyObject *
 valpy_absolute (PyObject *self)
 {
   if (value_less (((value_object *) self)->value,
-		  value_from_longest (builtin_type_int8, 0)))
+		  value_from_longest (builtin_type_int8, python_gdbarch, 0)))
     return valpy_negative (self);
   else
     return valpy_positive (self);
@@ -839,28 +840,32 @@ convert_value_from_python (PyObject *obj
 	{
 	  cmp = PyObject_IsTrue (obj);
 	  if (cmp >= 0)
-	    value = value_from_longest (builtin_type_pybool, cmp);
+	    value = value_from_longest (builtin_type_pybool,
+					python_gdbarch, cmp);
 	}
       else if (PyInt_Check (obj))
 	{
 	  long l = PyInt_AsLong (obj);
 
 	  if (! PyErr_Occurred ())
-	    value = value_from_longest (builtin_type_pyint, l);
+	    value = value_from_longest (builtin_type_pyint,
+					python_gdbarch, l);
 	}
       else if (PyLong_Check (obj))
 	{
 	  LONGEST l = PyLong_AsLongLong (obj);
 
 	  if (! PyErr_Occurred ())
-	    value = value_from_longest (builtin_type_pylong, l);
+	    value = value_from_longest (builtin_type_pylong,
+					python_gdbarch, l);
 	}
       else if (PyFloat_Check (obj))
 	{
 	  double d = PyFloat_AsDouble (obj);
 
 	  if (! PyErr_Occurred ())
-	    value = value_from_double (builtin_type_pyfloat, d);
+	    value = value_from_double (builtin_type_pyfloat,
+				       python_gdbarch, d);
 	}
       else if (gdbpy_is_string (obj))
 	{
@@ -870,7 +875,8 @@ convert_value_from_python (PyObject *obj
 	  if (s != NULL)
 	    {
 	      old = make_cleanup (xfree, s);
-	      value = value_cstring (s, strlen (s), builtin_type_pychar);
+	      value = value_cstring (python_gdbarch, s, strlen (s),
+				     builtin_type_pychar);
 	      do_cleanups (old);
 	    }
 	}
Index: gdb-head/gdb/scm-lang.c
===================================================================
--- gdb-head.orig/gdb/scm-lang.c
+++ gdb-head/gdb/scm-lang.c
@@ -47,7 +47,8 @@ scm_printchar (int c, struct type *type,
 }
 
 static void
-scm_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+scm_printstr (struct ui_file *stream, struct type *type,
+	      struct gdbarch *gdbarch, const gdb_byte *string,
 	      unsigned int length, int force_ellipses,
 	      const struct value_print_options *options)
 {
@@ -155,18 +156,19 @@ scm_lookup_name (struct gdbarch *gdbarch
   func = find_function_in_inferior (gdbarch, "scm_lookup_cstr");
 
   args[0] = value_allocate_space_in_inferior (gdbarch, len);
-  args[1] = value_from_longest (builtin_type (gdbarch)->builtin_int, len);
+  args[1] = value_from_longest (builtin_type (gdbarch)->builtin_int,
+				gdbarch, len);
   write_memory (value_as_long (args[0]), (gdb_byte *) str, len);
 
   if (in_eval_c ()
       && (sym = lookup_symbol ("env",
 			       expression_context_block,
 			       VAR_DOMAIN, (int *) NULL)) != NULL)
-    args[2] = value_of_variable (sym, expression_context_block);
+    args[2] = value_of_variable (sym, gdbarch, expression_context_block);
   else
     /* FIXME in this case, we should try lookup_symbol first */
     args[2] = value_from_longest (builtin_scm_type (gdbarch)->builtin_scm,
-				  SCM_EOL);
+				  gdbarch, SCM_EOL);
 
   val = call_function_by_hand (func, 3, args);
   if (!value_logical_not (val))
@@ -176,7 +178,7 @@ scm_lookup_name (struct gdbarch *gdbarch
 		       expression_context_block,
 		       VAR_DOMAIN, (int *) NULL);
   if (sym)
-    return value_of_variable (sym, NULL);
+    return value_of_variable (sym, gdbarch, NULL);
   error (_("No symbol \"%s\" in current context."), str);
 }
 
@@ -222,7 +224,7 @@ evaluate_exp (struct type *expect_type, 
     }
   return evaluate_subexp_standard (expect_type, exp, pos, noside);
 nosideret:
-  return value_from_longest (builtin_type_int8, (LONGEST) 1);
+  return value_from_longest (builtin_type_int8, exp->gdbarch, (LONGEST) 1);
 }
 
 const struct exp_descriptor exp_descriptor_scm = 
Index: gdb-head/gdb/sentinel-frame.c
===================================================================
--- gdb-head.orig/gdb/sentinel-frame.c
+++ gdb-head/gdb/sentinel-frame.c
@@ -52,7 +52,7 @@ sentinel_frame_prev_register (struct fra
   struct value *value;
 
   /* Return the actual value.  */
-  value = allocate_value (register_type (gdbarch, regnum));
+  value = allocate_value (register_type (gdbarch, regnum), gdbarch);
   VALUE_LVAL (value) = lval_register;
   VALUE_REGNUM (value) = regnum;
   VALUE_FRAME_ID (value) = get_frame_id (this_frame);
Index: gdb-head/gdb/sparc-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc-tdep.c
+++ gdb-head/gdb/sparc-tdep.c
@@ -427,7 +427,8 @@ sparc32_store_arguments (struct regcache
 	  sp &= ~0x7;
 
 	  write_memory (sp, value_contents (args[i]), len);
-	  args[i] = value_from_pointer (lookup_pointer_type (type), sp);
+	  args[i] = value_from_pointer (lookup_pointer_type (type),
+					value_arch (args[i]), sp);
 	  num_elements++;
 	}
       else if (sparc_floating_p (type))
Index: gdb-head/gdb/sparc64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sparc64-tdep.c
+++ gdb-head/gdb/sparc64-tdep.c
@@ -733,7 +733,8 @@ sparc64_store_arguments (struct regcache
 	      sp &= ~0xf;
 
 	      write_memory (sp, value_contents (args[i]), len);
-	      args[i] = value_from_pointer (lookup_pointer_type (type), sp);
+	      args[i] = value_from_pointer (lookup_pointer_type (type),
+					    value_arch (args[i]), sp);
 	      num_elements++;
 	    }
 	}
Index: gdb-head/gdb/std-regs.c
===================================================================
--- gdb-head.orig/gdb/std-regs.c
+++ gdb-head/gdb/std-regs.c
@@ -43,7 +43,7 @@ value_of_builtin_frame_fp_reg (struct fr
   else
     {
       struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
-      struct value *val = allocate_value (data_ptr_type);
+      struct value *val = allocate_value (data_ptr_type, gdbarch);
       gdb_byte *buf = value_contents_raw (val);
       if (frame == NULL)
 	memset (buf, 0, TYPE_LENGTH (value_type (val)));
@@ -63,7 +63,7 @@ value_of_builtin_frame_pc_reg (struct fr
   else
     {
       struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
-      struct value *val = allocate_value (func_ptr_type);
+      struct value *val = allocate_value (func_ptr_type, gdbarch);
       gdb_byte *buf = value_contents_raw (val);
       if (frame == NULL)
 	memset (buf, 0, TYPE_LENGTH (value_type (val)));
Index: gdb-head/gdb/symtab.h
===================================================================
--- gdb-head.orig/gdb/symtab.h
+++ gdb-head/gdb/symtab.h
@@ -504,13 +504,14 @@ enum address_class
 struct symbol_computed_ops
 {
 
-  /* Return the value of the variable SYMBOL, relative to the stack
-     frame FRAME.  If the variable has been optimized out, return
-     zero.
+  /* Return the value in GDBARCH of the variable SYMBOL, relative
+     to the stack frame FRAME.  If the variable has been optimized out,
+     return zero.
 
      Iff `read_needs_frame (SYMBOL)' is zero, then FRAME may be zero.  */
 
   struct value *(*read_variable) (struct symbol * symbol,
+				  struct gdbarch * gdbarch,
 				  struct frame_info * frame);
 
   /* Return non-zero if we need a frame to find the value of the SYMBOL.  */
Index: gdb-head/gdb/tracepoint.c
===================================================================
--- gdb-head.orig/gdb/tracepoint.c
+++ gdb-head/gdb/tracepoint.c
@@ -226,6 +226,7 @@ set_tracepoint_num (int num)
 static void
 set_traceframe_context (struct frame_info *trace_frame)
 {
+  struct gdbarch *gdbarch;
   CORE_ADDR trace_pc;
 
   static struct type *func_string, *file_string;
@@ -246,6 +247,7 @@ set_traceframe_context (struct frame_inf
     }
 
   /* Save as globals for internal use.  */
+  gdbarch = get_frame_arch (trace_frame);
   trace_pc = get_frame_pc (trace_frame);
   traceframe_sal = find_pc_line (trace_pc, 0);
   traceframe_fun = find_pc_function (trace_pc);
@@ -267,7 +269,7 @@ set_traceframe_context (struct frame_inf
 				      builtin_type_int32, 0, len - 1);
       func_string = create_array_type (func_string,
 				       builtin_type_true_char, func_range);
-      func_val = allocate_value (func_string);
+      func_val = allocate_value (func_string, gdbarch);
       deprecated_set_value_type (func_val, func_string);
       memcpy (value_contents_raw (func_val),
 	      SYMBOL_LINKAGE_NAME (traceframe_fun),
@@ -288,7 +290,7 @@ set_traceframe_context (struct frame_inf
 				      builtin_type_int32, 0, len - 1);
       file_string = create_array_type (file_string,
 				       builtin_type_true_char, file_range);
-      file_val = allocate_value (file_string);
+      file_val = allocate_value (file_string, gdbarch);
       deprecated_set_value_type (file_val, file_string);
       memcpy (value_contents_raw (file_val),
 	      traceframe_sal.symtab->filename,
Index: gdb-head/gdb/valarith.c
===================================================================
--- gdb-head.orig/gdb/valarith.c
+++ gdb-head/gdb/valarith.c
@@ -97,7 +97,7 @@ value_ptradd (struct value *arg1, struct
   if (!is_integral_type (value_type (arg2)))
     error (_("Argument to arithmetic operation not a number or boolean."));
 
-  return value_from_pointer (valptrtype,
+  return value_from_pointer (valptrtype, value_arch (arg1),
 			     value_as_address (arg1)
 			       + (sz * value_as_long (arg2)));
 }
@@ -118,7 +118,7 @@ value_ptrsub (struct value *arg1, struct
   if (!is_integral_type (value_type (arg2)))
     error (_("Argument to arithmetic operation not a number or boolean."));
 
-  return value_from_pointer (valptrtype,
+  return value_from_pointer (valptrtype, value_arch (arg1),
 			     value_as_address (arg1)
 			       - (sz * value_as_long (arg2)));
 }
@@ -196,7 +196,8 @@ value_subscript (struct value *array, st
 
       if (lowerbound != 0)
 	{
-	  bound = value_from_longest (value_type (idx), (LONGEST) lowerbound);
+	  bound = value_from_longest (value_type (idx), value_arch (idx),
+				      (LONGEST) lowerbound);
 	  idx = value_binop (idx, bound, BINOP_SUB);
 	}
 
@@ -226,7 +227,7 @@ value_subscripted_rvalue (struct value *
   if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type))
     error (_("no such vector element"));
 
-  v = allocate_value (elt_type);
+  v = allocate_value (elt_type, value_arch (array));
   if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
     set_value_lazy (v, 1);
   else
@@ -266,10 +267,10 @@ 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 (value_arch (bitstring)) ?
 	    TARGET_CHAR_BIT - 1 - bit_index : bit_index);
 
-  v = value_from_longest (type, byte & 1);
+  v = value_from_longest (type, value_arch (bitstring), byte & 1);
 
   set_value_bitpos (v, bit_index);
   set_value_bitsize (v, 1);
@@ -485,7 +486,8 @@ value_x_binop (struct value *arg1, struc
 	  struct type *return_type;
 	  return_type
 	    = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
-	  return value_zero (return_type, VALUE_LVAL (arg1));
+	  return value_zero (return_type,
+			     value_arch (arg1), VALUE_LVAL (arg1));
 	}
       return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1);
     }
@@ -538,13 +540,13 @@ value_x_unop (struct value *arg1, enum e
       break;
     case UNOP_POSTINCREMENT:
       strcpy (ptr, "++");
-      argvec[2] = value_from_longest (builtin_type_int8, 0);
+      argvec[2] = value_from_longest (builtin_type_int8, value_arch (arg1), 0);
       argvec[3] = 0;
       nargs ++;
       break;
     case UNOP_POSTDECREMENT:
       strcpy (ptr, "--");
-      argvec[2] = value_from_longest (builtin_type_int8, 0);
+      argvec[2] = value_from_longest (builtin_type_int8, value_arch (arg1), 0);
       argvec[3] = 0;
       nargs ++;
       break;
@@ -582,7 +584,8 @@ value_x_unop (struct value *arg1, enum e
 	  struct type *return_type;
 	  return_type
 	    = TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
-	  return value_zero (return_type, VALUE_LVAL (arg1));
+	  return value_zero (return_type,
+			     value_arch (arg1), VALUE_LVAL (arg1));
 	}
       return call_function_by_hand (argvec[0], nargs, argvec + 1);
     }
@@ -677,7 +680,8 @@ value_concat (struct value *arg1, struct
 			  inval2len);
 		}
 	    }
-	  outval = value_string (ptr, count * inval2len, char_type);
+	  outval = value_string (value_arch (inval2),
+				 ptr, count * inval2len, char_type);
 	}
       else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
 	       || TYPE_CODE (type2) == TYPE_CODE_BOOL)
@@ -720,7 +724,8 @@ value_concat (struct value *arg1, struct
 	{
 	  memcpy (ptr + inval1len, value_contents (inval2), inval2len);
 	}
-      outval = value_string (ptr, inval1len + inval2len, char_type);
+      outval = value_string (value_arch (inval1),
+			     ptr, inval1len + inval2len, char_type);
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
 	   || TYPE_CODE (type1) == TYPE_CODE_BOOL)
@@ -869,6 +874,7 @@ value_binop (struct value *arg1, struct 
 {
   struct value *val;
   struct type *type1, *type2, *result_type;
+  struct gdbarch *result_arch;
 
   arg1 = coerce_ref (arg1);
   arg2 = coerce_ref (arg2);
@@ -895,13 +901,13 @@ value_binop (struct value *arg1, struct 
       /* If only one type is decimal float, use its type.
 	 Otherwise use the bigger type.  */
       if (TYPE_CODE (type1) != TYPE_CODE_DECFLOAT)
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else if (TYPE_CODE (type2) != TYPE_CODE_DECFLOAT)
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
       else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1))
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
 
       len_v = TYPE_LENGTH (result_type);
 
@@ -921,7 +927,7 @@ value_binop (struct value *arg1, struct 
 	  error (_("Operation not valid for decimal floating point number."));
 	}
 
-      val = value_from_decfloat (result_type, v);
+      val = value_from_decfloat (result_type, result_arch, v);
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_FLT
 	   || TYPE_CODE (type2) == TYPE_CODE_FLT)
@@ -973,15 +979,15 @@ value_binop (struct value *arg1, struct 
       /* If only one type is float, use its type.
 	 Otherwise use the bigger type.  */
       if (TYPE_CODE (type1) != TYPE_CODE_FLT)
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else if (TYPE_CODE (type2) != TYPE_CODE_FLT)
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
       else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1))
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
 
-      val = allocate_value (result_type);
+      val = allocate_value (result_type, result_arch);
       store_typed_floating (value_contents_raw (val), value_type (val), v);
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
@@ -1018,8 +1024,9 @@ value_binop (struct value *arg1, struct 
 	}
 
       result_type = type1;
+      result_arch = value_arch (arg1);
 
-      val = allocate_value (result_type);
+      val = allocate_value (result_type, result_arch);
       store_signed_integer (value_contents_raw (val),
 			    TYPE_LENGTH (result_type),
 			    v);
@@ -1034,17 +1041,17 @@ value_binop (struct value *arg1, struct 
 	 If both operands are of equal length, use unsigned operation
 	 if one of the operands is unsigned.  */
       if (op == BINOP_RSH || op == BINOP_LSH || op == BINOP_EXP)
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
       else if (TYPE_LENGTH (type1) > TYPE_LENGTH (type2))
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
       else if (TYPE_LENGTH (type2) > TYPE_LENGTH (type1))
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else if (TYPE_UNSIGNED (type1))
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
       else if (TYPE_UNSIGNED (type2))
-	result_type = type2;
+	result_type = type2, result_arch = value_arch (arg2);
       else
-	result_type = type1;
+	result_type = type1, result_arch = value_arch (arg1);
 
       if (TYPE_UNSIGNED (result_type))
 	{
@@ -1153,7 +1160,7 @@ value_binop (struct value *arg1, struct 
 	      error (_("Invalid binary operation on numbers."));
 	    }
 
-	  val = allocate_value (result_type);
+	  val = allocate_value (result_type, result_arch);
 	  store_unsigned_integer (value_contents_raw (val),
 				  TYPE_LENGTH (value_type (val)),
 				  v);
@@ -1264,7 +1271,7 @@ value_binop (struct value *arg1, struct 
 	      error (_("Invalid binary operation on numbers."));
 	    }
 
-	  val = allocate_value (result_type);
+	  val = allocate_value (result_type, result_arch);
 	  store_signed_integer (value_contents_raw (val),
 				TYPE_LENGTH (value_type (val)),
 				v);
@@ -1481,18 +1488,17 @@ value_pos (struct value *arg1)
   type = check_typedef (value_type (arg1));
 
   if (TYPE_CODE (type) == TYPE_CODE_FLT)
-    return value_from_double (type, value_as_double (arg1));
+    return value_from_double (type, value_arch (arg1),
+			      value_as_double (arg1));
   else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
-    return value_from_decfloat (type, value_contents (arg1));
+    return value_from_decfloat (type, value_arch (arg1),
+				value_contents (arg1));
   else if (is_integral_type (type))
-    {
-      return value_from_longest (type, value_as_long (arg1));
-    }
-  else
-    {
-      error ("Argument to positive operation not a number.");
-      return 0;			/* For lint -- never reached */
-    }
+    return value_from_longest (type, value_arch (arg1),
+			       value_as_long (arg1));
+
+  error ("Argument to positive operation not a number.");
+  return 0;			/* For lint -- never reached */
 }
 
 struct value *
@@ -1505,13 +1511,13 @@ value_neg (struct value *arg1)
 
   if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
     {
-      struct value *val = allocate_value (type);
+      struct value *val = allocate_value (type, value_arch (arg1));
       int len = TYPE_LENGTH (type);
       gdb_byte decbytes[16];  /* a decfloat is at most 128 bits long */
 
       memcpy (decbytes, value_contents (arg1), len);
 
-      if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE)
+      if (gdbarch_byte_order (value_arch (arg1)) == BFD_ENDIAN_LITTLE)
 	decbytes[len-1] = decbytes[len - 1] | 0x80;
       else
 	decbytes[0] = decbytes[0] | 0x80;
@@ -1520,16 +1526,14 @@ value_neg (struct value *arg1)
       return val;
     }
   else if (TYPE_CODE (type) == TYPE_CODE_FLT)
-    return value_from_double (type, -value_as_double (arg1));
+    return value_from_double (type, value_arch (arg1),
+			      -value_as_double (arg1));
   else if (is_integral_type (type))
-    {
-      return value_from_longest (type, -value_as_long (arg1));
-    }
-  else
-    {
-      error (_("Argument to negate operation not a number."));
-      return 0;			/* For lint -- never reached */
-    }
+    return value_from_longest (type, value_arch (arg1),
+			       -value_as_long (arg1));
+
+  error (_("Argument to negate operation not a number."));
+  return 0;			/* For lint -- never reached */
 }
 
 struct value *
@@ -1543,7 +1547,7 @@ value_complement (struct value *arg1)
   if (!is_integral_type (type))
     error (_("Argument to complement operation not an integer or boolean."));
 
-  return value_from_longest (type, ~value_as_long (arg1));
+  return value_from_longest (type, value_arch (arg1), ~value_as_long (arg1));
 }
 
 /* The INDEX'th bit of SET value whose value_type is TYPE,
@@ -1551,7 +1555,8 @@ value_complement (struct value *arg1)
    Return -1 if out of range, -2 other error. */
 
 int
-value_bit_index (struct type *type, const gdb_byte *valaddr, int index)
+value_bit_index (struct type *type, struct gdbarch *gdbarch,
+		 const gdb_byte *valaddr, int index)
 {
   LONGEST low_bound, high_bound;
   LONGEST word;
@@ -1564,7 +1569,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;
 }
@@ -1584,7 +1589,7 @@ value_in (struct value *element, struct 
       && TYPE_CODE (eltype) != TYPE_CODE_ENUM
       && TYPE_CODE (eltype) != TYPE_CODE_BOOL)
     error (_("First argument of 'IN' has wrong type"));
-  member = value_bit_index (settype, value_contents (set),
+  member = value_bit_index (settype, value_arch (set), value_contents (set),
 			    value_as_long (element));
   if (member < 0)
     error (_("First argument of 'IN' not in range"));
Index: gdb-head/gdb/valops.c
===================================================================
--- gdb-head.orig/gdb/valops.c
+++ gdb-head/gdb/valops.c
@@ -83,16 +83,19 @@ static enum
 oload_classification classify_oload_match (struct badness_vector *,
 					   int, int);
 
-static struct value *value_struct_elt_for_reference (struct type *,
+static struct value *value_struct_elt_for_reference (struct gdbarch *,
+						     struct type *,
 						     int, struct type *,
 						     char *,
 						     struct type *,
 						     int, enum noside);
 
 static struct value *value_namespace_elt (const struct type *,
+					  struct gdbarch *,
 					  char *, int , enum noside);
 
 static struct value *value_maybe_namespace_elt (const struct type *,
+						struct gdbarch *,
 						char *, int,
 						enum noside);
 
@@ -137,7 +140,7 @@ find_function_in_inferior (struct gdbarc
 		 name);
 	}
 
-      return value_of_variable (sym, NULL);
+      return value_of_variable (sym, gdbarch, NULL);
     }
   else
     {
@@ -152,7 +155,7 @@ find_function_in_inferior (struct gdbarc
 	  type = lookup_pointer_type (type);
 	  maddr = SYMBOL_VALUE_ADDRESS (msymbol);
 
-	  return value_from_pointer (type, maddr);
+	  return value_from_pointer (type, gdbarch, maddr);
 	}
       else
 	{
@@ -174,7 +177,8 @@ value_allocate_space_in_inferior (struct
   struct value *val = find_function_in_inferior (gdbarch, "malloc");
   struct value *blocklen;
 
-  blocklen = value_from_longest (builtin_type (gdbarch)->builtin_int, len);
+  blocklen = value_from_longest (builtin_type (gdbarch)->builtin_int,
+				 gdbarch, len);
   val = call_function_by_hand (val, 1, &blocklen);
   if (value_logical_not (val))
     {
@@ -229,13 +233,14 @@ value_cast_structs (struct type *type, s
   if (TYPE_NAME (t2) != NULL)
     {
       v = search_struct_field (type_name_no_tag (t2),
-			       value_zero (t1, not_lval), 0, t1, 1);
+			       value_zero (t1, value_arch (v2), not_lval),
+			       0, t1, 1);
       if (v)
 	{
 	  /* Downcasting is possible (t1 is superclass of v2).  */
 	  CORE_ADDR addr2 = value_address (v2);
 	  addr2 -= value_address (v) + value_embedded_offset (v);
-	  return value_at (type, addr2);
+	  return value_at (type, value_arch (v2), addr2);
 	}
     }
 
@@ -398,7 +403,7 @@ value_cast (struct type *type, struct va
     }
 
   if (code1 == TYPE_CODE_FLT && scalar)
-    return value_from_double (type, value_as_double (arg2));
+    return value_from_double (type, value_arch (arg2), value_as_double (arg2));
   else if (code1 == TYPE_CODE_DECFLOAT && scalar)
     {
       int dec_len = TYPE_LENGTH (type);
@@ -413,7 +418,7 @@ value_cast (struct type *type, struct va
 	/* The only option left is an integral type.  */
 	decimal_from_integral (arg2, dec, dec_len);
 
-      return value_from_decfloat (type, dec);
+      return value_from_decfloat (type, value_arch (arg2), dec);
     }
   else if ((code1 == TYPE_CODE_INT || code1 == TYPE_CODE_ENUM
 	    || code1 == TYPE_CODE_RANGE)
@@ -433,7 +438,7 @@ value_cast (struct type *type, struct va
                                             TYPE_LENGTH (type2));
       else
         longest = value_as_long (arg2);
-      return value_from_longest (type, convert_to_boolean ?
+      return value_from_longest (type, value_arch (arg2), convert_to_boolean ?
 				 (LONGEST) (longest ? 1 : 0) : longest);
     }
   else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT  
@@ -450,7 +455,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 (value_arch (arg2));
 
       LONGEST longest = value_as_long (arg2);
       if (addr_bit < sizeof (LONGEST) * HOST_CHAR_BIT)
@@ -459,12 +464,12 @@ value_cast (struct type *type, struct va
 	      || longest <= -((LONGEST) 1 << addr_bit))
 	    warning (_("value truncated"));
 	}
-      return value_from_longest (type, longest);
+      return value_from_longest (type, value_arch (arg2), longest);
     }
   else if (code1 == TYPE_CODE_METHODPTR && code2 == TYPE_CODE_INT
 	   && value_as_long (arg2) == 0)
     {
-      struct value *result = allocate_value (type);
+      struct value *result = allocate_value (type, value_arch (arg2));
       cplus_make_method_ptr (type, value_contents_writeable (result), 0, 0);
       return result;
     }
@@ -473,7 +478,7 @@ value_cast (struct type *type, struct va
     {
       /* The Itanium C++ ABI represents NULL pointers to members as
 	 minus one, instead of biasing the normal case.  */
-      return value_from_longest (type, -1);
+      return value_from_longest (type, value_arch (arg2), -1);
     }
   else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
     {
@@ -487,10 +492,10 @@ value_cast (struct type *type, struct va
       return arg2;
     }
   else if (VALUE_LVAL (arg2) == lval_memory)
-    return value_at_lazy (type, value_address (arg2));
+    return value_at_lazy (type, value_arch (arg2), value_address (arg2));
   else if (code1 == TYPE_CODE_VOID)
     {
-      return value_zero (builtin_type_void, not_lval);
+      return value_zero (builtin_type_void, value_arch (arg2), not_lval);
     }
   else
     {
@@ -502,9 +507,9 @@ value_cast (struct type *type, struct va
 /* Create a value of type TYPE that is zero, and return it.  */
 
 struct value *
-value_zero (struct type *type, enum lval_type lv)
+value_zero (struct type *type, struct gdbarch *gdbarch, enum lval_type lv)
 {
-  struct value *val = allocate_value (type);
+  struct value *val = allocate_value (type, gdbarch);
   VALUE_LVAL (val) = lv;
 
   return val;
@@ -513,27 +518,28 @@ value_zero (struct type *type, enum lval
 /* Create a value of numeric type TYPE that is one, and return it.  */
 
 struct value *
-value_one (struct type *type, enum lval_type lv)
+value_one (struct type *type, struct gdbarch *gdbarch, enum lval_type lv)
 {
   struct type *type1 = check_typedef (type);
   struct value *val = NULL; /* avoid -Wall warning */
 
   if (TYPE_CODE (type1) == TYPE_CODE_DECFLOAT)
     {
-      struct value *int_one = value_from_longest (builtin_type_int32, 1);
+      struct value *int_one = value_from_longest (builtin_type_int32,
+						  gdbarch, 1);
       struct value *val;
       gdb_byte v[16];
 
       decimal_from_integral (int_one, v, TYPE_LENGTH (builtin_type_int32));
-      val = value_from_decfloat (type, v);
+      val = value_from_decfloat (type, gdbarch, v);
     }
   else if (TYPE_CODE (type1) == TYPE_CODE_FLT)
     {
-      val = value_from_double (type, (DOUBLEST) 1);
+      val = value_from_double (type, gdbarch, (DOUBLEST) 1);
     }
   else if (is_integral_type (type1))
     {
-      val = value_from_longest (type, (LONGEST) 1);
+      val = value_from_longest (type, gdbarch, (LONGEST) 1);
     }
   else
     {
@@ -557,14 +563,14 @@ value_one (struct type *type, enum lval_
    adjustments before or after calling it.  */
 
 struct value *
-value_at (struct type *type, CORE_ADDR addr)
+value_at (struct type *type, struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   struct value *val;
 
   if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
     error (_("Attempt to dereference a generic pointer."));
 
-  val = allocate_value (type);
+  val = allocate_value (type, gdbarch);
 
   read_memory (addr, value_contents_all_raw (val), TYPE_LENGTH (type));
 
@@ -577,14 +583,14 @@ value_at (struct type *type, CORE_ADDR a
 /* Return a lazy value with type TYPE located at ADDR (cf. value_at).  */
 
 struct value *
-value_at_lazy (struct type *type, CORE_ADDR addr)
+value_at_lazy (struct type *type, struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   struct value *val;
 
   if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
     error (_("Attempt to dereference a generic pointer."));
 
-  val = allocate_value_lazy (type);
+  val = allocate_value_lazy (type, gdbarch);
 
   VALUE_LVAL (val) = lval_memory;
   set_value_address (val, addr);
@@ -790,7 +796,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 (value_arch (toval), buffer, value_as_long (fromval),
 			  value_bitpos (toval), value_bitsize (toval));
 	    changed_addr = value_address (toval);
 	    dest_buffer = buffer;
@@ -851,7 +857,8 @@ value_assign (struct value *toval, struc
 					  value_offset (toval),
 					  changed_len, buffer);
 
-		modify_field (buffer, value_as_long (fromval),
+		modify_field (value_arch (toval), buffer,
+			      value_as_long (fromval),
 			      value_bitpos (toval), 
 			      value_bitsize (toval));
 
@@ -932,7 +939,7 @@ value_assign (struct value *toval, struc
 	  && (fieldval & (valmask ^ (valmask >> 1))))
 	fieldval |= ~valmask;
 
-      fromval = value_from_longest (type, fieldval);
+      fromval = value_from_longest (type, value_arch (fromval), fieldval);
     }
 
   val = value_copy (toval);
@@ -959,7 +966,8 @@ value_repeat (struct value *arg1, int co
   if (count < 1)
     error (_("Invalid number %d of repetitions."), count);
 
-  val = allocate_repeat_value (value_enclosing_type (arg1), count);
+  val = allocate_repeat_value (value_enclosing_type (arg1),
+			       value_arch (arg1), count);
 
   read_memory (value_address (arg1),
 	       value_contents_all_raw (val),
@@ -971,7 +979,8 @@ value_repeat (struct value *arg1, int co
 }
 
 struct value *
-value_of_variable (struct symbol *var, struct block *b)
+value_of_variable (struct symbol *var, struct gdbarch *gdbarch,
+		   struct block *b)
 {
   struct value *val;
   struct frame_info *frame;
@@ -994,7 +1003,7 @@ value_of_variable (struct symbol *var, s
 	}
     }
 
-  val = read_var_value (var, frame);
+  val = read_var_value (var, gdbarch, frame);
   if (!val)
     error (_("Address of symbol \"%s\" is unknown."), SYMBOL_PRINT_NAME (var));
 
@@ -1002,7 +1011,8 @@ value_of_variable (struct symbol *var, s
 }
 
 struct value *
-address_of_variable (struct symbol *var, struct block *b)
+address_of_variable (struct symbol *var, struct gdbarch *gdbarch,
+		     struct block *b)
 {
   struct type *type = SYMBOL_TYPE (var);
   struct value *val;
@@ -1010,13 +1020,13 @@ address_of_variable (struct symbol *var,
   /* Evaluate it first; if the result is a memory address, we're fine.
      Lazy evaluation pays off here. */
 
-  val = value_of_variable (var, b);
+  val = value_of_variable (var, gdbarch, b);
 
   if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
       || TYPE_CODE (type) == TYPE_CODE_FUNC)
     {
       CORE_ADDR addr = value_address (val);
-      return value_from_pointer (lookup_pointer_type (type), addr);
+      return value_from_pointer (lookup_pointer_type (type), gdbarch, addr);
     }
 
   /* Not a memory address; check what the problem was.  */
@@ -1081,7 +1091,7 @@ value_must_coerce_to_target (struct valu
 struct value *
 value_coerce_to_target (struct value *val)
 {
-  struct gdbarch *gdbarch = current_gdbarch;
+  struct gdbarch *gdbarch = value_arch (val);
   LONGEST length;
   CORE_ADDR addr;
 
@@ -1091,7 +1101,7 @@ value_coerce_to_target (struct value *va
   length = TYPE_LENGTH (check_typedef (value_type (val)));
   addr = value_as_address (value_allocate_space_in_inferior (gdbarch, length));
   write_memory (addr, value_contents (val), length);
-  return value_at_lazy (value_type (val), addr);
+  return value_at_lazy (value_type (val), gdbarch, addr);
 }
 
 /* Given a value which is an array, return a value which is a pointer
@@ -1132,7 +1142,7 @@ value_coerce_array (struct value *arg1)
     error (_("Attempt to take address of value not located in memory."));
 
   return value_from_pointer (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
-			     value_address (arg1));
+			     value_arch (arg1), value_address (arg1));
 }
 
 /* Given a value which is a function, return a value which is a pointer
@@ -1147,7 +1157,7 @@ value_coerce_function (struct value *arg
     error (_("Attempt to take address of value not located in memory."));
 
   retval = value_from_pointer (lookup_pointer_type (value_type (arg1)),
-			       value_address (arg1));
+			       value_arch (arg1), value_address (arg1));
   return retval;
 }
 
@@ -1182,6 +1192,7 @@ value_addr (struct value *arg1)
 
   /* Get target memory address */
   arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
+			     value_arch (arg1),
 			     (value_address (arg1)
 			      + value_embedded_offset (arg1)));
 
@@ -1236,11 +1247,11 @@ value_ind (struct value *arg1)
 	  || TYPE_CODE (check_typedef (enc_type)) == TYPE_CODE_METHOD)
 	/* For functions, go through find_function_addr, which knows
 	   how to handle function descriptors.  */
-	arg2 = value_at_lazy (enc_type, 
+	arg2 = value_at_lazy (enc_type, value_arch (arg1),
 			      find_function_addr (arg1, NULL));
       else
 	/* Retrieve the enclosing object pointed to */
-	arg2 = value_at_lazy (enc_type, 
+	arg2 = value_at_lazy (enc_type, value_arch (arg1),
 			      (value_as_address (arg1)
 			       - value_pointed_to_offset (arg1)));
 
@@ -1307,7 +1318,7 @@ value_array (int lowbound, int highbound
 
   if (!current_language->c_style_arrays)
     {
-      val = allocate_value (arraytype);
+      val = allocate_value (arraytype, value_arch (elemvec[0]));
       for (idx = 0; idx < nelem; idx++)
 	{
 	  memcpy (value_contents_all_raw (val) + (idx * typelength),
@@ -1320,7 +1331,7 @@ value_array (int lowbound, int highbound
   /* Allocate space to store the array, and then initialize it by
      copying in each element.  */
 
-  val = allocate_value (arraytype);
+  val = allocate_value (arraytype, value_arch (elemvec[0]));
   for (idx = 0; idx < nelem; idx++)
     memcpy (value_contents_writeable (val) + (idx * typelength),
 	    value_contents_all (elemvec[idx]),
@@ -1329,7 +1340,8 @@ value_array (int lowbound, int highbound
 }
 
 struct value *
-value_cstring (char *ptr, int len, struct type *char_type)
+value_cstring (struct gdbarch *gdbarch, char *ptr, int len,
+	       struct type *char_type)
 {
   struct value *val;
   int lowbound = current_language->string_lower_bound;
@@ -1341,7 +1353,7 @@ value_cstring (char *ptr, int len, struc
   struct type *stringtype
     = create_array_type ((struct type *) NULL, char_type, rangetype);
 
-  val = allocate_value (stringtype);
+  val = allocate_value (stringtype, gdbarch);
   memcpy (value_contents_raw (val), ptr, len);
   return val;
 }
@@ -1356,7 +1368,8 @@ value_cstring (char *ptr, int len, struc
    string may contain embedded null bytes.  */
 
 struct value *
-value_string (char *ptr, int len, struct type *char_type)
+value_string (struct gdbarch *gdbarch, char *ptr, int len,
+	      struct type *char_type)
 {
   struct value *val;
   int lowbound = current_language->string_lower_bound;
@@ -1368,13 +1381,13 @@ value_string (char *ptr, int len, struct
   struct type *stringtype
     = create_string_type ((struct type *) NULL, char_type, rangetype);
 
-  val = allocate_value (stringtype);
+  val = allocate_value (stringtype, gdbarch);
   memcpy (value_contents_raw (val), ptr, len);
   return val;
 }
 
 struct value *
-value_bitstring (char *ptr, int len)
+value_bitstring (struct gdbarch *gdbarch, char *ptr, int len)
 {
   struct value *val;
   struct type *domain_type = create_range_type (NULL, 
@@ -1383,7 +1396,7 @@ value_bitstring (char *ptr, int len)
   struct type *type = create_set_type ((struct type *) NULL, 
 				       domain_type);
   TYPE_CODE (type) = TYPE_CODE_BITSTRING;
-  val = allocate_value (type);
+  val = allocate_value (type, gdbarch);
   memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type));
   return val;
 }
@@ -1503,7 +1516,7 @@ search_struct_field (char *name, struct 
 	    struct value *v;
 	    if (field_is_static (&TYPE_FIELD (type, i)))
 	      {
-		v = value_static_field (type, i);
+		v = value_static_field (type, value_arch (arg1), i);
 		if (v == 0)
 		  error (_("field %s is nonexistent or has been optimised out"),
 			 name);
@@ -1594,7 +1607,7 @@ search_struct_field (char *name, struct 
 	    {
 	      CORE_ADDR base_addr;
 
-	      v2  = allocate_value (basetype);
+	      v2 = allocate_value (basetype, value_arch (arg1));
 	      base_addr = value_address (arg1) + boffset;
 	      if (target_read_memory (base_addr, 
 				      value_contents_raw (v2),
@@ -1606,10 +1619,10 @@ search_struct_field (char *name, struct 
 	  else
 	    {
 	      if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
-		v2  = allocate_value_lazy (basetype);
+		v2 = allocate_value_lazy (basetype, value_arch (arg1));
 	      else
 		{
-		  v2  = allocate_value (basetype);
+		  v2 = allocate_value (basetype, value_arch (arg1));
 		  memcpy (value_contents_raw (v2),
 			  value_contents_raw (arg1) + boffset,
 			  TYPE_LENGTH (basetype));
@@ -1681,7 +1694,8 @@ search_struct_method (char *name, struct
 	    error (_("cannot resolve overloaded method `%s': no arguments supplied"), name);
 	  else if (j == 0 && args == 0)
 	    {
-	      v = value_fn_field (arg1p, f, j, type, offset);
+	      v = value_fn_field (arg1p, f, j, type, offset,
+				  value_arch (*arg1p));
 	      if (v != NULL)
 		return v;
 	    }
@@ -1699,7 +1713,8 @@ search_struct_method (char *name, struct
 		    if (TYPE_FN_FIELD_STATIC_P (f, j) 
 			&& static_memfuncp)
 		      *static_memfuncp = 1;
-		    v = value_fn_field (arg1p, f, j, type, offset);
+		    v = value_fn_field (arg1p, f, j, type, offset,
+					value_arch (*arg1p));
 		    if (v != NULL)
 		      return v;       
 		  }
@@ -1848,7 +1863,7 @@ value_struct_elt (struct value **argp, s
 	    {
 	      v = value_fn_field (NULL, 
 				  TYPE_FN_FIELDLIST1 (t, m_index),
-				  f_index, NULL, 0);
+				  f_index, NULL, 0, value_arch (*argp));
 	    }
 	  if (v == NULL)
 	    error (_("could not find destructor function named %s."), 
@@ -2151,7 +2166,7 @@ find_overload_match (struct type **arg_t
 					basetype, boffset);
       else
 	*valp = value_fn_field (&temp, fns_ptr, oload_champ, 
-				basetype, boffset);
+				basetype, boffset, value_arch (obj));
     }
   else
     {
@@ -2535,7 +2550,7 @@ check_field (struct type *type, const ch
    the comment before value_struct_elt_for_reference.  */
 
 struct value *
-value_aggregate_elt (struct type *curtype,
+value_aggregate_elt (struct type *curtype, struct gdbarch *gdbarch,
 		     char *name, int want_address,
 		     enum noside noside)
 {
@@ -2543,11 +2558,11 @@ value_aggregate_elt (struct type *curtyp
     {
     case TYPE_CODE_STRUCT:
     case TYPE_CODE_UNION:
-      return value_struct_elt_for_reference (curtype, 0, curtype, 
+      return value_struct_elt_for_reference (gdbarch, curtype, 0, curtype,
 					     name, NULL,
 					     want_address, noside);
     case TYPE_CODE_NAMESPACE:
-      return value_namespace_elt (curtype, name, 
+      return value_namespace_elt (curtype, gdbarch, name,
 				  want_address, noside);
     default:
       internal_error (__FILE__, __LINE__,
@@ -2563,13 +2578,15 @@ value_aggregate_elt (struct type *curtyp
    the form "DOMAIN::NAME".  */
 
 static struct value *
-value_struct_elt_for_reference (struct type *domain, int offset,
+value_struct_elt_for_reference (struct gdbarch *gdbarch,
+				struct type *domain, int offset,
 				struct type *curtype, char *name,
 				struct type *intype, 
 				int want_address,
 				enum noside noside)
 {
   struct type *t = curtype;
+  struct type *ptr;
   int i;
   struct value *v, *result;
 
@@ -2585,7 +2602,7 @@ value_struct_elt_for_reference (struct t
 	{
 	  if (field_is_static (&TYPE_FIELD (t, i)))
 	    {
-	      v = value_static_field (t, i);
+	      v = value_static_field (t, gdbarch, i);
 	      if (v == NULL)
 		error (_("static field %s has been optimized out"),
 		       name);
@@ -2599,9 +2616,9 @@ value_struct_elt_for_reference (struct t
 	  if (want_address)
 	    return value_from_longest
 	      (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain),
-	       offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
+	       gdbarch, offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3));
 	  else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-	    return allocate_value (TYPE_FIELD_TYPE (t, i));
+	    return allocate_value (TYPE_FIELD_TYPE (t, i), gdbarch);
 	  else
 	    error (_("Cannot reference non-static field \"%s\""), name);
 	}
@@ -2665,23 +2682,23 @@ value_struct_elt_for_reference (struct t
 		return NULL;
 
 	      if (want_address)
-		return value_addr (read_var_value (s, 0));
+		return value_addr (read_var_value (s, gdbarch, 0));
 	      else
-		return read_var_value (s, 0);
+		return read_var_value (s, gdbarch, 0);
 	    }
 
 	  if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
 	    {
 	      if (want_address)
 		{
-		  result = allocate_value
-		    (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
+		  ptr = lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j));
+		  result = allocate_value (ptr, gdbarch);
 		  cplus_make_method_ptr (value_type (result),
 					 value_contents_writeable (result),
 					 TYPE_FN_FIELD_VOFFSET (f, j), 1);
 		}
 	      else if (noside == EVAL_AVOID_SIDE_EFFECTS)
-		return allocate_value (TYPE_FN_FIELD_TYPE (f, j));
+		return allocate_value (TYPE_FN_FIELD_TYPE (f, j), gdbarch);
 	      else
 		error (_("Cannot reference virtual member function \"%s\""),
 		       name);
@@ -2694,12 +2711,13 @@ value_struct_elt_for_reference (struct t
 	      if (s == NULL)
 		return NULL;
 
-	      v = read_var_value (s, 0);
+	      v = read_var_value (s, gdbarch, 0);
 	      if (!want_address)
 		result = v;
 	      else
 		{
-		  result = allocate_value (lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j)));
+		  ptr = lookup_methodptr_type (TYPE_FN_FIELD_TYPE (f, j));
+		  result = allocate_value (ptr, gdbarch);
 		  cplus_make_method_ptr (value_type (result),
 					 value_contents_writeable (result),
 					 value_address (v), 0);
@@ -2717,7 +2735,7 @@ value_struct_elt_for_reference (struct t
 	base_offset = 0;
       else
 	base_offset = TYPE_BASECLASS_BITPOS (t, i) / 8;
-      v = value_struct_elt_for_reference (domain,
+      v = value_struct_elt_for_reference (gdbarch, domain,
 					  offset + base_offset,
 					  TYPE_BASECLASS (t, i),
 					  name, intype, 
@@ -2730,7 +2748,7 @@ value_struct_elt_for_reference (struct t
      it up that way; this (frequently) works for types nested inside
      classes.  */
 
-  return value_maybe_namespace_elt (curtype, name, 
+  return value_maybe_namespace_elt (curtype, gdbarch, name,
 				    want_address, noside);
 }
 
@@ -2739,12 +2757,12 @@ value_struct_elt_for_reference (struct t
 
 static struct value *
 value_namespace_elt (const struct type *curtype,
+		     struct gdbarch *gdbarch,
 		     char *name, int want_address,
 		     enum noside noside)
 {
-  struct value *retval = value_maybe_namespace_elt (curtype, name,
-						    want_address, 
-						    noside);
+  struct value *retval
+    = value_maybe_namespace_elt (curtype, gdbarch, name, want_address, noside);
 
   if (retval == NULL)
     error (_("No symbol \"%s\" in namespace \"%s\"."), 
@@ -2761,6 +2779,7 @@ value_namespace_elt (const struct type *
 
 static struct value *
 value_maybe_namespace_elt (const struct type *curtype,
+			   struct gdbarch *gdbarch,
 			   char *name, int want_address,
 			   enum noside noside)
 {
@@ -2776,9 +2795,9 @@ value_maybe_namespace_elt (const struct 
     return NULL;
   else if ((noside == EVAL_AVOID_SIDE_EFFECTS)
 	   && (SYMBOL_CLASS (sym) == LOC_TYPEDEF))
-    result = allocate_value (SYMBOL_TYPE (sym));
+    result = allocate_value (SYMBOL_TYPE (sym), gdbarch);
   else
-    result = value_of_variable (sym, get_selected_block (0));
+    result = value_of_variable (sym, gdbarch, get_selected_block (0));
 
   if (result && want_address)
     result = value_addr (result);
@@ -2861,7 +2880,8 @@ value_full_object (struct value *argp, 
   /* Go back by the computed top_offset from the beginning of the
      object, adjusting for the embedded offset of argp if that's what
      value_rtti_type used for its computation.  */
-  new_val = value_at_lazy (real_type, value_address (argp) - top +
+  new_val = value_at_lazy (real_type, value_arch (argp),
+			   value_address (argp) - top +
 			   (using_enc ? 0 : value_embedded_offset (argp)));
   deprecated_set_value_type (new_val, value_type (argp));
   set_value_embedded_offset (new_val, (using_enc
@@ -2922,7 +2942,7 @@ value_of_local (const char *name, int co
 	return NULL;
     }
 
-  ret = read_var_value (sym, frame);
+  ret = read_var_value (sym, get_frame_arch (frame), frame);
   if (ret == 0 && complain)
     error (_("`%s' argument unreadable"), name);
   return ret;
@@ -2979,11 +2999,11 @@ value_slice (struct value *array, int lo
       slice_type = create_set_type ((struct type *) NULL,
 				    slice_range_type);
       TYPE_CODE (slice_type) = TYPE_CODE_BITSTRING;
-      slice = value_zero (slice_type, not_lval);
+      slice = value_zero (slice_type, value_arch (array), not_lval);
 
       for (i = 0; i < length; i++)
 	{
-	  int element = value_bit_index (array_type,
+	  int element = value_bit_index (array_type, value_arch (array),
 					 value_contents (array),
 					 lowbound + i);
 	  if (element < 0)
@@ -2991,7 +3011,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 (value_arch (array)))
 		j = TARGET_CHAR_BIT - 1 - j;
 	      value_contents_raw (slice)[i / TARGET_CHAR_BIT] |= (1 << j);
 	    }
@@ -3013,10 +3033,10 @@ value_slice (struct value *array, int lo
       TYPE_CODE (slice_type) = TYPE_CODE (array_type);
 
       if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
-	slice = allocate_value_lazy (slice_type);
+	slice = allocate_value_lazy (slice_type, value_arch (array));
       else
 	{
-	  slice = allocate_value (slice_type);
+	  slice = allocate_value (slice_type, value_arch (array));
 	  memcpy (value_contents_writeable (slice),
 		  value_contents (array) + offset,
 		  TYPE_LENGTH (slice_type));
@@ -3043,7 +3063,7 @@ value_literal_complex (struct value *arg
   struct value *val;
   struct type *real_type = TYPE_TARGET_TYPE (type);
 
-  val = allocate_value (type);
+  val = allocate_value (type, value_arch (arg1));
   arg1 = value_cast (real_type, arg1);
   arg2 = value_cast (real_type, arg2);
 
@@ -3064,8 +3084,8 @@ cast_into_complex (struct type *type, st
   if (TYPE_CODE (value_type (val)) == TYPE_CODE_COMPLEX)
     {
       struct type *val_real_type = TYPE_TARGET_TYPE (value_type (val));
-      struct value *re_val = allocate_value (val_real_type);
-      struct value *im_val = allocate_value (val_real_type);
+      struct value *re_val = allocate_value (val_real_type, value_arch (val));
+      struct value *im_val = allocate_value (val_real_type, value_arch (val));
 
       memcpy (value_contents_raw (re_val),
 	      value_contents (val), TYPE_LENGTH (val_real_type));
@@ -3078,7 +3098,8 @@ cast_into_complex (struct type *type, st
   else if (TYPE_CODE (value_type (val)) == TYPE_CODE_FLT
 	   || TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
     return value_literal_complex (val, 
-				  value_zero (real_type, not_lval), 
+				  value_zero (real_type,
+					      value_arch (val), not_lval),
 				  type);
   else
     error (_("cannot cast non-number to complex"));
Index: gdb-head/gdb/value.c
===================================================================
--- gdb-head.orig/gdb/value.c
+++ gdb-head/gdb/value.c
@@ -20,6 +20,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
+#include "arch-utils.h"
 #include "gdb_string.h"
 #include "symtab.h"
 #include "gdbtypes.h"
@@ -114,6 +115,9 @@ struct value
   /* Type of the value.  */
   struct type *type;
 
+  /* Architecture of the value.  */
+  struct gdbarch *gdbarch;
+
   /* If a value represents a C++ object, then the `type' field gives
      the object's compile-time type.  If the object actually belongs
      to some class derived from `type', perhaps with other base
@@ -237,7 +241,7 @@ static struct value *all_values;
    NULL; it will be allocated when it is fetched from the target.  */
 
 struct value *
-allocate_value_lazy (struct type *type)
+allocate_value_lazy (struct type *type, struct gdbarch *gdbarch)
 {
   struct value *val;
   struct type *atype = check_typedef (type);
@@ -247,6 +251,7 @@ allocate_value_lazy (struct type *type)
   val->next = all_values;
   all_values = val;
   val->type = type;
+  val->gdbarch = gdbarch;
   val->enclosing_type = type;
   VALUE_LVAL (val) = not_lval;
   val->location.address = 0;
@@ -276,9 +281,9 @@ allocate_value_contents (struct value *v
 /* Allocate a  value  and its contents for type TYPE.  */
 
 struct value *
-allocate_value (struct type *type)
+allocate_value (struct type *type, struct gdbarch *gdbarch)
 {
-  struct value *val = allocate_value_lazy (type);
+  struct value *val = allocate_value_lazy (type, gdbarch);
   allocate_value_contents (val);
   val->lazy = 0;
   return val;
@@ -288,7 +293,7 @@ allocate_value (struct type *type)
    for COUNT repetitions of type TYPE.  */
 
 struct value *
-allocate_repeat_value (struct type *type, int count)
+allocate_repeat_value (struct type *type, struct gdbarch *gdbarch, int count)
 {
   int low_bound = current_language->string_lower_bound;		/* ??? */
   /* FIXME-type-allocation: need a way to free this type when we are
@@ -299,7 +304,8 @@ allocate_repeat_value (struct type *type
   /* FIXME-type-allocation: need a way to free this type when we are
      done with it.  */
   return allocate_value (create_array_type ((struct type *) NULL,
-					    type, range_type));
+					    type, range_type),
+			 gdbarch);
 }
 
 /* Needed if another module needs to maintain its on list of values.  */
@@ -329,10 +335,11 @@ value_remove_from_list (struct value **h
 
 struct value *
 allocate_computed_value (struct type *type,
+			 struct gdbarch *gdbarch,
                          struct lval_funcs *funcs,
                          void *closure)
 {
-  struct value *v = allocate_value (type);
+  struct value *v = allocate_value (type, gdbarch);
   VALUE_LVAL (v) = lval_computed;
   v->location.computed.funcs = funcs;
   v->location.computed.closure = closure;
@@ -360,6 +367,12 @@ deprecated_set_value_type (struct value 
   value->type = type;
 }
 
+struct gdbarch *
+value_arch (struct value *value)
+{
+  return value->gdbarch;
+}
+
 int
 value_offset (struct value *value)
 {
@@ -694,9 +707,9 @@ value_copy (struct value *arg)
   struct value *val;
 
   if (value_lazy (arg))
-    val = allocate_value_lazy (encl_type);
+    val = allocate_value_lazy (encl_type, value_arch (arg));
   else
-    val = allocate_value (encl_type);
+    val = allocate_value (encl_type, value_arch (arg));
   val->type = arg->type;
   VALUE_LVAL (val) = VALUE_LVAL (arg);
   val->location = arg->location;
@@ -1007,27 +1020,27 @@ lookup_internalvar (const char *name)
 }
 
 struct value *
-value_of_internalvar (struct internalvar *var)
+value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var)
 {
   struct value *val;
 
   if (var->make_value != NULL)
-    val = (*var->make_value) (var);
+    val = (*var->make_value) (gdbarch, var);
   else
     {
       switch (TYPE_CODE (var->type))
 	{
 	case TYPE_CODE_VOID:
 	case TYPE_CODE_INTERNAL_FUNCTION:
-	  val = allocate_value (var->type);
+	  val = allocate_value (var->type, gdbarch);
 	  break;
 
 	case TYPE_CODE_INT:
-	  val = value_from_longest (var->type, var->u.l);
+	  val = value_from_longest (var->type, gdbarch, var->u.l);
 	  break;
 
 	case TYPE_CODE_PTR:
-	  val = value_from_pointer (var->type, var->u.a);
+	  val = value_from_pointer (var->type, gdbarch, var->u.a);
 	  break;
 
 	default:
@@ -1106,7 +1119,7 @@ set_internalvar_component (struct intern
       addr = value_contents_writeable (var->u.v);
 
       if (bitsize)
-	modify_field (addr + offset,
+	modify_field (value_arch (newval), addr + offset,
 		      value_as_long (newval), bitpos, bitsize);
       else
 	memcpy (addr + offset, value_contents (newval),
@@ -1365,6 +1378,7 @@ preserve_values (struct objfile *objfile
 static void
 show_convenience (char *ignore, int from_tty)
 {
+  struct gdbarch *gdbarch = get_current_arch ();
   struct internalvar *var;
   int varseen = 0;
   struct value_print_options opts;
@@ -1377,7 +1391,7 @@ show_convenience (char *ignore, int from
 	  varseen = 1;
 	}
       printf_filtered (("$%s = "), var->name);
-      value_print (value_of_internalvar (var), gdb_stdout,
+      value_print (value_of_internalvar (gdbarch, var), gdb_stdout,
 		   &opts);
       printf_filtered (("\n"));
     }
@@ -1427,7 +1441,7 @@ value_as_address (struct value *val)
   /* 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 (value_arch (val), value_as_long (val));
 #else
 
   /* There are several targets (IA-64, PowerPC, and others) which
@@ -1512,8 +1526,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 (value_arch (val)))
+    return gdbarch_integer_to_address (value_arch (val), value_type (val),
 				       value_contents (val));
 
   return unpack_long (value_type (val), value_contents (val));
@@ -1663,13 +1677,13 @@ unpack_pointer (struct type *type, const
    optimized out. */
 
 struct value *
-value_static_field (struct type *type, int fieldno)
+value_static_field (struct type *type, struct gdbarch *gdbarch, int fieldno)
 {
   struct value *retval;
 
   if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
     {
-      retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
+      retval = value_at (TYPE_FIELD_TYPE (type, fieldno), gdbarch,
 			 TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
     }
   else
@@ -1685,7 +1699,7 @@ value_static_field (struct type *type, i
 	    return NULL;
 	  else
 	    {
-	      retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
+	      retval = value_at (TYPE_FIELD_TYPE (type, fieldno), gdbarch,
 				 SYMBOL_VALUE_ADDRESS (msym));
 	    }
 	}
@@ -1696,7 +1710,7 @@ value_static_field (struct type *type, i
 	  if (symbol_read_needs_frame (sym))
 	    warning (_("static field's value depends on the current "
 		     "frame - bad debug info?"));
-	  retval = read_var_value (sym, NULL);
+	  retval = read_var_value (sym, gdbarch, NULL);
  	}
       if (retval && VALUE_LVAL (retval) == lval_memory)
 	SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
@@ -1741,8 +1755,9 @@ value_primitive_field (struct value *arg
 
   if (TYPE_FIELD_BITSIZE (arg_type, fieldno))
     {
-      v = value_from_longest (type,
+      v = value_from_longest (type, value_arch (arg1),
 			      unpack_field_as_long (arg_type,
+						    value_arch (arg1),
 						    value_contents (arg1)
 						    + offset,
 						    fieldno));
@@ -1762,10 +1777,11 @@ value_primitive_field (struct value *arg
 	value_fetch_lazy (arg1);
 
       if (value_lazy (arg1))
-	v = allocate_value_lazy (value_enclosing_type (arg1));
+	v = allocate_value_lazy (value_enclosing_type (arg1),
+				 value_arch (arg1));
       else
 	{
-	  v = allocate_value (value_enclosing_type (arg1));
+	  v = allocate_value (value_enclosing_type (arg1), value_arch (arg1));
 	  memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
 		  TYPE_LENGTH (value_enclosing_type (arg1)));
 	}
@@ -1784,10 +1800,10 @@ value_primitive_field (struct value *arg
 	value_fetch_lazy (arg1);
 
       if (value_lazy (arg1))
-	v = allocate_value_lazy (type);
+	v = allocate_value_lazy (type, value_arch (arg1));
       else
 	{
-	  v = allocate_value (type);
+	  v = allocate_value (type, value_arch (arg1));
 	  memcpy (value_contents_raw (v),
 		  value_contents_raw (arg1) + offset,
 		  TYPE_LENGTH (type));
@@ -1820,8 +1836,8 @@ value_field (struct value *arg1, int fie
  */
 
 struct value *
-value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *type,
-		int offset)
+value_fn_field (struct value **arg1p, struct fn_field *f, int j,
+		struct type *type, int offset, struct gdbarch *gdbarch)
 {
   struct value *v;
   struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
@@ -1842,18 +1858,13 @@ value_fn_field (struct value **arg1p, st
 	return NULL;
     }
 
-  v = allocate_value (ftype);
+  v = allocate_value (ftype, gdbarch);
   if (sym)
     {
       set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
     }
   else
     {
-      /* The minimal symbol might point to a function descriptor;
-	 resolve it to the actual code address instead.  */
-      struct objfile *objfile = msymbol_objfile (msym);
-      struct gdbarch *gdbarch = get_objfile_arch (objfile);
-
       set_value_address (v,
 	gdbarch_convert_from_func_ptr_addr
 	   (gdbarch, SYMBOL_VALUE_ADDRESS (msym), &current_target));
@@ -1889,7 +1900,8 @@ value_fn_field (struct value **arg1p, st
    If the field is signed, we also do sign extension. */
 
 LONGEST
-unpack_field_as_long (struct type *type, const gdb_byte *valaddr, int fieldno)
+unpack_field_as_long (struct type *type, struct gdbarch *gdbarch,
+		      const gdb_byte *valaddr, int fieldno)
 {
   ULONGEST val;
   ULONGEST valmask;
@@ -1904,7 +1916,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 (gdbarch))
     lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
   else
     lsbcount = (bitpos % 8);
@@ -1936,7 +1948,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 gdbarch *gdbarch, gdb_byte *addr,
+	      LONGEST fieldval, int bitpos, int bitsize)
 {
   ULONGEST oword;
   ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
@@ -1960,7 +1973,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 (gdbarch))
     bitpos = sizeof (oword) * 8 - bitpos - bitsize;
 
   oword &= ~(mask << bitpos);
@@ -2006,9 +2019,9 @@ pack_long (gdb_byte *buf, struct type *t
 /* Convert C numbers into newly allocated values.  */
 
 struct value *
-value_from_longest (struct type *type, LONGEST num)
+value_from_longest (struct type *type, struct gdbarch *gdbarch, LONGEST num)
 {
-  struct value *val = allocate_value (type);
+  struct value *val = allocate_value (type, gdbarch);
 
   pack_long (value_contents_raw (val), type, num);
 
@@ -2019,9 +2032,9 @@ value_from_longest (struct type *type, L
 /* Create a value representing a pointer of type TYPE to the address
    ADDR.  */
 struct value *
-value_from_pointer (struct type *type, CORE_ADDR addr)
+value_from_pointer (struct type *type, struct gdbarch *gdbarch, CORE_ADDR addr)
 {
-  struct value *val = allocate_value (type);
+  struct value *val = allocate_value (type, gdbarch);
   store_typed_address (value_contents_raw (val), type, addr);
   return val;
 }
@@ -2033,10 +2046,11 @@ value_from_pointer (struct type *type, C
 
 struct value *
 value_from_contents_and_address (struct type *type,
+				 struct gdbarch *gdbarch,
 				 const gdb_byte *valaddr,
 				 CORE_ADDR address)
 {
-  struct value *v = allocate_value (type);
+  struct value *v = allocate_value (type, gdbarch);
   if (valaddr == NULL)
     set_value_lazy (v, 1);
   else
@@ -2047,9 +2061,9 @@ value_from_contents_and_address (struct 
 }
 
 struct value *
-value_from_double (struct type *type, DOUBLEST num)
+value_from_double (struct type *type, struct gdbarch *gdbarch, DOUBLEST num)
 {
-  struct value *val = allocate_value (type);
+  struct value *val = allocate_value (type, gdbarch);
   struct type *base_type = check_typedef (type);
   enum type_code code = TYPE_CODE (base_type);
   int len = TYPE_LENGTH (base_type);
@@ -2065,9 +2079,10 @@ value_from_double (struct type *type, DO
 }
 
 struct value *
-value_from_decfloat (struct type *type, const gdb_byte *dec)
+value_from_decfloat (struct type *type, struct gdbarch *gdbarch,
+		     const gdb_byte *dec)
 {
-  struct value *val = allocate_value (type);
+  struct value *val = allocate_value (type, gdbarch);
 
   memcpy (value_contents_raw (val), dec, TYPE_LENGTH (type));
 
@@ -2080,6 +2095,7 @@ coerce_ref (struct value *arg)
   struct type *value_type_arg_tmp = check_typedef (value_type (arg));
   if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
     arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
+			 value_arch (arg),
 			 unpack_pointer (value_type (arg),		
 					 value_contents (arg)));
   return arg;
Index: gdb-head/gdb/varobj.c
===================================================================
--- gdb-head.orig/gdb/varobj.c
+++ gdb-head/gdb/varobj.c
@@ -1050,7 +1050,7 @@ varobj_get_type (struct varobj *var)
 
   /* To print the type, we simply create a zero ``struct value *'' and
      cast it to our type. We then typeprint this variable. */
-  val = value_zero (var->type, not_lval);
+  val = value_zero (var->type, var->root->exp->gdbarch, not_lval);
   type_print (value_type (val), "", stb, -1);
 
   thetype = ui_file_xstrdup (stb, &length);
@@ -2251,7 +2251,7 @@ value_get_print_value (struct value *val
     PyGILState_STATE state = PyGILState_Ensure ();
     struct cleanup *back_to = make_cleanup_py_restore_gil (&state);
 
-    make_cleanup_python_env (current_gdbarch, current_language);
+    make_cleanup_python_env (value_arch (value), current_language);
 
     if (value_formatter && PyObject_HasAttr (value_formatter,
 					     gdbpy_to_string_cst))
@@ -2290,8 +2290,9 @@ value_get_print_value (struct value *val
   opts.raw = 1;
   if (thevalue)
     {
+      struct gdbarch *gdbarch = value_arch (value);
       make_cleanup (xfree, thevalue);
-      LA_PRINT_STRING (stb, builtin_type (current_gdbarch)->builtin_char,
+      LA_PRINT_STRING (stb, builtin_type (gdbarch)->builtin_char, gdbarch,
 		       (gdb_byte *) thevalue, strlen (thevalue),
 		       0, &opts);
     }
@@ -2511,7 +2512,7 @@ value_struct_element_index (struct value
   TRY_CATCH (e, RETURN_MASK_ERROR)
     {
       if (field_is_static (&TYPE_FIELD (type, type_index)))
-	result = value_static_field (type, type_index);
+	result = value_static_field (type, value_arch (value), type_index);
       else
 	result = value_primitive_field (value, 0, type_index, type);
     }
@@ -2569,7 +2570,8 @@ c_describe_child (struct varobj *parent,
 	{
 	  int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type));
 	  struct value *indval = 
-	    value_from_longest (builtin_type_int32, (LONGEST) real_index);
+	    value_from_longest (builtin_type_int32, value_arch (value),
+				(LONGEST) real_index);
 	  gdb_value_subscript (value, indval, cvalue);
 	}
 
Index: gdb-head/gdb/s390-tdep.c
===================================================================
--- gdb-head.orig/gdb/s390-tdep.c
+++ gdb-head/gdb/s390-tdep.c
@@ -262,10 +262,11 @@ s390x_pseudo_register_write (struct gdba
    registers, even though we are otherwise a big-endian platform.  */
 
 static struct value *
-s390_value_from_register (struct type *type, int regnum,
-			  struct frame_info *frame)
+s390_value_from_register (struct type *type, struct gdbarch *val_arch,
+			  int regnum, struct frame_info *frame)
 {
-  struct value *value = default_value_from_register (type, regnum, frame);
+  struct value *value
+    = default_value_from_register (type, val_arch, regnum, frame);
   int len = TYPE_LENGTH (type);
 
   if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM && len < 8)
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -287,10 +287,11 @@ spu_pseudo_register_write (struct gdbarc
 /* Value conversion -- access scalar values at the preferred slot.  */
 
 static struct value *
-spu_value_from_register (struct type *type, int regnum,
-			 struct frame_info *frame)
+spu_value_from_register (struct type *type, struct gdbarch *val_arch,
+			 int regnum, struct frame_info *frame)
 {
-  struct value *value = default_value_from_register (type, regnum, frame);
+  struct value *value
+    = default_value_from_register (type, val_arch, regnum, frame);
   int len = TYPE_LENGTH (type);
 
   if (regnum < SPU_NUM_GPRS && len < 16)
Index: gdb-head/gdb/gdbarch.c
===================================================================
--- gdb-head.orig/gdb/gdbarch.c
+++ gdb-head/gdb/gdbarch.c
@@ -2055,13 +2055,13 @@ set_gdbarch_value_to_register (struct gd
 }
 
 struct value *
-gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame)
+gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, struct gdbarch *val_arch, int regnum, struct frame_info *frame)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->value_from_register != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_value_from_register called\n");
-  return gdbarch->value_from_register (type, regnum, frame);
+  return gdbarch->value_from_register (type, val_arch, regnum, frame);
 }
 
 void
Index: gdb-head/gdb/gdbarch.h
===================================================================
--- gdb-head.orig/gdb/gdbarch.h
+++ gdb-head/gdb/gdbarch.h
@@ -355,8 +355,8 @@ extern void set_gdbarch_value_to_registe
    allocate and return a struct value with all value attributes
    (but not the value contents) filled in. */
 
-typedef struct value * (gdbarch_value_from_register_ftype) (struct type *type, int regnum, struct frame_info *frame);
-extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_info *frame);
+typedef struct value * (gdbarch_value_from_register_ftype) (struct type *type, struct gdbarch *val_arch, int regnum, struct frame_info *frame);
+extern struct value * gdbarch_value_from_register (struct gdbarch *gdbarch, struct type *type, struct gdbarch *val_arch, int regnum, struct frame_info *frame);
 extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_value_from_register_ftype *value_from_register);
 
 typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
Index: gdb-head/gdb/gdbarch.sh
===================================================================
--- gdb-head.orig/gdb/gdbarch.sh
+++ gdb-head/gdb/gdbarch.sh
@@ -464,7 +464,7 @@ f:void:value_to_register:struct frame_in
 # frame FRAME, interpreted as type TYPE.  The routine needs to
 # allocate and return a struct value with all value attributes
 # (but not the value contents) filled in.
-f:struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0
+f:struct value *:value_from_register:struct type *type, struct gdbarch *val_arch, int regnum, struct frame_info *frame:type, val_arch, regnum, frame::default_value_from_register::0
 #
 m:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0
 m:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0
Index: gdb-head/gdb/mi/mi-cmd-stack.c
===================================================================
--- gdb-head.orig/gdb/mi/mi-cmd-stack.c
+++ gdb-head/gdb/mi/mi-cmd-stack.c
@@ -282,7 +282,7 @@ list_args_or_locals (int locals, int val
 		      && TYPE_CODE (type) != TYPE_CODE_UNION)
 		    {
 		      struct value_print_options opts;
-		      val = read_var_value (sym2, fi);
+		      val = read_var_value (sym2, get_frame_arch (fi), fi);
 		      get_raw_print_options (&opts);
 		      opts.deref_ref = 1;
 		      common_val_print
@@ -295,7 +295,7 @@ list_args_or_locals (int locals, int val
 		case PRINT_ALL_VALUES:
 		  {
 		    struct value_print_options opts;
-		    val = read_var_value (sym2, fi);
+		    val = read_var_value (sym2, get_frame_arch (fi), fi);
 		    get_raw_print_options (&opts);
 		    opts.deref_ref = 1;
 		    common_val_print
Index: gdb-head/gdb/stack.c
===================================================================
--- gdb-head.orig/gdb/stack.c
+++ gdb-head/gdb/stack.c
@@ -326,7 +326,7 @@ print_frame_args (struct symbol *func, s
 		 "recurse" to val_print because our standard indentation
 		 here is 4 spaces, and val_print indents 2 for each
 		 recurse.  */
-	      val = read_var_value (sym, frame);
+	      val = read_var_value (sym, get_frame_arch (frame), frame);
 
 	      annotate_arg_value (val == NULL ? NULL : value_type (val));
 
Index: gdb-head/gdb/c-lang.c
===================================================================
--- gdb-head.orig/gdb/c-lang.c
+++ gdb-head/gdb/c-lang.c
@@ -343,7 +343,8 @@ c_printchar (int c, struct type *type, s
    printing LENGTH characters, or if FORCE_ELLIPSES.  */
 
 void
-c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+c_printstr (struct ui_file *stream, struct type *type,
+	    struct gdbarch *gdbarch, const gdb_byte *string,
 	    unsigned int length, int force_ellipses,
 	    const struct value_print_options *options)
 {
@@ -949,9 +950,9 @@ evaluate_subexp_c (struct type *expect_t
 	  {
 	    /* Return a dummy value of the appropriate type.  */
 	    if ((dest_type & C_CHAR) != 0)
-	      result = allocate_value (type);
+	      result = allocate_value (type, exp->gdbarch);
 	    else
-	      result = value_cstring ("", 0, type);
+	      result = value_cstring (exp->gdbarch, "", 0, type);
 	    do_cleanups (cleanup);
 	    return result;
 	  }
@@ -963,7 +964,7 @@ evaluate_subexp_c (struct type *expect_t
 	    if (obstack_object_size (&output) != TYPE_LENGTH (type))
 	      error (_("Could not convert character constant to target character set"));
 	    value = unpack_long (type, obstack_base (&output));
-	    result = value_from_longest (type, value);
+	    result = value_from_longest (type, exp->gdbarch, value);
 	  }
 	else
 	  {
@@ -971,7 +972,8 @@ evaluate_subexp_c (struct type *expect_t
 	    /* Write the terminating character.  */
 	    for (i = 0; i < TYPE_LENGTH (type); ++i)
 	      obstack_1grow (&output, 0);
-	    result = value_cstring (obstack_base (&output),
+	    result = value_cstring (exp->gdbarch,
+				    obstack_base (&output),
 				    obstack_object_size (&output),
 				    type);
 	  }
Index: gdb-head/gdb/infrun.c
===================================================================
--- gdb-head.orig/gdb/infrun.c
+++ gdb-head/gdb/infrun.c
@@ -5108,25 +5108,19 @@ static struct lval_funcs siginfo_value_f
    available.  */
 
 static struct value *
-siginfo_make_value (struct internalvar *var)
+siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var)
 {
-  struct type *type;
-  struct gdbarch *gdbarch;
-
   if (target_has_stack
-      && !ptid_equal (inferior_ptid, null_ptid))
+      && !ptid_equal (inferior_ptid, null_ptid)
+      && gdbarch_get_siginfo_type_p (gdbarch))
     {
-      gdbarch = get_frame_arch (get_current_frame ());
-
-      if (gdbarch_get_siginfo_type_p (gdbarch))
-	{
-	  type = gdbarch_get_siginfo_type (gdbarch);
+      struct type *type = gdbarch_get_siginfo_type (gdbarch);
 
-	  return allocate_computed_value (type, &siginfo_value_funcs, NULL);
-	}
+      return allocate_computed_value (type, gdbarch,
+				      &siginfo_value_funcs, NULL);
     }
 
-  return allocate_value (builtin_type_void);
+  return allocate_value (builtin_type_void, gdbarch);
 }
 
 
Index: gdb-head/gdb/f-lang.c
===================================================================
--- gdb-head.orig/gdb/f-lang.c
+++ gdb-head/gdb/f-lang.c
@@ -142,7 +142,8 @@ f_printchar (int c, struct type *type, s
    be replaced with a true F77 version. */
 
 static void
-f_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
+f_printstr (struct ui_file *stream, struct type *type,
+	    struct gdbarch *gdbarch, const gdb_byte *string,
 	    unsigned int length, int force_ellipses,
 	    const struct value_print_options *options)
 {
Index: gdb-head/gdb/p-lang.c
===================================================================
--- gdb-head.orig/gdb/p-lang.c
+++ gdb-head/gdb/p-lang.c
@@ -213,8 +213,8 @@ pascal_printchar (int c, struct type *ty
 
 void
 pascal_printstr (struct ui_file *stream, struct type *type,
-		 const gdb_byte *string, unsigned int length,
-		 int force_ellipses,
+		 struct gdbarch *gdbarch, const gdb_byte *string,
+		 unsigned int length, int force_ellipses,
 		 const struct value_print_options *options)
 {
   unsigned int i;
Index: gdb-head/gdb/auxv.c
===================================================================
--- gdb-head.orig/gdb/auxv.c
+++ gdb-head/gdb/auxv.c
@@ -249,7 +249,7 @@ fprint_target_auxv (struct ui_file *file
 	    if (opts.addressprint)
 	      fprintf_filtered (file, "0x%s", paddr_nz (val));
 	    val_print_string (builtin_type (target_gdbarch)->builtin_char,
-			      val, -1, file, &opts);
+			      target_gdbarch, val, -1, file, &opts);
 	    fprintf_filtered (file, "\n");
 	  }
 	  break;
Index: gdb-head/gdb/python/python-frame.c
===================================================================
--- gdb-head.orig/gdb/python/python-frame.c
+++ gdb-head/gdb/python/python-frame.c
@@ -356,7 +356,7 @@ frapy_read_var (PyObject *self, PyObject
     {
       FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
 
-      val = read_var_value (var, frame);
+      val = read_var_value (var, get_frame_arch (frame), frame);
     }
   GDB_PY_HANDLE_EXCEPTION (except);
 
Index: gdb-head/gdb/python/python-prettyprint.c
===================================================================
--- gdb-head.orig/gdb/python/python-prettyprint.c
+++ gdb-head/gdb/python/python-prettyprint.c
@@ -178,7 +178,8 @@ gdbpy_get_display_hint (PyObject *printe
 /* Helper for apply_val_pretty_printer which calls to_string and
    formats the result.  */
 static void
-print_string_repr (PyObject *printer, const char *hint,
+print_string_repr (struct gdbarch *gdbarch,
+		   PyObject *printer, const char *hint,
 		   struct ui_file *stream, int recurse,
 		   const struct value_print_options *options,
 		   const struct language_defn *language)
@@ -190,8 +191,8 @@ print_string_repr (PyObject *printer, co
   if (output)
     {
       if (hint && !strcmp (hint, "string"))
-	LA_PRINT_STRING (stream, builtin_type (current_gdbarch)->builtin_char,
-			 (gdb_byte *) output, strlen (output),
+	LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
+			 gdbarch, (gdb_byte *) output, strlen (output),
 			 0, options);
       else
 	fputs_filtered (output, stream);
@@ -460,7 +461,8 @@ print_children (PyObject *printer, const
 }
 
 int
-apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
+apply_val_pretty_printer (struct type *type, struct gdbarch *gdbarch,
+			  const gdb_byte *valaddr,
 			  int embedded_offset, CORE_ADDR address,
 			  struct ui_file *stream, int recurse,
 			  const struct value_print_options *options,
@@ -477,12 +479,12 @@ apply_val_pretty_printer (struct type *t
   state = PyGILState_Ensure ();
   cleanups = make_cleanup_py_restore_gil (&state);
 
-  make_cleanup_python_env (current_gdbarch, language);
+  make_cleanup_python_env (gdbarch, language);
 
   /* Instantiate the printer.  */
   if (valaddr)
     valaddr += embedded_offset;
-  value = value_from_contents_and_address (type, valaddr, address);
+  value = value_from_contents_and_address (type, gdbarch, valaddr, address);
 
   val_obj = value_to_value_object (value);
   if (! val_obj)
@@ -500,7 +502,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 (gdbarch, printer, hint,
+		     stream, recurse, options, language);
   print_children (printer, hint, stream, recurse, options, language);
   result = 1;
 
@@ -589,7 +592,8 @@ gdbpy_default_visualizer (PyObject *self
 #else /* HAVE_PYTHON */
 
 int
-apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
+apply_val_pretty_printer (struct type *type, struct gdbarch *gdbarch,
+			  const gdb_byte *valaddr,
 			  int embedded_offset, CORE_ADDR address,
 			  struct ui_file *stream, int recurse,
 			  const struct value_print_options *options,
Index: gdb-head/gdb/python/python.h
===================================================================
--- gdb-head.orig/gdb/python/python.h
+++ gdb-head/gdb/python/python.h
@@ -26,7 +26,8 @@ extern struct value *values_in_python;
 
 void eval_python_from_control_command (struct command_line *);
 
-int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
+int apply_val_pretty_printer (struct type *type, struct gdbarch *gdbarch,
+			      const gdb_byte *valaddr,
 			      int embedded_offset, CORE_ADDR address,
 			      struct ui_file *stream, int recurse,
 			      const struct value_print_options *options,
Index: gdb-head/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-head.orig/gdb/doc/gdbint.texinfo
+++ gdb-head/gdb/doc/gdbint.texinfo
@@ -1953,14 +1953,10 @@ static struct lval_funcs nil_value_funcs
   @};
 
 struct value *
-make_nil_value (void)
+make_nil_value (struct type *type, struct gdbarch *gdbarch)
 @{
-   struct type *type;
    struct value *v;
-
-   type = make_nils_type ();
-   v = allocate_computed_value (type, &nil_value_funcs, NULL);
-
+   v = allocate_computed_value (type, gdbarch, &nil_value_funcs, NULL);
    return v;
 @}
 @end smallexample
@@ -3301,9 +3297,9 @@ For pointers, it performs architecture-s
 described above for @code{extract_typed_address}.
 @end deftypefun
 
-@deftypefun CORE_ADDR value_from_pointer (struct type *@var{type}, CORE_ADDR @var{addr})
+@deftypefun struct value *value_from_pointer (struct type *@var{type}, struct gdbarch *@var{gdbarch}, CORE_ADDR @var{addr})
 Create and return a value representing a pointer of type @var{type} to
-the address @var{addr}, as appropriate for the current architecture.
+the address @var{addr}, as appropriate for architecture @var{gdbarch}.
 This function performs architecture-specific conversions as described
 above for @code{store_typed_address}.
 @end deftypefun
-- 
  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]