[10/15] Basic value access routines

Ulrich Weigand
2009-06-09T15:20:14Z

Hello,

a number of core data conversion routines deeply buried in the
call chain implicitly use current_gdbarch to determine the format
of the data (address/pointer conversion, floating point formats).

This patch adds an explicit gdbarch argument to the following
routines to eliminate that use, and updates all call sites:

- unpack_long/unpack_double/unpack_pointer/pack_long
- extract_typed_address/store_typed_address/read_memory_typed_address
- extract_typed_floating/store_typed_floating/convert_typed_floating
- floatformat_from_type

Bye,
Ulrich

ChangeLog:

* value.h (unpack_long): Add GDBARCH parameter.
(unpack_double): Likewise.
(unpack_pointer): Likewise.
(pack_long): Likewise.
* value.c (unpack_long): Add GDBARCH parameter. Pass architecture
to extract_typed_floating, extract_typed_address and recursive call.
(unpack_double): Add GDBARCH parameter. Pass architecture to
unpack_long, extract_typed_floating and floatformat_from_type.
(unpack_pointer): Add GDBARCH parameter. Pass architecture to
unpack_long.
(pack_long): Add GDBARCH parameter. Pass architecture to
store_typed_address.

* defs.h (extract_typed_address): Add GDBARCH parameter.
(store_typed_address): Likewise.
* findvar.c (extract_typed_address): Add GDBARCH parameter.
Use it instead of current_gdbarch.
(store_typed_address): Likewise.
* gdbcore.h (read_memory_typed_address): Add GDBARCH parameter.
* corefile.c (read_memory_typed_address): Add GDBARCH parameter.
Pass architecture to extract_typed_address.

* doublest.h (floatformat_from_type): Add GDBARCH parameter.
(extract_typed_floating): Likewise.
(store_typed_floating): Likewise.
(convert_typed_floating): Likewise.
* doublest.c (floatformat_from_length): Add GDBARCH parameter.
Use it instead of current_gdbarch.
(floatformat_from_type): Likewise. Also, pass architecture to
floatformat_from_length.
(extract_typed_floating): Add GDBARCH parameter, pass architecture
to floatformat_from_type.
(store_typed_floating): Likewise.
(convert_typed_floating): Likewise.

* c-lang.c (emit_numeric_character): Add GDBARCH parameter.
(convert_octal, convert_hex, convert_escape, parse_one_string):
Likewise. Pass architecture to subroutines.
(evaluate_subexp_c): Pass architecture to parse_one_string.
(c_emit_char): Call store_signed_integer instead of pack_long.

Update calls to unpack_pointer, unpack_long, unpack_double, pack_long,
extract_typed_address, store_typed_address, read_memory_typed_address,
floatformat_from_type, extract_typed_floating, store_typed_floating,
and convert_typed_floating to pass in an appropriate architecture:
* ada-lang.c (ada_value_struct_elt): Update.
* ada-tasks.c (read_known_tasks_array): Update.
* ada-valprint.c (ada_val_print_1): Update.
* alpha-tdep.c (alpha_store_return_value): Update.
* amd64-tdep.c (amd64_get_longjmp_target): Update.
* arm-tdep.c (arm_extract_return_value): Update.
(arm_store_return_value): Update.
* c-lang.c (emit_numeric_character, evaluate_subexp_c): Update.
* c-valprint.c (c_val_print): Update.
* dwarf2-frame.c (read_reg): Update.
* findvar.c (read_var_value): Update.
* frame-unwind.c (frame_unwind_got_address): Update.
* f-valprint.c (f_val_print): Update.
* gnu-v2-abi.c (gnuv2_baseclass_offset): Update.
* gnu-v3-abi.c (gnuv3_decode_method_ptr): Update.
* hppa-tdep.c (hppa32_push_dummy_call, hppa64_push_dummy_call,
hppa32_convert_from_func_ptr_addr, hppa_skip_trampoline_code): Update.
* i386-tdep.c (i386_unwind_pc, i386_extract_return_value,
i386_store_return_value): Update.
* i387-tdep.c (i387_register_to_value, i387_value_to_register): Update.
* ia64-tdep.c (ia64_register_to_value, ia64_value_to_register,
ia64_extract_return_value, ia64_store_return_value): Update.
* jv-valprint.c (java_value_print): Update.
* m2-valprint.c (m2_print_unbounded_array, print_variable_at_address,
m2_val_print): Update.
* m68k-tdep.c (m68k_register_to_value, m68k_value_to_register,
m68k_svr4_extract_return_value, m68k_svr4_store_return_value,
m68k_unwind_pc): Update.
* mips-tdep.c (mips_print_fp_register): Update.
* nto-tdep.c (LM_ADDR): Update.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Update.
* printcmd.c (print_scalar_formatted, printf_command): Update.
* p-valprint.c (pascal_val_print): Update.
* rs6000-aix-tdep.c (rs6000_return_value): Update.
* rs6000-tdep.c (rs6000_register_to_value,
rs6000_value_to_register): Update.
* sh64-tdep.c (sh64_extract_return_value,
sh64_register_convert_to_virtual, sh64_register_convert_to_raw,
sh64_do_fp_register): Update.
* solib-darwin.c (darwin_load_image_infos, darwin_current_sos):
Update.
* solib-svr4.c (LM_ADDR_FROM_LINK_MAP, LM_DYNAMIC_FROM_LINK_MAP,
LM_NEXT, LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY, scan_dyntag,
elf_locate_base, solib_svr4_r_map, solib_svr4_r_brk,
solib_svr4_r_ldsomap, open_symbol_file_object): Update.
* spu-tdep.c (spu_integer_to_address): Update.
* stabsread.c (define_symbol): Update.
* valarith.c (value_concat): Update.
* valprint.c (val_print_type_code_int, val_print_type_code_flags,
print_floating): Update.
* value.c (value_as_long, value_as_double, value_as_address,
value_from_longest, value_from_pointer, value_from_double,
coerce_ref): Update.
* xtensa-tdep.c (xtensa_unwind_pc): Update.

* i387-tdep.c (print_i387_value): Add GDBARCH parameter, pass
architecture to extract_typed_floating.
(print_i387_ext): Add GDBARCH parameter, pass to print_i387_value.
(i387_print_float_info): Pass architecture to print_i387_ext.

* sh-tdep.c (sh_register_convert_to_virtual): Add GDBARCH parameter,
pass architecture to store_typed_floating.
(sh_register_convert_to_raw): Add GDBARCH parameter, pass architecture
to extract_typed_floating.
(sh_pseudo_register_read): Pass architecture to
sh_register_convert_to_virtual.
(sh_pseudo_register_write): Pass architecture to
sh_register_convert_to_raw.

* scm-lang.h (scm_unpack): Add GDBARCH parameter.
* scm-lang.c (scm_unpack): Add GDBARCH paramter, pass architecture
to unpack_long.

doc/ChangeLog:

* gdbint.texinfo (Pointers Are Not Always Addresses): Update
signature of extract_typed_address and store_typed_address.

Index: gdb-head/gdb/ada-lang.c
===================================================================
--- gdb-head.orig/gdb/ada-lang.c
+++ gdb-head/gdb/ada-lang.c
@@ -6155,7 +6155,7 @@ ada_value_struct_elt (struct value *arg,
if (TYPE_CODE (t) == TYPE_CODE_PTR)
address = value_as_address (arg);
else
- address = unpack_pointer (t, value_contents (arg));
+ address = unpack_pointer (t, value_arch (arg), value_contents (arg));

t1 = ada_to_fixed_type (ada_get_base_type (t1), value_arch (arg),
NULL, address, NULL, 1);
Index: gdb-head/gdb/ada-tasks.c
===================================================================
--- gdb-head.orig/gdb/ada-tasks.c
+++ gdb-head/gdb/ada-tasks.c
@@ -638,7 +638,7 @@ read_known_tasks_array (void)
builtin_type (target_gdbarch)->builtin_data_ptr;
CORE_ADDR task_id =
extract_typed_address (known_tasks + i * target_ptr_byte,
- data_ptr_type);
+ data_ptr_type, target_gdbarch);

if (task_id != 0)
add_ada_task (task_id);
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -736,7 +736,7 @@ ada_val_print_1 (struct type *type, stru
case TYPE_CODE_RANGE:
if (ada_is_fixed_point_type (type))
{
- LONGEST v = unpack_long (type, valaddr);
+ LONGEST v = unpack_long (type, gdbarch, valaddr);
int len = TYPE_LENGTH (type);

fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g",
@@ -803,7 +803,7 @@ ada_val_print_1 (struct type *type, stru
type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
fputs_filtered (paddress (extract_typed_address
- (valaddr, ptr_type)),
+ (valaddr, ptr_type, gdbarch)),
stream);
}
else
@@ -812,7 +812,8 @@ ada_val_print_1 (struct type *type, stru
if (ada_is_character_type (type))
{
fputs_filtered (" ", stream);
- ada_printchar ((unsigned char) unpack_long (type, valaddr),
+ ada_printchar ((unsigned char)
+ unpack_long (type, gdbarch, valaddr),
type, stream);
}
}
@@ -827,7 +828,7 @@ ada_val_print_1 (struct type *type, stru
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr);
+ val = unpack_long (type, gdbarch, valaddr);
for (i = 0; i < len; i++)
{
QUIT;
@@ -892,7 +893,8 @@ ada_val_print_1 (struct type *type, stru

if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- LONGEST deref_val_int = (LONGEST) unpack_pointer (type, valaddr);
+ LONGEST deref_val_int
+ = (LONGEST) unpack_pointer (type, gdbarch, valaddr);
if (deref_val_int != 0)
{
struct value *deref_val =
Index: gdb-head/gdb/alpha-tdep.c
===================================================================
--- gdb-head.orig/gdb/alpha-tdep.c
+++ gdb-head/gdb/alpha-tdep.c
@@ -498,6 +498,7 @@ static void
alpha_store_return_value (struct type *valtype, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
@@ -557,7 +558,7 @@ alpha_store_return_value (struct type *v
even if the base data type is unsigned. */
if (length == 4)
valtype = builtin_type_int32;
- l = unpack_long (valtype, valbuf);
+ l = unpack_long (valtype, gdbarch, valbuf);
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
break;
}
Index: gdb-head/gdb/amd64-tdep.c
===================================================================
--- gdb-head.orig/gdb/amd64-tdep.c
+++ gdb-head/gdb/amd64-tdep.c
@@ -1966,11 +1966,12 @@ amd64_get_longjmp_target (struct frame_i

get_frame_register (frame, AMD64_RDI_REGNUM, buf);
jb_addr= extract_typed_address
- (buf, builtin_type (gdbarch)->builtin_data_ptr);
+ (buf, builtin_type (gdbarch)->builtin_data_ptr, gdbarch);
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
return 0;

- *pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ *pc = extract_typed_address
+ (buf, builtin_type (gdbarch)->builtin_func_ptr, gdbarch);

return 1;
}
Index: gdb-head/gdb/arm-tdep.c
===================================================================
--- gdb-head.orig/gdb/arm-tdep.c
+++ gdb-head/gdb/arm-tdep.c
@@ -2308,8 +2308,9 @@ arm_extract_return_value (struct type *t
bfd_byte tmpbuf[FP_REGISTER_SIZE];

regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
- convert_from_extended (floatformat_from_type (type), tmpbuf,
- valbuf, gdbarch_byte_order (gdbarch));
+ convert_from_extended (floatformat_from_type (type, gdbarch),
+ tmpbuf, valbuf,
+ gdbarch_byte_order (gdbarch));
}
break;

@@ -2493,8 +2494,8 @@ arm_store_return_value (struct type *typ
{
case ARM_FLOAT_FPA:

- convert_to_extended (floatformat_from_type (type), buf, valbuf,
- gdbarch_byte_order (gdbarch));
+ convert_to_extended (floatformat_from_type (type, gdbarch),
+ buf, valbuf, gdbarch_byte_order (gdbarch));
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;

@@ -2525,7 +2526,7 @@ arm_store_return_value (struct type *typ
/* Values of one word or less are zero/sign-extended and
returned in r0. */
bfd_byte tmpbuf[INT_REGISTER_SIZE];
- LONGEST val = unpack_long (type, valbuf);
+ LONGEST val = unpack_long (type, gdbarch, valbuf);

store_signed_integer (tmpbuf, INT_REGISTER_SIZE, val);
regcache_cooked_write (regs, ARM_A1_REGNUM, tmpbuf);
Index: gdb-head/gdb/bsd-uthread.c
===================================================================
--- gdb-head.orig/gdb/bsd-uthread.c
+++ gdb-head/gdb/bsd-uthread.c
@@ -149,7 +149,7 @@ static CORE_ADDR
bsd_uthread_read_memory_address (CORE_ADDR addr)
{
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- return read_memory_typed_address (addr, ptr_type);
+ return read_memory_typed_address (addr, ptr_type, target_gdbarch);
}

/* If OBJFILE contains the symbols corresponding to one of the
Index: gdb-head/gdb/corefile.c
===================================================================
--- gdb-head.orig/gdb/corefile.c
+++ gdb-head/gdb/corefile.c
@@ -334,11 +334,12 @@ read_memory_string (CORE_ADDR memaddr, c
}

CORE_ADDR
-read_memory_typed_address (CORE_ADDR addr, struct type *type)
+read_memory_typed_address (CORE_ADDR addr,
+ struct type *type, struct gdbarch *gdbarch)
{
gdb_byte *buf = alloca (TYPE_LENGTH (type));
read_memory (addr, buf, TYPE_LENGTH (type));
- return extract_typed_address (buf, type);
+ return extract_typed_address (buf, type, gdbarch);
}

/* Same as target_write_memory, but report an error if can't write. */
Index: gdb-head/gdb/c-valprint.c
===================================================================
--- gdb-head.orig/gdb/c-valprint.c
+++ gdb-head/gdb/c-valprint.c
@@ -236,7 +236,7 @@ c_val_print (struct type *type, struct g
/* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
break;
@@ -244,7 +244,7 @@ c_val_print (struct type *type, struct g
unresolved_elttype = TYPE_TARGET_TYPE (type);
elttype = check_typedef (unresolved_elttype);
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer:

if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
@@ -271,7 +271,8 @@ c_val_print (struct type *type, struct g
else if (cp_is_vtbl_member (type))
{
/* print vtbl's nicely */
- CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+ CORE_ADDR vt_address
+ = unpack_pointer (type, gdbarch, valaddr + embedded_offset);

struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
@@ -325,7 +326,7 @@ c_val_print (struct type *type, struct g
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -339,7 +340,7 @@ c_val_print (struct type *type, struct g
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse, options,
current_language);
}
@@ -366,7 +367,7 @@ c_val_print (struct type *type, struct g
TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8);
struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET);
CORE_ADDR addr
- = extract_typed_address (valaddr + offset, field_type);
+ = extract_typed_address (valaddr + offset, field_type, gdbarch);

print_function_pointer_address (gdbarch, addr, stream,
options->addressprint);
@@ -384,7 +385,7 @@ c_val_print (struct type *type, struct g
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -440,7 +441,7 @@ c_val_print (struct type *type, struct g
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("false", stream);
else if (val == 1)
@@ -480,7 +481,9 @@ c_val_print (struct type *type, struct g
if (textual_element_type (unresolved_type, options->format))
{
fputs_filtered (" ", stream);
- LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
+ LA_PRINT_CHAR ((unsigned char)
+ unpack_long (type, gdbarch,
+ valaddr + embedded_offset),
unresolved_type, stream);
}
}
@@ -497,7 +500,7 @@ c_val_print (struct type *type, struct g
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/defs.h
===================================================================
--- gdb-head.orig/gdb/defs.h
+++ gdb-head/gdb/defs.h
@@ -1054,15 +1054,15 @@ extern ULONGEST extract_unsigned_integer

extern int extract_long_unsigned_integer (const gdb_byte *, int, LONGEST *);

-extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
- struct type *type);
+extern CORE_ADDR extract_typed_address (const gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch);

extern void store_signed_integer (gdb_byte *, int, LONGEST);

extern void store_unsigned_integer (gdb_byte *, int, ULONGEST);

extern void store_typed_address (gdb_byte *buf, struct type *type,
- CORE_ADDR addr);
+ struct gdbarch *gdbarch, CORE_ADDR addr);

\f
/* From valops.c */
Index: gdb-head/gdb/doublest.c
===================================================================
--- gdb-head.orig/gdb/doublest.c
+++ gdb-head/gdb/doublest.c
@@ -761,27 +761,27 @@ floatformat_from_doublest (const struct
but not passed on by GDB. This should be fixed. */

static const struct floatformat *
-floatformat_from_length (int len)
+floatformat_from_length (int len, struct gdbarch *gdbarch)
{
const struct floatformat *format;
- if (len * TARGET_CHAR_BIT == gdbarch_float_bit (current_gdbarch))
- format = gdbarch_float_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (current_gdbarch))
- format = gdbarch_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
- else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (current_gdbarch))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ if (len * TARGET_CHAR_BIT == gdbarch_float_bit (gdbarch))
+ format = gdbarch_float_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_double_bit (gdbarch))
+ format = gdbarch_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
+ else if (len * TARGET_CHAR_BIT == gdbarch_long_double_bit (gdbarch))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
/* On i386 the 'long double' type takes 96 bits,
while the real number of used bits is only 80,
both in processor and in memory.
The code below accepts the real bit size. */
- else if ((gdbarch_long_double_format (current_gdbarch) != NULL)
+ else if ((gdbarch_long_double_format (gdbarch) != NULL)
&& (len * TARGET_CHAR_BIT ==
- gdbarch_long_double_format (current_gdbarch)[0]->totalsize))
- format = gdbarch_long_double_format (current_gdbarch)
- [gdbarch_byte_order (current_gdbarch)];
+ gdbarch_long_double_format (gdbarch)[0]->totalsize))
+ format = gdbarch_long_double_format (gdbarch)
+ [gdbarch_byte_order (gdbarch)];
else
format = NULL;
if (format == NULL)
@@ -791,22 +791,24 @@ floatformat_from_length (int len)
}

const struct floatformat *
-floatformat_from_type (const struct type *type)
+floatformat_from_type (const struct type *type,
+ struct gdbarch *gdbarch)
{
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
if (TYPE_FLOATFORMAT (type) != NULL)
- return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)];
+ return TYPE_FLOATFORMAT (type)[gdbarch_byte_order (gdbarch)];
else
- return floatformat_from_length (TYPE_LENGTH (type));
+ return floatformat_from_length (TYPE_LENGTH (type), gdbarch);
}

/* Extract a floating-point number of type TYPE from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */

DOUBLEST
-extract_typed_floating (const void *addr, const struct type *type)
+extract_typed_floating (const void *addr, const struct type *type,
+ struct gdbarch *gdbarch)
{
- const struct floatformat *fmt = floatformat_from_type (type);
+ const struct floatformat *fmt = floatformat_from_type (type, gdbarch);
DOUBLEST retval;

floatformat_to_doublest (fmt, addr, &retval);
@@ -817,9 +819,10 @@ extract_typed_floating (const void *addr
byte-stream at ADDR. */

void
-store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
+store_typed_floating (void *addr, const struct type *type,
+ struct gdbarch *gdbarch, DOUBLEST val)
{
- const struct floatformat *fmt = floatformat_from_type (type);
+ const struct floatformat *fmt = floatformat_from_type (type, gdbarch);

/* FIXME: kettenis/2001-10-28: It is debatable whether we should
zero out any remaining bytes in the target buffer when TYPE is
@@ -850,10 +853,13 @@ store_typed_floating (void *addr, const

void
convert_typed_floating (const void *from, const struct type *from_type,
- void *to, const struct type *to_type)
+ void *to, const struct type *to_type,
+ struct gdbarch *gdbarch)
{
- const struct floatformat *from_fmt = floatformat_from_type (from_type);
- const struct floatformat *to_fmt = floatformat_from_type (to_type);
+ const struct floatformat *from_fmt
+ = floatformat_from_type (from_type, gdbarch);
+ const struct floatformat *to_fmt
+ = floatformat_from_type (to_type, gdbarch);

if (from_fmt == NULL || to_fmt == NULL)
{
Index: gdb-head/gdb/doublest.h
===================================================================
--- gdb-head.orig/gdb/doublest.h
+++ gdb-head/gdb/doublest.h
@@ -89,14 +89,17 @@ extern const char *floatformat_mantissa
NULL. type_floatformat() detects that and returns a floatformat
based on the type size when FLOATFORMAT is NULL. */

-const struct floatformat *floatformat_from_type (const struct type *type);
+const struct floatformat *floatformat_from_type (const struct type *type,
+ struct gdbarch *gdbarch);

extern DOUBLEST extract_typed_floating (const void *addr,
- const struct type *type);
+ const struct type *type,
+ struct gdbarch *gdbarch);
extern void store_typed_floating (void *addr, const struct type *type,
- DOUBLEST val);
+ struct gdbarch *gdbarch, DOUBLEST val);
extern void convert_typed_floating (const void *from,
const struct type *from_type,
- void *to, const struct type *to_type);
+ void *to, const struct type *to_type,
+ struct gdbarch *gdbarch);

#endif
Index: gdb-head/gdb/dwarf2-frame.c
===================================================================
--- gdb-head.orig/gdb/dwarf2-frame.c
+++ gdb-head/gdb/dwarf2-frame.c
@@ -288,7 +288,7 @@ read_reg (void *baton, int reg)
under the covers, and this makes more sense for non-pointer
registers. Maybe read_reg and the associated interfaces should
deal with "struct value" instead of CORE_ADDR. */
- return unpack_long (register_type (gdbarch, regnum), buf);
+ return unpack_long (register_type (gdbarch, regnum), gdbarch, buf);
}

static void
Index: gdb-head/gdb/findvar.c
===================================================================
--- gdb-head.orig/gdb/findvar.c
+++ gdb-head/gdb/findvar.c
@@ -162,10 +162,11 @@ extract_long_unsigned_integer (const gdb
}

-/* Treat the bytes at BUF as a pointer of type TYPE, and return the
- address it represents. */
+/* Treat the bytes at BUF as a pointer of type TYPE in target format
+ of architecture GDBARCH, and return the address it represents. */
CORE_ADDR
-extract_typed_address (const gdb_byte *buf, struct type *type)
+extract_typed_address (const gdb_byte *buf,
+ struct type *type, struct gdbarch *gdbarch)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@@ -173,7 +174,7 @@ extract_typed_address (const gdb_byte *b
_("extract_typed_address: "
"type is not a pointer or reference"));

- return gdbarch_pointer_to_address (current_gdbarch, type, buf);
+ return gdbarch_pointer_to_address (gdbarch, type, buf);
}

@@ -231,10 +232,11 @@ store_unsigned_integer (gdb_byte *addr,
}
}

-/* Store the address ADDR as a pointer of type TYPE at BUF, in target
- form. */
+/* Store the address ADDR as a pointer of type TYPE at BUF,
+ in target format of architecture GDBARCH. */
void
-store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
+store_typed_address (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, CORE_ADDR addr)
{
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@@ -242,7 +244,7 @@ store_typed_address (gdb_byte *buf, stru
_("store_typed_address: "
"type is not a pointer or reference"));

- gdbarch_address_to_pointer (current_gdbarch, type, buf, addr);
+ gdbarch_address_to_pointer (gdbarch, type, buf, addr);
}

@@ -427,10 +429,10 @@ read_var_value (struct symbol *var, stru
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
SYMBOL_OBJ_SECTION (var));
- store_typed_address (value_contents_raw (v), type, addr);
+ store_typed_address (value_contents_raw (v), type, gdbarch, addr);
}
else
- store_typed_address (value_contents_raw (v), type,
+ store_typed_address (value_contents_raw (v), type, gdbarch,
SYMBOL_VALUE_ADDRESS (var));
VALUE_LVAL (v) = not_lval;
return v;
Index: gdb-head/gdb/frame-unwind.c
===================================================================
--- gdb-head.orig/gdb/frame-unwind.c
+++ gdb-head/gdb/frame-unwind.c
@@ -194,7 +194,7 @@ frame_unwind_got_address (struct frame_i

reg_val = value_zero (register_type (gdbarch, regnum), gdbarch, not_lval);
pack_long (value_contents_writeable (reg_val),
- register_type (gdbarch, regnum), addr);
+ register_type (gdbarch, regnum), gdbarch, addr);
return reg_val;
}

Index: gdb-head/gdb/f-valprint.c
===================================================================
--- gdb-head.orig/gdb/f-valprint.c
+++ gdb-head/gdb/f-valprint.c
@@ -278,7 +278,7 @@ f_val_print (struct type *type, struct g
}
else
{
- addr = unpack_pointer (type, valaddr);
+ addr = unpack_pointer (type, gdbarch, valaddr);
elttype = check_typedef (TYPE_TARGET_TYPE (type));

if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
@@ -313,7 +313,7 @@ f_val_print (struct type *type, struct g
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -327,7 +327,7 @@ f_val_print (struct type *type, struct g
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse,
options, current_language);
}
@@ -369,7 +369,8 @@ f_val_print (struct type *type, struct g
if (TYPE_LENGTH (type) == 1)
{
fputs_filtered (" ", stream);
- LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr),
+ LA_PRINT_CHAR ((unsigned char)
+ unpack_long (type, gdbarch, valaddr),
type, stream);
}
}
Index: gdb-head/gdb/gdbcore.h
===================================================================
--- gdb-head.orig/gdb/gdbcore.h
+++ gdb-head/gdb/gdbcore.h
@@ -63,10 +63,11 @@ extern ULONGEST read_memory_unsigned_int

extern void read_memory_string (CORE_ADDR, char *, int);

-/* Read the pointer of type TYPE at ADDR, and return the address it
- represents. */
+/* Read the pointer of type TYPE at ADDR in target format of architecture
+ GDBARCH, and return the address it represents. */

-CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type);
+CORE_ADDR read_memory_typed_address (CORE_ADDR addr, struct type *type,
+ struct gdbarch *gdbarch);

/* This takes a char *, not void *. This is probably right, because
passing in an int * or whatever is wrong with respect to
Index: gdb-head/gdb/gnu-v2-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v2-abi.c
+++ gdb-head/gdb/gnu-v2-abi.c
@@ -366,7 +366,7 @@ gnuv2_baseclass_offset (struct type *typ
if (vb_match (type, i, basetype))
{
CORE_ADDR addr
- = unpack_pointer (TYPE_FIELD_TYPE (type, i),
+ = unpack_pointer (TYPE_FIELD_TYPE (type, i), gdbarch,
valaddr + (TYPE_FIELD_BITPOS (type, i) / 8));

return addr - (LONGEST) address;
Index: gdb-head/gdb/gnu-v3-abi.c
===================================================================
--- gdb-head.orig/gdb/gnu-v3-abi.c
+++ gdb-head/gdb/gnu-v3-abi.c
@@ -525,7 +525,7 @@ gnuv3_decode_method_ptr (struct gdbarch
vtable offsets we must handle as integers. At this point, we do not
yet know which case we have, so we extract the value under both
interpretations and choose the right one later on. */
- ptr_value = extract_typed_address (contents, funcptr_type);
+ ptr_value = extract_typed_address (contents, funcptr_type, gdbarch);
voffset = extract_signed_integer (contents, TYPE_LENGTH (funcptr_type));
contents += TYPE_LENGTH (funcptr_type);
adjustment = extract_signed_integer (contents, TYPE_LENGTH (offset_type));
Index: gdb-head/gdb/hppa-tdep.c
===================================================================
--- gdb-head.orig/gdb/hppa-tdep.c
+++ gdb-head/gdb/hppa-tdep.c
@@ -746,7 +746,7 @@ hppa32_push_dummy_call (struct gdbarch *
takes care of any sign-extension problems. */
param_len = align_up (TYPE_LENGTH (type), 4);
store_unsigned_integer (param_val, param_len,
- unpack_long (type,
+ unpack_long (type, value_arch (arg),
value_contents (arg)));
}
else if (TYPE_CODE (type) == TYPE_CODE_FLT)
@@ -1043,7 +1043,7 @@ hppa64_push_dummy_call (struct gdbarch *
{
ULONGEST codeptr, fptr;

- codeptr = unpack_long (type, value_contents (arg));
+ codeptr = unpack_long (type, value_arch (arg), value_contents (arg));
fptr = hppa64_convert_code_addr_to_fptr (codeptr);
store_unsigned_integer (fptrbuf, TYPE_LENGTH (type), fptr);
valbuf = fptrbuf;
@@ -1248,7 +1248,7 @@ hppa32_convert_from_func_ptr_addr (struc
{
struct type *func_ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
CORE_ADDR plabel = addr & ~3;
- return read_memory_typed_address (plabel, func_ptr_type);
+ return read_memory_typed_address (plabel, func_ptr_type, gdbarch);
}

return addr;
@@ -2913,7 +2913,7 @@ hppa_skip_trampoline_code (struct frame_

/* PLABELs have bit 30 set; if it's a PLABEL, then dereference it. */
if (pc & 0x2)
- pc = read_memory_typed_address (pc & ~0x3, func_ptr_type);
+ pc = read_memory_typed_address (pc & ~0x3, func_ptr_type, gdbarch);

return pc;
}
@@ -2934,7 +2934,7 @@ hppa_skip_trampoline_code (struct frame_

if (in_plt_section (pc, NULL))
{
- pc = read_memory_typed_address (pc, func_ptr_type);
+ pc = read_memory_typed_address (pc, func_ptr_type, gdbarch);

/* If the PLT slot has not yet been resolved, the target will be
the PLT stub. */
@@ -2948,7 +2948,7 @@ hppa_skip_trampoline_code (struct frame_
}

/* This should point to the fixup routine. */
- pc = read_memory_typed_address (pc + 8, func_ptr_type);
+ pc = read_memory_typed_address (pc + 8, func_ptr_type, gdbarch);
}
}

Index: gdb-head/gdb/i386-tdep.c
===================================================================
--- gdb-head.orig/gdb/i386-tdep.c
+++ gdb-head/gdb/i386-tdep.c
@@ -1311,7 +1311,8 @@ i386_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);
}
\f

@@ -1787,7 +1788,8 @@ i386_extract_return_value (struct gdbarc
exactly how it would happen on the target itself, but it is
the best we can do. */
regcache_raw_read (regcache, I386_ST0_REGNUM, buf);
- convert_typed_floating (buf, builtin_type_i387_ext, valbuf, type);
+ convert_typed_floating (buf, builtin_type_i387_ext,
+ valbuf, type, gdbarch);
}
else
{
@@ -1841,7 +1843,8 @@ i386_store_return_value (struct gdbarch
floating-point format used by the FPU. This is probably
not exactly how it would happen on the target itself, but
it is the best we can do. */
- convert_typed_floating (valbuf, type, buf, builtin_type_i387_ext);
+ convert_typed_floating (valbuf, type,
+ buf, builtin_type_i387_ext, gdbarch);
regcache_raw_write (regcache, I386_ST0_REGNUM, buf);

/* Set the top of the floating-point register stack to 7. The
Index: gdb-head/gdb/i387-tdep.c
===================================================================
--- gdb-head.orig/gdb/i387-tdep.c
+++ gdb-head/gdb/i387-tdep.c
@@ -37,7 +37,8 @@
/* Print the floating point number specified by RAW. */

static void
-print_i387_value (const gdb_byte *raw, struct ui_file *file)
+print_i387_value (struct gdbarch *gdbarch,
+ const gdb_byte *raw, struct ui_file *file)
{
DOUBLEST value;

@@ -45,7 +46,7 @@ print_i387_value (const gdb_byte *raw, s
of certain numbers such as NaNs, even if GDB is running natively.
This is fine since our caller already detects such special
numbers and we print the hexadecimal representation anyway. */
- value = extract_typed_floating (raw, builtin_type_i387_ext);
+ value = extract_typed_floating (raw, builtin_type_i387_ext, gdbarch);

/* We try to print 19 digits. The last digit may or may not contain
garbage, but we'd better print one too many. We need enough room
@@ -61,7 +62,8 @@ print_i387_value (const gdb_byte *raw, s
/* Print the classification for the register contents RAW. */

static void
-print_i387_ext (const gdb_byte *raw, struct ui_file *file)
+print_i387_ext (struct gdbarch *gdbarch,
+ const gdb_byte *raw, struct ui_file *file)
{
int sign;
int integer;
@@ -92,11 +94,11 @@ print_i387_ext (const gdb_byte *raw, str
}
else if (exponent < 0x7fff && exponent > 0x0000 && integer)
/* Normal. */
- print_i387_value (raw, file);
+ print_i387_value (gdbarch, raw, file);
else if (exponent == 0x0000)
{
/* Denormal or zero. */
- print_i387_value (raw, file);
+ print_i387_value (gdbarch, raw, file);

if (integer)
/* Pseudo-denormal. */
@@ -258,7 +260,7 @@ i387_print_float_info (struct gdbarch *g
fprintf_filtered (file, "%02x", raw[i]);

if (tag != 3)
- print_i387_ext (raw, file);
+ print_i387_ext (gdbarch, raw, file);

fputs_filtered ("\n", file);
}
@@ -306,9 +308,10 @@ void
i387_register_to_value (struct frame_info *frame, int regnum,
struct type *type, gdb_byte *to)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[I386_MAX_REGISTER_SIZE];

- gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum));
+ gdb_assert (i386_fp_regnum_p (gdbarch, regnum));

/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -320,7 +323,7 @@ i387_register_to_value (struct frame_inf

/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
- convert_typed_floating (from, builtin_type_i387_ext, to, type);
+ convert_typed_floating (from, builtin_type_i387_ext, to, type, gdbarch);
}

/* Write the contents FROM of a value of type TYPE into register
@@ -330,9 +333,10 @@ void
i387_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const gdb_byte *from)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[I386_MAX_REGISTER_SIZE];

- gdb_assert (i386_fp_regnum_p (get_frame_arch (frame), regnum));
+ gdb_assert (i386_fp_regnum_p (gdbarch, regnum));

/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -343,7 +347,7 @@ i387_value_to_register (struct frame_inf
}

/* Convert from TYPE. */
- convert_typed_floating (from, type, to, builtin_type_i387_ext);
+ convert_typed_floating (from, type, to, builtin_type_i387_ext, gdbarch);
put_frame_register (frame, regnum, to);
}
\f
Index: gdb-head/gdb/ia64-tdep.c
===================================================================
--- gdb-head.orig/gdb/ia64-tdep.c
+++ gdb-head/gdb/ia64-tdep.c
@@ -1055,17 +1055,19 @@ static void
ia64_register_to_value (struct frame_info *frame, int regnum,
struct type *valtype, gdb_byte *out)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char in[MAX_REGISTER_SIZE];
frame_register_read (frame, regnum, in);
- convert_typed_floating (in, builtin_type_ia64_ext, out, valtype);
+ convert_typed_floating (in, builtin_type_ia64_ext, out, valtype, gdbarch);
}

static void
ia64_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
char out[MAX_REGISTER_SIZE];
- convert_typed_floating (in, valtype, out, builtin_type_ia64_ext);
+ convert_typed_floating (in, valtype, out, builtin_type_ia64_ext, gdbarch);
put_frame_register (frame, regnum, out);
}

@@ -2985,6 +2987,7 @@ static void
ia64_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;

float_elt_type = is_float_or_hfa_type (type);
@@ -2999,7 +3002,8 @@ ia64_extract_return_value (struct type *
{
regcache_cooked_read (regcache, regnum, from);
convert_typed_floating (from, builtin_type_ia64_ext,
- (char *)valbuf + offset, float_elt_type);
+ (char *)valbuf + offset, float_elt_type,
+ gdbarch);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
}
@@ -3035,6 +3039,7 @@ static void
ia64_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf)
{
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct type *float_elt_type;

float_elt_type = is_float_or_hfa_type (type);
@@ -3048,7 +3053,7 @@ ia64_store_return_value (struct type *ty
while (n-- > 0)
{
convert_typed_floating ((char *)valbuf + offset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, builtin_type_ia64_ext, gdbarch);
regcache_cooked_write (regcache, regnum, to);
offset += TYPE_LENGTH (float_elt_type);
regnum++;
@@ -3520,7 +3525,7 @@ ia64_push_dummy_call (struct gdbarch *gd
{
char to[MAX_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset, float_elt_type,
- to, builtin_type_ia64_ext);
+ to, builtin_type_ia64_ext, gdbarch);
regcache_cooked_write (regcache, floatreg, (void *)to);
floatreg++;
argoffset += TYPE_LENGTH (float_elt_type);
Index: gdb-head/gdb/jv-valprint.c
===================================================================
--- gdb-head.orig/gdb/jv-valprint.c
+++ gdb-head/gdb/jv-valprint.c
@@ -54,7 +54,7 @@ java_value_print (struct value *val, str

/* Get the run-time type, and cast the object into that */

- obj_addr = unpack_pointer (type, value_contents (val));
+ obj_addr = unpack_pointer (type, gdbarch, value_contents (val));

if (obj_addr != 0)
{
@@ -486,7 +486,7 @@ java_val_print (struct type *type, struc
break;
}
#endif
- addr = unpack_pointer (type, valaddr);
+ addr = unpack_pointer (type, gdbarch, valaddr);
if (addr == 0)
{
fputs_filtered ("null", stream);
@@ -525,7 +525,8 @@ java_val_print (struct type *type, struc
|| (TYPE_CODE (type) == TYPE_CODE_INT
&& TYPE_LENGTH (type) == 2
&& strcmp (TYPE_NAME (type), "char") == 0))
- LA_PRINT_CHAR ((int) unpack_long (type, valaddr), type, stream);
+ LA_PRINT_CHAR ((int) unpack_long (type, gdbarch, valaddr),
+ type, stream);
else
val_print_type_code_int (type, gdbarch, valaddr, stream);
break;
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -198,7 +198,7 @@ m2_print_unbounded_array (struct type *t
CHECK_TYPEDEF (type);
content_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0));

- addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
+ addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0), gdbarch,
(TYPE_FIELD_BITPOS (type, 0) / 8) +
valaddr + embedded_offset);

@@ -254,7 +254,7 @@ print_variable_at_address (struct type *
int recurse,
const struct value_print_options *options)
{
- CORE_ADDR addr = unpack_pointer (type, valaddr);
+ CORE_ADDR addr = unpack_pointer (type, gdbarch, valaddr);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));

fprintf_filtered (stream, "[");
@@ -263,8 +263,9 @@ print_variable_at_address (struct type *

if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
{
- struct value *deref_val = value_at (TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr));
+ struct value *deref_val
+ = value_at (TYPE_TARGET_TYPE (type), gdbarch,
+ unpack_pointer (type, gdbarch, valaddr));
common_val_print (deref_val, stream, recurse, options, current_language);
}
else
@@ -395,7 +396,7 @@ m2_val_print (struct type *type, struct
options, 0, stream);
else
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer (type, gdbarch, addr, address,
options, stream);
}
@@ -406,7 +407,7 @@ m2_val_print (struct type *type, struct
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -419,7 +420,8 @@ m2_val_print (struct type *type, struct
{
struct value *deref_val =
value_at (TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch,
+ valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse, options,
current_language);
}
@@ -455,7 +457,7 @@ m2_val_print (struct type *type, struct
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -501,7 +503,7 @@ m2_val_print (struct type *type, struct
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("FALSE", stream);
else if (val == 1)
@@ -552,7 +554,7 @@ m2_val_print (struct type *type, struct
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/m68k-tdep.c
===================================================================
--- gdb-head.orig/gdb/m68k-tdep.c
+++ gdb-head/gdb/m68k-tdep.c
@@ -184,9 +184,9 @@ static void
m68k_register_to_value (struct frame_info *frame, int regnum,
struct type *type, gdb_byte *to)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[M68K_MAX_REGISTER_SIZE];
- struct type *fpreg_type = register_type (get_frame_arch (frame),
- M68K_FP0_REGNUM);
+ struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);

/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -198,7 +198,7 @@ m68k_register_to_value (struct frame_inf

/* Convert to TYPE. */
get_frame_register (frame, regnum, from);
- convert_typed_floating (from, fpreg_type, to, type);
+ convert_typed_floating (from, fpreg_type, to, type, gdbarch);
}

/* Write the contents FROM of a value of type TYPE into register
@@ -208,9 +208,9 @@ static void
m68k_value_to_register (struct frame_info *frame, int regnum,
struct type *type, const gdb_byte *from)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[M68K_MAX_REGISTER_SIZE];
- struct type *fpreg_type = register_type (get_frame_arch (frame),
- M68K_FP0_REGNUM);
+ struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);

/* We only support floating-point values. */
if (TYPE_CODE (type) != TYPE_CODE_FLT)
@@ -221,7 +221,7 @@ m68k_value_to_register (struct frame_inf
}

/* Convert from TYPE. */
- convert_typed_floating (from, type, to, fpreg_type);
+ convert_typed_floating (from, type, to, fpreg_type, gdbarch);
put_frame_register (frame, regnum, to);
}

@@ -294,7 +294,7 @@ m68k_svr4_extract_return_value (struct t
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
- convert_typed_floating (buf, fpreg_type, valbuf, type);
+ convert_typed_floating (buf, fpreg_type, valbuf, type, gdbarch);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
@@ -335,7 +335,7 @@ m68k_svr4_store_return_value (struct typ
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
- convert_typed_floating (valbuf, type, buf, fpreg_type);
+ convert_typed_floating (valbuf, type, buf, fpreg_type, gdbarch);
regcache_raw_write (regcache, M68K_FP0_REGNUM, buf);
}
else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
@@ -833,7 +833,8 @@ m68k_unwind_pc (struct gdbarch *gdbarch,
gdb_byte buf[8];

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ return extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);
}
\f
/* Normal frames. */
Index: gdb-head/gdb/mips-tdep.c
===================================================================
--- gdb-head.orig/gdb/mips-tdep.c
+++ gdb-head/gdb/mips-tdep.c
@@ -4394,7 +4394,8 @@ mips_print_fp_register (struct ui_file *
/* 4-byte registers: Print hex and floating. Also print even
numbered registers as doubles. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
- flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), gdbarch,
+ raw_buffer, &inv1);

get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint32, gdbarch,
@@ -4409,8 +4410,8 @@ mips_print_fp_register (struct ui_file *
if ((regnum - gdbarch_num_regs (gdbarch)) % 2 == 0)
{
mips_read_fp_register_double (frame, regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer,
- &inv2);
+ doub = unpack_double (mips_double_register_type (), gdbarch,
+ raw_buffer, &inv2);

fprintf_filtered (file, " dbl: ");
if (inv2)
@@ -4425,10 +4426,12 @@ mips_print_fp_register (struct ui_file *

/* Eight byte registers: print each one as hex, float and double. */
mips_read_fp_register_single (frame, regnum, raw_buffer);
- flt1 = unpack_double (mips_float_register_type (), raw_buffer, &inv1);
+ flt1 = unpack_double (mips_float_register_type (), gdbarch,
+ raw_buffer, &inv1);

mips_read_fp_register_double (frame, regnum, raw_buffer);
- doub = unpack_double (mips_double_register_type (), raw_buffer, &inv2);
+ doub = unpack_double (mips_double_register_type (), gdbarch,
+ raw_buffer, &inv2);

get_formatted_print_options (&opts, 'x');
print_scalar_formatted (raw_buffer, builtin_type_uint64, gdbarch,
Index: gdb-head/gdb/nto-tdep.c
===================================================================
--- gdb-head.orig/gdb/nto-tdep.c
+++ gdb-head/gdb/nto-tdep.c
@@ -283,7 +283,8 @@ LM_ADDR (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

so->lm_info->l_addr =
- extract_typed_address (so->lm_info->lm + lmo->l_addr_offset, ptr_type);
+ extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+ ptr_type, target_gdbarch);
}
return so->lm_info->l_addr;
}
Index: gdb-head/gdb/ppc-sysv-tdep.c
===================================================================
--- gdb-head.orig/gdb/ppc-sysv-tdep.c
+++ gdb-head/gdb/ppc-sysv-tdep.c
@@ -120,7 +120,8 @@ ppc_sysv_abi_push_dummy_call (struct gdb
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
- convert_typed_floating (val, type, regval, regtype);
+ convert_typed_floating (val, type,
+ regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + freg,
regval);
@@ -405,7 +406,7 @@ ppc_sysv_abi_push_dummy_call (struct gdb
else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, tdep->wordsize,
- unpack_long (type, val));
+ unpack_long (type, gdbarch, val));
else
/* Always goes in the low address. */
memcpy (word, val, len);
@@ -569,7 +570,7 @@ do_ppc_sysv_return_value (struct gdbarch
struct type *regtype = register_type (gdbarch,
tdep->ppc_fp0_regnum + 1);
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, type);
+ convert_typed_floating (regval, regtype, readbuf, type, gdbarch);
}
if (writebuf)
{
@@ -577,7 +578,7 @@ do_ppc_sysv_return_value (struct gdbarch
the register's "double" type. */
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
- convert_typed_floating (writebuf, type, regval, regtype);
+ convert_typed_floating (writebuf, type, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
return RETURN_VALUE_REGISTER_CONVENTION;
@@ -682,7 +683,8 @@ do_ppc_sysv_return_value (struct gdbarch
/* Some sort of integer stored in r3. Use unpack_long since
that should handle any required sign extension. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (type, writebuf));
+ unpack_long (type, gdbarch,
+ writebuf));
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -1028,7 +1030,8 @@ ppc64_sysv_abi_push_dummy_call (struct g
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum);

- convert_typed_floating (val, type, regval, regtype);
+ convert_typed_floating (val, type,
+ regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + freg,
regval);
@@ -1172,7 +1175,7 @@ ppc64_sysv_abi_push_dummy_call (struct g
if (write_pass)
{
/* Sign extend the value, then store it unsigned. */
- ULONGEST word = unpack_long (type, val);
+ ULONGEST word = unpack_long (type, gdbarch, val);
/* Convert any function code addresses into
descriptors. */
if (TYPE_CODE (type) == TYPE_CODE_PTR
@@ -1265,7 +1268,7 @@ ppc64_sysv_abi_push_dummy_call (struct g
= register_type (gdbarch,
tdep->ppc_fp0_regnum);
convert_typed_floating (val, type, regval,
- regtype);
+ regtype, gdbarch);
regcache_cooked_write (regcache,
(tdep->ppc_fp0_regnum
+ freg),
@@ -1369,13 +1372,13 @@ ppc64_sysv_abi_return_value (struct gdba
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL)
{
- convert_typed_floating (writebuf, valtype, regval, regtype);
+ convert_typed_floating (writebuf, valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}
if (readbuf != NULL)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, valtype);
+ convert_typed_floating (regval, regtype, readbuf, valtype, gdbarch);
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
@@ -1393,7 +1396,8 @@ ppc64_sysv_abi_return_value (struct gdba
{
/* Be careful to sign extend the value. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (valtype, writebuf));
+ unpack_long (valtype, gdbarch,
+ writebuf));
}
if (readbuf != NULL)
{
@@ -1482,7 +1486,7 @@ ppc64_sysv_abi_return_value (struct gdba
{
convert_typed_floating ((const bfd_byte *) writebuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype, regval, regtype);
+ valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + i,
regval);
@@ -1495,7 +1499,7 @@ ppc64_sysv_abi_return_value (struct gdba
convert_typed_floating (regval, regtype,
(bfd_byte *) readbuf +
i * (TYPE_LENGTH (valtype) / 2),
- valtype);
+ valtype, gdbarch);
}
}
}
Index: gdb-head/gdb/printcmd.c
===================================================================
--- gdb-head.orig/gdb/printcmd.c
+++ gdb-head/gdb/printcmd.c
@@ -399,7 +399,7 @@ print_scalar_formatted (const void *vala
}

if (options->format != 'f')
- val_long = unpack_long (type, valaddr);
+ val_long = unpack_long (type, gdbarch, valaddr);

/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
@@ -455,7 +455,7 @@ print_scalar_formatted (const void *vala

case 'a':
{
- CORE_ADDR addr = unpack_pointer (type, valaddr);
+ CORE_ADDR addr = unpack_pointer (type, gdbarch, valaddr);
print_address (addr, stream);
}
break;
@@ -2361,7 +2361,8 @@ printf_command (char *arg, int from_tty)
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
type = float_type_from_length (gdbarch, type);
- val = unpack_double (type, value_contents (val_args[i]), &inv);
+ val = unpack_double (type, gdbarch,
+ value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));

@@ -2378,7 +2379,8 @@ printf_command (char *arg, int from_tty)
/* If format string wants a float, unchecked-convert the value
to floating point of the same size. */
type = float_type_from_length (gdbarch, type);
- val = unpack_double (type, value_contents (val_args[i]), &inv);
+ val = unpack_double (type, gdbarch,
+ value_contents (val_args[i]), &inv);
if (inv)
error (_("Invalid floating value found in program."));

Index: gdb-head/gdb/p-valprint.c
===================================================================
--- gdb-head.orig/gdb/p-valprint.c
+++ gdb-head/gdb/p-valprint.c
@@ -149,7 +149,7 @@ pascal_val_print (struct type *type, str
}
elttype = check_typedef (TYPE_TARGET_TYPE (type));
{
- addr = unpack_pointer (type, valaddr + embedded_offset);
+ addr = unpack_pointer (type, gdbarch, valaddr + embedded_offset);
print_unpacked_pointer:
elttype = check_typedef (TYPE_TARGET_TYPE (type));

@@ -201,7 +201,8 @@ pascal_val_print (struct type *type, str
else if (pascal_object_is_vtbl_member (type))
{
/* print vtbl's nicely */
- CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
+ CORE_ADDR vt_address
+ = unpack_pointer (type, gdbarch, valaddr + embedded_offset);

struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
@@ -255,7 +256,7 @@ pascal_val_print (struct type *type, str
if (options->addressprint)
{
CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
+ = extract_typed_address (valaddr + embedded_offset, type, gdbarch);
fprintf_filtered (stream, "@");
fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
@@ -269,7 +270,7 @@ pascal_val_print (struct type *type, str
struct value *deref_val =
value_at
(TYPE_TARGET_TYPE (type), gdbarch,
- unpack_pointer (type, valaddr + embedded_offset));
+ unpack_pointer (type, gdbarch, valaddr + embedded_offset));
common_val_print (deref_val, stream, recurse + 1, options,
current_language);
}
@@ -323,7 +324,7 @@ pascal_val_print (struct type *type, str
break;
}
len = TYPE_NFIELDS (type);
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
for (i = 0; i < len; i++)
{
QUIT;
@@ -378,7 +379,7 @@ pascal_val_print (struct type *type, str
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (val == 0)
fputs_filtered ("false", stream);
else if (val == 1)
@@ -428,7 +429,7 @@ pascal_val_print (struct type *type, str
}
else
{
- val = unpack_long (type, valaddr + embedded_offset);
+ val = unpack_long (type, gdbarch, valaddr + embedded_offset);
if (TYPE_UNSIGNED (type))
fprintf_filtered (stream, "%u", (unsigned int) val);
else
Index: gdb-head/gdb/rs6000-aix-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-aix-tdep.c
+++ gdb-head/gdb/rs6000-aix-tdep.c
@@ -475,11 +475,11 @@ rs6000_return_value (struct gdbarch *gdb
if (readbuf)
{
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
- convert_typed_floating (regval, regtype, readbuf, valtype);
+ convert_typed_floating (regval, regtype, readbuf, valtype, gdbarch);
}
if (writebuf)
{
- convert_typed_floating (writebuf, valtype, regval, regtype);
+ convert_typed_floating (writebuf, valtype, regval, regtype, gdbarch);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
}

@@ -507,7 +507,8 @@ rs6000_return_value (struct gdbarch *gdb
/* For writing, use unpack_long since that should handle any
required sign extension. */
regcache_cooked_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
- unpack_long (valtype, writebuf));
+ unpack_long (valtype, gdbarch,
+ writebuf));
}

return RETURN_VALUE_REGISTER_CONVENTION;
Index: gdb-head/gdb/rs6000-tdep.c
===================================================================
--- gdb-head.orig/gdb/rs6000-tdep.c
+++ gdb-head/gdb/rs6000-tdep.c
@@ -2482,7 +2482,7 @@ rs6000_register_to_value (struct frame_i

get_frame_register (frame, regnum, from);
convert_typed_floating (from, builtin_type (gdbarch)->builtin_double,
- to, type);
+ to, type, gdbarch);
}

static void
@@ -2497,7 +2497,7 @@ rs6000_value_to_register (struct frame_i
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);

convert_typed_floating (from, type,
- to, builtin_type (gdbarch)->builtin_double);
+ to, builtin_type (gdbarch)->builtin_double, gdbarch);
put_frame_register (frame, regnum, to);
}

Index: gdb-head/gdb/scm-lang.c
===================================================================
--- gdb-head.orig/gdb/scm-lang.c
+++ gdb-head/gdb/scm-lang.c
@@ -81,7 +81,8 @@ scm_get_field (LONGEST svalue, int index
or Boolean (CONTEXT == TYPE_CODE_BOOL). */

LONGEST
-scm_unpack (struct type *type, const gdb_byte *valaddr, enum type_code context)
+scm_unpack (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, enum type_code context)
{
if (is_scmvalue_type (type))
{
@@ -120,7 +121,7 @@ scm_unpack (struct type *type, const gdb
}
}
else
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}

/* True if we're correctly in Guile's eval.c (the evaluator and apply). */
Index: gdb-head/gdb/scm-lang.h
===================================================================
--- gdb-head.orig/gdb/scm-lang.h
+++ gdb-head/gdb/scm-lang.h
@@ -62,7 +62,8 @@ extern struct value *scm_evaluate_string

extern int scm_parse (void);

-extern LONGEST scm_unpack (struct type *, const gdb_byte *, enum type_code);
+extern LONGEST scm_unpack (struct type *, struct gdbarch *,
+ const gdb_byte *, enum type_code);

/* Scheme types */

Index: gdb-head/gdb/sh64-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh64-tdep.c
+++ gdb-head/gdb/sh64-tdep.c
@@ -1221,7 +1221,7 @@ sh64_extract_return_value (struct type *
else
floatformat_to_doublest (&floatformat_ieee_double_big,
buf, &val);
- store_typed_floating (valbuf, type, val);
+ store_typed_floating (valbuf, type, gdbarch, val);
}
}
else
@@ -1555,7 +1555,7 @@ sh64_register_convert_to_virtual (struct
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
from, &val);
- store_typed_floating (to, type, val);
+ store_typed_floating (to, type, gdbarch, val);
}
else
error ("sh64_register_convert_to_virtual called with non DR register number");
@@ -1577,7 +1577,7 @@ sh64_register_convert_to_raw (struct gdb
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
{
- DOUBLEST val = extract_typed_floating (from, type);
+ DOUBLEST val = extract_typed_floating (from, type, gdbarch);
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
&val, to);
}
@@ -1990,7 +1990,8 @@ sh64_do_fp_register (struct gdbarch *gdb
regnum, gdbarch_register_name (gdbarch, regnum));

/* Get the register as a number */
- flt = unpack_double (builtin_type (gdbarch)->builtin_float, raw_buffer, &inv);
+ flt = unpack_double (builtin_type (gdbarch)->builtin_float, gdbarch,
+ raw_buffer, &inv);

/* Print the name and some spaces. */
fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
Index: gdb-head/gdb/sh-tdep.c
===================================================================
--- gdb-head.orig/gdb/sh-tdep.c
+++ gdb-head/gdb/sh-tdep.c
@@ -2240,15 +2240,15 @@ sh_register_reggroup_p (struct gdbarch *
because they are stored as 4 individual FP elements. */

static void
-sh_register_convert_to_virtual (int regnum, struct type *type,
- char *from, char *to)
+sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
+ struct type *type, char *from, char *to)
{
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
{
DOUBLEST val;
floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
from, &val);
- store_typed_floating (to, type, val);
+ store_typed_floating (to, type, gdbarch, val);
}
else
error
@@ -2256,12 +2256,12 @@ sh_register_convert_to_virtual (int regn
}

static void
-sh_register_convert_to_raw (struct type *type, int regnum,
- const void *from, void *to)
+sh_register_convert_to_raw (struct gdbarch *gdbarch, struct type *type,
+ int regnum, const void *from, void *to)
{
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
{
- DOUBLEST val = extract_typed_floating (from, type);
+ DOUBLEST val = extract_typed_floating (from, type, gdbarch);
floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
&val, to);
}
@@ -2313,7 +2313,7 @@ sh_pseudo_register_read (struct gdbarch
+ register_size (gdbarch,
base_regnum) * portion));
/* We must pay attention to the endiannes. */
- sh_register_convert_to_virtual (reg_nr,
+ sh_register_convert_to_virtual (gdbarch, reg_nr,
register_type (gdbarch, reg_nr),
temp_buffer, buffer);
}
@@ -2354,7 +2354,7 @@ sh_pseudo_register_write (struct gdbarch
base_regnum = dr_reg_base_num (gdbarch, reg_nr);

/* We must pay attention to the endiannes. */
- sh_register_convert_to_raw (register_type (gdbarch, reg_nr),
+ sh_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
reg_nr, buffer, temp_buffer);

/* Write the real regs for which this one is an alias. */
Index: gdb-head/gdb/solib-svr4.c
===================================================================
--- gdb-head.orig/gdb/solib-svr4.c
+++ gdb-head/gdb/solib-svr4.c
@@ -147,7 +147,7 @@ LM_ADDR_FROM_LINK_MAP (struct so_list *s
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

static int
@@ -165,7 +165,7 @@ LM_DYNAMIC_FROM_LINK_MAP (struct so_list
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return extract_typed_address (so->lm_info->lm + lmo->l_ld_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

static CORE_ADDR
@@ -245,7 +245,7 @@ LM_NEXT (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return extract_typed_address (so->lm_info->lm + lmo->l_next_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

static CORE_ADDR
@@ -255,7 +255,7 @@ LM_NAME (struct so_list *so)
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return extract_typed_address (so->lm_info->lm + lmo->l_name_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

static int
@@ -270,7 +270,7 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_l
return 0;

return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
- ptr_type) == 0;
+ ptr_type, target_gdbarch) == 0;
}

/* Per-inferior SVR4 specific data. */
@@ -652,7 +652,8 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
- dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
+ dyn_ptr = extract_typed_address (ptr_buf,
+ ptr_type, target_gdbarch);
*ptr = dyn_ptr;
}
return 1;
@@ -760,7 +761,7 @@ elf_locate_base (void)
of the dynamic link structure. */
if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
return 0;
- return extract_typed_address (pbuf, ptr_type);
+ return extract_typed_address (pbuf, ptr_type, target_gdbarch);
}

/* Find DT_DEBUG. */
@@ -847,7 +848,7 @@ solib_svr4_r_map (struct svr4_info *info
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return read_memory_typed_address (info->debug_base + lmo->r_map_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

/* Find r_brk from the inferior's debug base. */
@@ -859,7 +860,7 @@ solib_svr4_r_brk (struct svr4_info *info
struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;

return read_memory_typed_address (info->debug_base + lmo->r_brk_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

/* Find the link map for the dynamic linker (if it is not in the
@@ -881,7 +882,7 @@ solib_svr4_r_ldsomap (struct svr4_info *
return 0;

return read_memory_typed_address (info->debug_base + lmo->r_ldsomap_offset,
- ptr_type);
+ ptr_type, target_gdbarch);
}

/*
@@ -938,7 +939,7 @@ open_symbol_file_object (void *from_ttyp
read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size);

/* Convert the address to host format. */
- l_name = extract_typed_address (l_name_buf, ptr_type);
+ l_name = extract_typed_address (l_name_buf, ptr_type, target_gdbarch);

/* Free l_name_buf. */
do_cleanups (cleanups);
Index: gdb-head/gdb/spu-tdep.c
===================================================================
--- gdb-head.orig/gdb/spu-tdep.c
+++ gdb-head/gdb/spu-tdep.c
@@ -345,7 +345,7 @@ static CORE_ADDR
spu_integer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf)
{
- ULONGEST addr = unpack_long (type, buf);
+ ULONGEST addr = unpack_long (type, gdbarch, buf);
ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size. */

if (target_has_registers && target_has_stack && target_has_memory)
Index: gdb-head/gdb/stabsread.c
===================================================================
--- gdb-head.orig/gdb/stabsread.c
+++ gdb-head/gdb/stabsread.c
@@ -776,7 +776,7 @@ define_symbol (CORE_ADDR valu, char *str
dbl_valu =
obstack_alloc (&objfile->objfile_obstack,
TYPE_LENGTH (dbl_type));
- store_typed_floating (dbl_valu, dbl_type, d);
+ store_typed_floating (dbl_valu, dbl_type, gdbarch, d);

SYMBOL_TYPE (sym) = dbl_type;
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
Index: gdb-head/gdb/valarith.c
===================================================================
--- gdb-head.orig/gdb/valarith.c
+++ gdb-head/gdb/valarith.c
@@ -664,7 +664,7 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
char_type = type2;
- inchar = (char) unpack_long (type2,
+ inchar = (char) unpack_long (type2, value_arch (inval2),
value_contents (inval2));
for (idx = 0; idx < count; idx++)
{
@@ -708,7 +708,8 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
char_type = type1;
- *ptr = (char) unpack_long (type1, value_contents (inval1));
+ *ptr = (char) unpack_long (type1, value_arch (inval1),
+ value_contents (inval1));
}
else
{
@@ -718,7 +719,8 @@ value_concat (struct value *arg1, struct
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
*(ptr + inval1len) =
- (char) unpack_long (type2, value_contents (inval2));
+ (char) unpack_long (type2, value_arch (inval2),
+ value_contents (inval2));
}
else
{
@@ -988,7 +990,8 @@ value_binop (struct value *arg1, struct
result_type = type1, result_arch = value_arch (arg1);

val = allocate_value (result_type, result_arch);
- store_typed_floating (value_contents_raw (val), value_type (val), v);
+ store_typed_floating (value_contents_raw (val),
+ value_type (val), value_arch (val), v);
}
else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
|| TYPE_CODE (type2) == TYPE_CODE_BOOL)
Index: gdb-head/gdb/valprint.c
===================================================================
--- gdb-head.orig/gdb/valprint.c
+++ gdb-head/gdb/valprint.c
@@ -427,7 +427,7 @@ val_print_type_code_int (struct type *ty
else
{
print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0,
- unpack_long (type, valaddr));
+ unpack_long (type, gdbarch, valaddr));
}
}

@@ -435,7 +435,7 @@ void
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);
+ ULONGEST val = unpack_long (type, gdbarch, valaddr);
int bitpos, nfields = TYPE_NFIELDS (type);

fputs_filtered ("[ ", stream);
@@ -541,7 +541,7 @@ print_floating (const gdb_byte *valaddr,

/* If it is a floating-point, check for obvious problems. */
if (TYPE_CODE (type) == TYPE_CODE_FLT)
- fmt = floatformat_from_type (type);
+ fmt = floatformat_from_type (type, gdbarch);
if (fmt != NULL)
{
kind = floatformat_classify (fmt, valaddr);
@@ -573,7 +573,7 @@ print_floating (const gdb_byte *valaddr,
host with 80 bit DOUBLEST but with loss of information on a host
with 64 bit DOUBLEST. */

- doub = unpack_double (type, valaddr, &inv);
+ doub = unpack_double (type, gdbarch, valaddr, &inv);
if (inv)
{
fprintf_filtered (stream, "<invalid float value>");
Index: gdb-head/gdb/value.c
===================================================================
--- gdb-head.orig/gdb/value.c
+++ gdb-head/gdb/value.c
@@ -1414,7 +1414,8 @@ value_as_long (struct value *val)
in disassemble_command). It also dereferences references, which
I suspect is the most logical thing to do. */
val = coerce_array (val);
- return unpack_long (value_type (val), value_contents (val));
+ return unpack_long (value_type (val), value_arch (val),
+ value_contents (val));
}

DOUBLEST
@@ -1423,7 +1424,8 @@ value_as_double (struct value *val)
DOUBLEST foo;
int inv;

- foo = unpack_double (value_type (val), value_contents (val), &inv);
+ foo = unpack_double (value_type (val), value_arch (val),
+ value_contents (val), &inv);
if (inv)
error (_("Invalid floating value found in program."));
return foo;
@@ -1530,7 +1532,8 @@ value_as_address (struct value *val)
return gdbarch_integer_to_address (value_arch (val), value_type (val),
value_contents (val));

- return unpack_long (value_type (val), value_contents (val));
+ return unpack_long (value_type (val), value_arch (val),
+ value_contents (val));
#endif
}
\f
@@ -1549,7 +1552,8 @@ value_as_address (struct value *val)
to an INT (or some size). After all, it is only an offset. */

LONGEST
-unpack_long (struct type *type, const gdb_byte *valaddr)
+unpack_long (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr)
{
enum type_code code = TYPE_CODE (type);
int len = TYPE_LENGTH (type);
@@ -1558,7 +1562,7 @@ unpack_long (struct type *type, const gd
switch (code)
{
case TYPE_CODE_TYPEDEF:
- return unpack_long (check_typedef (type), valaddr);
+ return unpack_long (check_typedef (type), gdbarch, valaddr);
case TYPE_CODE_ENUM:
case TYPE_CODE_FLAGS:
case TYPE_CODE_BOOL:
@@ -1572,7 +1576,7 @@ unpack_long (struct type *type, const gd
return extract_signed_integer (valaddr, len);

case TYPE_CODE_FLT:
- return extract_typed_floating (valaddr, type);
+ return extract_typed_floating (valaddr, type, gdbarch);

case TYPE_CODE_DECFLOAT:
/* libdecnumber has a function to convert from decimal to integer, but
@@ -1583,7 +1587,7 @@ unpack_long (struct type *type, const gd
case TYPE_CODE_REF:
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
- return extract_typed_address (valaddr, type);
+ return extract_typed_address (valaddr, type, gdbarch);

default:
error (_("Value can't be converted to integer."));
@@ -1598,7 +1602,8 @@ unpack_long (struct type *type, const gd
format, result is in host format. */

DOUBLEST
-unpack_double (struct type *type, const gdb_byte *valaddr, int *invp)
+unpack_double (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, int *invp)
{
enum type_code code;
int len;
@@ -1628,25 +1633,26 @@ unpack_double (struct type *type, const
Hopefully someone will add both the missing floatformat
definitions and the new cases for floatformat_is_valid (). */

- if (!floatformat_is_valid (floatformat_from_type (type), valaddr))
+ if (!floatformat_is_valid (floatformat_from_type (type, gdbarch),
+ valaddr))
{
*invp = 1;
return 0.0;
}

- return extract_typed_floating (valaddr, type);
+ return extract_typed_floating (valaddr, type, gdbarch);
}
else if (code == TYPE_CODE_DECFLOAT)
return decimal_to_doublest (valaddr, len);
else if (nosign)
{
/* Unsigned -- be sure we compensate for signed LONGEST. */
- return (ULONGEST) unpack_long (type, valaddr);
+ return (ULONGEST) unpack_long (type, gdbarch, valaddr);
}
else
{
/* Signed -- we are OK with unpack_long. */
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}
}

@@ -1664,11 +1670,12 @@ unpack_double (struct type *type, const
to an INT (or some size). After all, it is only an offset. */

CORE_ADDR
-unpack_pointer (struct type *type, const gdb_byte *valaddr)
+unpack_pointer (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr)
{
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
- return unpack_long (type, valaddr);
+ return unpack_long (type, gdbarch, valaddr);
}

\f
@@ -1985,7 +1992,8 @@ modify_field (struct gdbarch *gdbarch, g
/* Pack NUM into BUF using a target format of TYPE. */

void
-pack_long (gdb_byte *buf, struct type *type, LONGEST num)
+pack_long (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, LONGEST num)
{
int len;

@@ -2006,7 +2014,7 @@ pack_long (gdb_byte *buf, struct type *t

case TYPE_CODE_REF:
case TYPE_CODE_PTR:
- store_typed_address (buf, type, (CORE_ADDR) num);
+ store_typed_address (buf, type, gdbarch, (CORE_ADDR) num);
break;

default:
@@ -2023,7 +2031,7 @@ value_from_longest (struct type *type, s
{
struct value *val = allocate_value (type, gdbarch);

- pack_long (value_contents_raw (val), type, num);
+ pack_long (value_contents_raw (val), type, gdbarch, num);

return val;
}
@@ -2035,7 +2043,7 @@ struct value *
value_from_pointer (struct type *type, struct gdbarch *gdbarch, CORE_ADDR addr)
{
struct value *val = allocate_value (type, gdbarch);
- store_typed_address (value_contents_raw (val), type, addr);
+ store_typed_address (value_contents_raw (val), type, gdbarch, addr);
return val;
}

@@ -2069,9 +2077,7 @@ value_from_double (struct type *type, st
int len = TYPE_LENGTH (base_type);

if (code == TYPE_CODE_FLT)
- {
- store_typed_floating (value_contents_raw (val), base_type, num);
- }
+ store_typed_floating (value_contents_raw (val), base_type, gdbarch, num);
else
error (_("Unexpected type encountered for floating constant."));

@@ -2096,7 +2102,8 @@ coerce_ref (struct value *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),
+ unpack_pointer (value_type (arg),
+ value_arch (arg),
value_contents (arg)));
return arg;
}
Index: gdb-head/gdb/value.h
===================================================================
--- gdb-head.orig/gdb/value.h
+++ gdb-head/gdb/value.h
@@ -326,16 +326,19 @@ extern LONGEST value_as_long (struct val
extern DOUBLEST value_as_double (struct value *val);
extern CORE_ADDR value_as_address (struct value *val);

-extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
-extern DOUBLEST unpack_double (struct type *type, const gdb_byte *valaddr,
- int *invp);
-extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
+extern LONGEST unpack_long (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr);
+extern DOUBLEST unpack_double (struct type *type, struct gdbarch *gdbarch,
+ const gdb_byte *valaddr, int *invp);
+extern CORE_ADDR unpack_pointer (struct type *type, struct gdbarch *gdbarch,
+ 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 void pack_long (gdb_byte *buf, struct type *type,
+ struct gdbarch *gdbarch, LONGEST num);

extern struct value *value_from_longest (struct type *type,
struct gdbarch *gdbarch, LONGEST num);
Index: gdb-head/gdb/xtensa-tdep.c
===================================================================
--- gdb-head.orig/gdb/xtensa-tdep.c
+++ gdb-head/gdb/xtensa-tdep.c
@@ -1022,7 +1022,8 @@ xtensa_unwind_pc (struct gdbarch *gdbarc
host_address_to_string (next_frame));

frame_unwind_register (next_frame, gdbarch_pc_regnum (gdbarch), buf);
- pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
+ pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr,
+ gdbarch);

DEBUGINFO ("[xtensa_unwind_pc] pc = 0x%08x\n", (unsigned int) pc);

Index: gdb-head/gdb/c-lang.c
===================================================================
--- gdb-head.orig/gdb/c-lang.c
+++ gdb-head/gdb/c-lang.c
@@ -241,7 +241,7 @@ c_emit_char (int c, struct type *type, s
classify_type (type, &encoding);

buf = alloca (TYPE_LENGTH (type));
- pack_long (buf, type, c);
+ store_signed_integer (buf, TYPE_LENGTH (type), c);

iter = make_wchar_iterator (buf, TYPE_LENGTH (type), encoding,
TYPE_LENGTH (type));
@@ -727,13 +727,13 @@ convert_ucn (char *p, char *limit, const
OUTPUT. TYPE is the target character type. */

static void
-emit_numeric_character (struct type *type, unsigned long value,
- struct obstack *output)
+emit_numeric_character (struct type *type, struct gdbarch *gdbarch,
+ unsigned long value, struct obstack *output)
{
gdb_byte *buffer;

buffer = alloca (TYPE_LENGTH (type));
- pack_long (buffer, type, value);
+ pack_long (buffer, type, gdbarch, value);
obstack_grow (output, buffer, TYPE_LENGTH (type));
}

@@ -743,7 +743,8 @@ emit_numeric_character (struct type *typ
pointer to just after the final digit of the escape sequence. */

static char *
-convert_octal (struct type *type, char *p, char *limit, struct obstack *output)
+convert_octal (struct type *type, struct gdbarch *gdbarch,
+ char *p, char *limit, struct obstack *output)
{
unsigned long value = 0;

@@ -753,7 +754,7 @@ convert_octal (struct type *type, char *
++p;
}

- emit_numeric_character (type, value, output);
+ emit_numeric_character (type, gdbarch, value, output);

return p;
}
@@ -764,7 +765,8 @@ convert_octal (struct type *type, char *
just after the final digit of the escape sequence. */

static char *
-convert_hex (struct type *type, char *p, char *limit, struct obstack *output)
+convert_hex (struct type *type, struct gdbarch *gdbarch,
+ char *p, char *limit, struct obstack *output)
{
unsigned long value = 0;

@@ -774,7 +776,7 @@ convert_hex (struct type *type, char *p,
++p;
}

- emit_numeric_character (type, value, output);
+ emit_numeric_character (type, gdbarch, value, output);

return p;
}
@@ -794,8 +796,9 @@ convert_hex (struct type *type, char *p,
character of the escape sequence. */

static char *
-convert_escape (struct type *type, const char *dest_charset,
- char *p, char *limit, struct obstack *output)
+convert_escape (struct type *type, struct gdbarch *gdbarch,
+ const char *dest_charset, char *p, char *limit,
+ struct obstack *output)
{
/* Skip the backslash. */
ADVANCE;
@@ -811,7 +814,7 @@ convert_escape (struct type *type, const
ADVANCE;
if (!isxdigit (*p))
error (_("\\x used with no following hex digits."));
- p = convert_hex (type, p, limit, output);
+ p = convert_hex (type, gdbarch, p, limit, output);
break;

case '0':
@@ -822,7 +825,7 @@ convert_escape (struct type *type, const
case '5':
case '6':
case '7':
- p = convert_octal (type, p, limit, output);
+ p = convert_octal (type, gdbarch, p, limit, output);
break;

case 'u':
@@ -847,7 +850,8 @@ convert_escape (struct type *type, const

static void
parse_one_string (struct obstack *output, char *data, int len,
- const char *dest_charset, struct type *type)
+ const char *dest_charset, struct type *type,
+ struct gdbarch *gdbarch)
{
char *limit;

@@ -865,7 +869,7 @@ parse_one_string (struct obstack *output
data, p - data, 1, output, translit_none);
/* If we saw an escape, convert it. */
if (p < limit)
- p = convert_escape (type, dest_charset, p, limit, output);
+ p = convert_escape (type, gdbarch, dest_charset, p, limit, output);
data = p;
}
}
@@ -939,7 +943,7 @@ evaluate_subexp_c (struct type *expect_t
++*pos;
if (noside != EVAL_SKIP)
parse_one_string (&output, &exp->elts[*pos].string, len,
- dest_charset, type);
+ dest_charset, type, exp->gdbarch);
*pos += BYTES_TO_EXP_ELEM (len);
}

@@ -963,7 +967,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));
+ value = unpack_long (type, exp->gdbarch, obstack_base (&output));
result = value_from_longest (type, exp->gdbarch, value);
}
else
Index: gdb-head/gdb/solib-darwin.c
===================================================================
--- gdb-head.orig/gdb/solib-darwin.c
+++ gdb-head/gdb/solib-darwin.c
@@ -102,9 +102,10 @@ darwin_load_image_infos (void)
return;

dyld_all_image.count = extract_unsigned_integer (buf + 4, 4);
- dyld_all_image.info = extract_typed_address (buf + 8, ptr_type);
+ dyld_all_image.info = extract_typed_address
+ (buf + 8, ptr_type, target_gdbarch);
dyld_all_image.notifier = extract_typed_address
- (buf + 8 + ptr_type->length, ptr_type);
+ (buf + 8 + ptr_type->length, ptr_type, target_gdbarch);
}

/* Link map info to include in an allocated so_list entry. */
@@ -233,8 +234,9 @@ darwin_current_sos (void)
if (target_read_memory (info, buf, image_info_size))
break;

- load_addr = extract_typed_address (buf, ptr_type);
- path_addr = extract_typed_address (buf + ptr_len, ptr_type);
+ load_addr = extract_typed_address (buf, ptr_type, target_gdbarch);
+ path_addr = extract_typed_address (buf + ptr_len,
+ ptr_type, target_gdbarch);

target_read_string (path_addr, &file_path,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
Index: gdb-head/gdb/doc/gdbint.texinfo
===================================================================
--- gdb-head.orig/gdb/doc/gdbint.texinfo
+++ gdb-head/gdb/doc/gdbint.texinfo
@@ -3254,34 +3254,34 @@ clean up some architecture-independent c

Here are functions which convert between pointers and addresses:

-@deftypefun CORE_ADDR extract_typed_address (void *@var{buf}, struct type *@var{type})
+@deftypefun CORE_ADDR extract_typed_address (void *@var{buf}, struct type *@var{type}, struct gdbarch *@var{gdbarch})
Treat the bytes at @var{buf} as a pointer or reference of type
@var{type}, and return the address it represents, in a manner
-appropriate for the current architecture. This yields an address
+appropriate for architecture @var{gdbarch}. This yields an address
@value{GDBN} can use to read target memory, disassemble, etc. Note that
@var{buf} refers to a buffer in @value{GDBN}'s memory, not the
inferior's.

-For example, if the current architecture is the Intel x86, this function
-extracts a little-endian integer of the appropriate length from
-@var{buf} and returns it. However, if the current architecture is the
-D10V, this function will return a 16-bit integer extracted from
+For example, if @var{gdbarch} is the Intel x86 architecture, this
+function extracts a little-endian integer of the appropriate length from
+@var{buf} and returns it. However, if @var{gdbarch} is the D10V
+architecture, this function will return a 16-bit integer extracted from
@var{buf}, multiplied by four if @var{type} is a pointer to a function.

If @var{type} is not a pointer or reference type, then this function
will signal an internal error.
@end deftypefun

-@deftypefun CORE_ADDR store_typed_address (void *@var{buf}, struct type *@var{type}, CORE_ADDR @var{addr})
+@deftypefun CORE_ADDR store_typed_address (void *@var{buf}, struct type *@var{type}, struct gdbarch *@var{gdbarch}, CORE_ADDR @var{addr})
Store the address @var{addr} in @var{buf}, in the proper format for a
-pointer of type @var{type} in the current architecture. Note that
+pointer of type @var{type} in architecture @var{gdbarch}. Note that
@var{buf} refers to a buffer in @value{GDBN}'s memory, not the
inferior's.

-For example, if the current architecture is the Intel x86, this function
-stores @var{addr} unmodified as a little-endian integer of the
-appropriate length in @var{buf}. However, if the current architecture
-is the D10V, this function divides @var{addr} by four if @var{type} is
+For example, if @var{gdbarch} is the Intel x86 architecture, this
+function stores @var{addr} unmodified as a little-endian integer of the
+appropriate length in @var{buf}. However, if @var{gdbarch} is the D10V
+architecture, this function divides @var{addr} by four if @var{type} is
a pointer to a function, and then stores it in @var{buf}.

If @var{type} is not a pointer or reference type, then this function
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com