2005-02-06 Andrew Cagney <cagney@gnu.org>

* value.c (value_contents, value_contents_writeable): New
	functions.
	* value.h (VALUE_CONTENTS): Delete macro.
	(value_contents, value_contents_writeable): Declare.
	* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
	* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
	* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
	* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
	* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
	* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
	* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
	* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
	* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
	* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
	* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
	* ada-valprint.c, ada-lang.c: Update.
This commit is contained in:
Andrew Cagney 2005-02-07 00:09:56 +00:00
parent 1b3a857543
commit 0fd88904d9
43 changed files with 273 additions and 229 deletions

View file

@ -1,3 +1,22 @@
2005-02-06 Andrew Cagney <cagney@gnu.org>
* value.c (value_contents, value_contents_writeable): New
functions.
* value.h (VALUE_CONTENTS): Delete macro.
(value_contents, value_contents_writeable): Declare.
* xstormy16-tdep.c, value.c, valops.c, valarith.c: Update.
* stack.c, sparc-tdep.c, sparc64-tdep.c, sh-tdep.c: Update.
* sh64-tdep.c, scm-valprint.c, scm-exp.c, s390-tdep.c: Update.
* rs6000-tdep.c, p-valprint.c, printcmd.c: Update.
* ppc-sysv-tdep.c, mips-tdep.c, mi/mi-main.c: Update.
* m88k-tdep.c, m68hc11-tdep.c, m32r-tdep.c: Update.
* jv-valprint.c, ia64-tdep.c, hppa-tdep.c: Update.
* hpacc-abi.c, f-valprint.c, frv-tdep.c, eval.c: Update.
* c-valprint.c, cris-tdep.c, cp-valprint.c: Update.
* cli/cli-dump.c, breakpoint.c, avr-tdep.c, arm-tdep.c: Update.
* arm-linux-tdep.c, amd64-tdep.c, alpha-tdep.c: Update.
* ada-valprint.c, ada-lang.c: Update.
2005-02-03 Andrew Cagney <cagney@gnu.org> 2005-02-03 Andrew Cagney <cagney@gnu.org>
* utils.c (xzalloc): New function. * utils.c (xzalloc): New function.

View file

@ -455,7 +455,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
VALUE_LAZY (result) = 1; VALUE_LAZY (result) = 1;
else else
memcpy (value_contents_raw (result), VALUE_CONTENTS (val), memcpy (value_contents_raw (result), value_contents (val),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
return result; return result;
} }
@ -1821,7 +1821,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
else else
{ {
v = allocate_value (type); v = allocate_value (type);
bytes = (unsigned char *) VALUE_CONTENTS (obj) + offset; bytes = (unsigned char *) value_contents (obj) + offset;
} }
if (obj != NULL) if (obj != NULL)
@ -1840,7 +1840,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
} }
else else
v->bitsize = bit_size; v->bitsize = bit_size;
unpacked = (unsigned char *) VALUE_CONTENTS (v); unpacked = (unsigned char *) value_contents (v);
srcBitsLeft = bit_size; srcBitsLeft = bit_size;
nsrc = len; nsrc = len;
@ -1935,7 +1935,8 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
TARGET, starting at bit offset TARG_OFFSET. SOURCE and TARGET must TARGET, starting at bit offset TARG_OFFSET. SOURCE and TARGET must
not overlap. */ not overlap. */
static void static void
move_bits (char *target, int targ_offset, char *source, int src_offset, int n) move_bits (bfd_byte *target, int targ_offset, const bfd_byte *source,
int src_offset, int n)
{ {
unsigned int accum, mask; unsigned int accum, mask;
int accum_bits, chunk_size; int accum_bits, chunk_size;
@ -2028,17 +2029,17 @@ ada_value_assign (struct value *toval, struct value *fromval)
read_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len); read_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len);
if (BITS_BIG_ENDIAN) if (BITS_BIG_ENDIAN)
move_bits (buffer, value_bitpos (toval), move_bits (buffer, value_bitpos (toval),
VALUE_CONTENTS (fromval), value_contents (fromval),
TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT - TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT -
bits, bits); bits, bits);
else else
move_bits (buffer, value_bitpos (toval), VALUE_CONTENTS (fromval), move_bits (buffer, value_bitpos (toval), value_contents (fromval),
0, bits); 0, bits);
write_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, write_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer,
len); len);
val = value_copy (toval); val = value_copy (toval);
memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval), memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
val->type = type; val->type = type;
@ -3543,7 +3544,7 @@ convert_actual (struct value *actual, struct type *formal_type0,
actual_type = ada_check_typedef (value_type (actual)); actual_type = ada_check_typedef (value_type (actual));
val = allocate_value (actual_type); val = allocate_value (actual_type);
memcpy ((char *) value_contents_raw (val), memcpy ((char *) value_contents_raw (val),
(char *) VALUE_CONTENTS (actual), (char *) value_contents (actual),
TYPE_LENGTH (actual_type)); TYPE_LENGTH (actual_type));
actual = ensure_lval (val, sp); actual = ensure_lval (val, sp);
} }
@ -3574,11 +3575,11 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1) for (i = ada_array_arity (ada_check_typedef (value_type (arr))); i > 0; i -= 1)
{ {
modify_general_field (VALUE_CONTENTS (bounds), modify_general_field (value_contents_writeable (bounds),
value_as_long (ada_array_bound (arr, i, 0)), value_as_long (ada_array_bound (arr, i, 0)),
desc_bound_bitpos (bounds_type, i, 0), desc_bound_bitpos (bounds_type, i, 0),
desc_bound_bitsize (bounds_type, i, 0)); desc_bound_bitsize (bounds_type, i, 0));
modify_general_field (VALUE_CONTENTS (bounds), modify_general_field (value_contents_writeable (bounds),
value_as_long (ada_array_bound (arr, i, 1)), value_as_long (ada_array_bound (arr, i, 1)),
desc_bound_bitpos (bounds_type, i, 1), desc_bound_bitpos (bounds_type, i, 1),
desc_bound_bitsize (bounds_type, i, 1)); desc_bound_bitsize (bounds_type, i, 1));
@ -3586,12 +3587,12 @@ make_array_descriptor (struct type *type, struct value *arr, CORE_ADDR *sp)
bounds = ensure_lval (bounds, sp); bounds = ensure_lval (bounds, sp);
modify_general_field (VALUE_CONTENTS (descriptor), modify_general_field (value_contents_writeable (descriptor),
VALUE_ADDRESS (ensure_lval (arr, sp)), VALUE_ADDRESS (ensure_lval (arr, sp)),
fat_pntr_data_bitpos (desc_type), fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type)); fat_pntr_data_bitsize (desc_type));
modify_general_field (VALUE_CONTENTS (descriptor), modify_general_field (value_contents_writeable (descriptor),
VALUE_ADDRESS (bounds), VALUE_ADDRESS (bounds),
fat_pntr_bounds_bitpos (desc_type), fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type)); fat_pntr_bounds_bitsize (desc_type));
@ -5327,7 +5328,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno,
int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno); int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno);
int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno);
return ada_value_primitive_packed_val (arg1, VALUE_CONTENTS (arg1), return ada_value_primitive_packed_val (arg1, value_contents (arg1),
offset + bit_pos / 8, offset + bit_pos / 8,
bit_pos % 8, bit_size, type); bit_pos % 8, bit_size, type);
} }
@ -5535,7 +5536,7 @@ ada_value_struct_elt (struct value *arg, char *name, char *err)
if (TYPE_CODE (t) == TYPE_CODE_PTR) if (TYPE_CODE (t) == TYPE_CODE_PTR)
address = value_as_address (arg); address = value_as_address (arg);
else else
address = unpack_pointer (t, VALUE_CONTENTS (arg)); address = unpack_pointer (t, value_contents (arg));
t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL); t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL);
if (find_struct_field (name, t1, 0, if (find_struct_field (name, t1, 0,
@ -6415,7 +6416,7 @@ to_fixed_variant_branch_type (struct type *var_type0, const bfd_byte *valaddr,
which = which =
ada_which_variant_applies (var_type, ada_which_variant_applies (var_type,
value_type (dval), VALUE_CONTENTS (dval)); value_type (dval), value_contents (dval));
if (which < 0) if (which < 0)
return empty_record (TYPE_OBJFILE (var_type)); return empty_record (TYPE_OBJFILE (var_type));
@ -7124,7 +7125,7 @@ ada_value_equal (struct value *arg1, struct value *arg2)
and do not have user-defined equality. */ and do not have user-defined equality. */
return return
TYPE_LENGTH (value_type (arg1)) == TYPE_LENGTH (value_type (arg2)) TYPE_LENGTH (value_type (arg1)) == TYPE_LENGTH (value_type (arg2))
&& memcmp (VALUE_CONTENTS (arg1), VALUE_CONTENTS (arg2), && memcmp (value_contents (arg1), value_contents (arg2),
TYPE_LENGTH (value_type (arg1))) == 0; TYPE_LENGTH (value_type (arg1))) == 0;
} }
return value_equal (arg1, arg2); return value_equal (arg1, arg2);

View file

@ -189,13 +189,13 @@ val_print_packed_array_elements (struct type *type, const bfd_byte *valaddr,
(i * bitsize) / HOST_CHAR_BIT, (i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT, (i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype); bitsize, elttype);
if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) != 0) if (memcmp (value_contents (v0), value_contents (v1), eltlen) != 0)
break; break;
} }
if (i - i0 > repeat_count_threshold) if (i - i0 > repeat_count_threshold)
{ {
val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format, val_print (elttype, value_contents (v0), 0, 0, stream, format,
0, recurse + 1, pretty); 0, recurse + 1, pretty);
annotate_elt_rep (i - i0); annotate_elt_rep (i - i0);
fprintf_filtered (stream, _(" <repeats %u times>"), i - i0); fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
@ -220,7 +220,7 @@ val_print_packed_array_elements (struct type *type, const bfd_byte *valaddr,
} }
wrap_here (n_spaces (2 + 2 * recurse)); wrap_here (n_spaces (2 + 2 * recurse));
} }
val_print (elttype, VALUE_CONTENTS (v0), 0, 0, stream, format, val_print (elttype, value_contents (v0), 0, 0, stream, format,
0, recurse + 1, pretty); 0, recurse + 1, pretty);
annotate_elt (); annotate_elt ();
} }
@ -609,7 +609,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
retn = 0; retn = 0;
} }
else else
retn = ada_val_print_1 (value_type (val), VALUE_CONTENTS (val), 0, retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
VALUE_ADDRESS (val), stream, format, VALUE_ADDRESS (val), stream, format,
deref_ref, recurse, pretty); deref_ref, recurse, pretty);
value_free_to_mark (mark); value_free_to_mark (mark);
@ -675,7 +675,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
call_function_by_hand (func, 1, call_function_by_hand (func, 1,
&val))); &val)));
fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val)); fprintf_filtered (stream, "%s", value_contents (printable_val));
return 0; return 0;
} }
/* No special printing function. Do as best we can. */ /* No special printing function. Do as best we can. */
@ -692,7 +692,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
struct value *v = value_cast (target_type, struct value *v = value_cast (target_type,
value_from_contents_and_address value_from_contents_and_address
(type, valaddr, 0)); (type, valaddr, 0));
return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0, return ada_val_print_1 (target_type, value_contents (v), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
} }
else else
@ -856,7 +856,7 @@ ada_val_print_1 (struct type *type, const bfd_byte *valaddr0,
(lookup_pointer_type (elttype), (lookup_pointer_type (elttype),
deref_val_int)); deref_val_int));
val_print (value_type (deref_val), val_print (value_type (deref_val),
VALUE_CONTENTS (deref_val), 0, value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, format, VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty); deref_ref, recurse + 1, pretty);
} }
@ -896,7 +896,7 @@ int
ada_value_print (struct value *val0, struct ui_file *stream, int format, ada_value_print (struct value *val0, struct ui_file *stream, int format,
enum val_prettyprint pretty) enum val_prettyprint pretty)
{ {
char *valaddr = VALUE_CONTENTS (val0); const bfd_byte *valaddr = value_contents (val0);
CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0); CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
struct type *type = struct type *type =
ada_to_fixed_type (value_type (val0), valaddr, address, NULL); ada_to_fixed_type (value_type (val0), valaddr, address, NULL);
@ -947,7 +947,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format,
return 0; return 0;
} }
return (val_print (type, VALUE_CONTENTS (val), 0, address, return (val_print (type, value_contents (val), 0, address,
stream, format, 1, 0, pretty)); stream, format, 1, 0, pretty));
} }
@ -1077,7 +1077,7 @@ print_field_values (struct type *type, const bfd_byte *valaddr,
bit_pos % HOST_CHAR_BIT, bit_pos % HOST_CHAR_BIT,
bit_size, bit_size,
TYPE_FIELD_TYPE (type, i)); TYPE_FIELD_TYPE (type, i));
val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0, val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
} }
} }

View file

@ -1,6 +1,7 @@
/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger. /* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -333,7 +334,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp = (sp & -16) - 16; sp = (sp & -16) - 16;
/* Write the real data into the stack. */ /* Write the real data into the stack. */
write_memory (sp, VALUE_CONTENTS (arg), 16); write_memory (sp, value_contents (arg), 16);
/* Construct the indirection. */ /* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type); arg_type = lookup_pointer_type (arg_type);
@ -354,7 +355,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp = (sp & -16) - 16; sp = (sp & -16) - 16;
/* Write the real data into the stack. */ /* Write the real data into the stack. */
write_memory (sp, VALUE_CONTENTS (arg), 32); write_memory (sp, value_contents (arg), 32);
/* Construct the indirection. */ /* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type); arg_type = lookup_pointer_type (arg_type);
@ -368,7 +369,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
m_arg->len = TYPE_LENGTH (arg_type); m_arg->len = TYPE_LENGTH (arg_type);
m_arg->offset = accumulate_size; m_arg->offset = accumulate_size;
accumulate_size = (accumulate_size + m_arg->len + 7) & ~7; accumulate_size = (accumulate_size + m_arg->len + 7) & ~7;
m_arg->contents = VALUE_CONTENTS (arg); m_arg->contents = value_contents_writeable (arg);
} }
/* Determine required argument register loads, loading an argument register /* Determine required argument register loads, loading an argument register

View file

@ -1,7 +1,7 @@
/* Target-dependent code for AMD64. /* Target-dependent code for AMD64.
Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Contributed by Jiri Smid, SuSE Labs. Inc. Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB. This file is part of GDB.
@ -581,7 +581,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
else else
{ {
/* The argument will be passed in registers. */ /* The argument will be passed in registers. */
char *valbuf = VALUE_CONTENTS (args[i]); const bfd_byte *valbuf = value_contents (args[i]);
char buf[8]; char buf[8];
gdb_assert (len <= 16); gdb_assert (len <= 16);
@ -630,7 +630,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < num_stack_args; i++) for (i = 0; i < num_stack_args; i++)
{ {
struct type *type = value_type (stack_args[i]); struct type *type = value_type (stack_args[i]);
char *valbuf = VALUE_CONTENTS (stack_args[i]); const bfd_byte *valbuf = value_contents (stack_args[i]);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
write_memory (sp + element * 8, valbuf, len); write_memory (sp + element * 8, valbuf, len);

View file

@ -1,5 +1,7 @@
/* GNU/Linux on ARM target support. /* GNU/Linux on ARM target support.
Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software
Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -153,7 +155,7 @@ arm_linux_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
target_type = TYPE_TARGET_TYPE (arg_type); target_type = TYPE_TARGET_TYPE (arg_type);
len = TYPE_LENGTH (arg_type); len = TYPE_LENGTH (arg_type);
typecode = TYPE_CODE (arg_type); typecode = TYPE_CODE (arg_type);
val = (char *) VALUE_CONTENTS (args[argnum]); val = (char *) value_contents (args[argnum]);
/* ANSI C code passes float arguments as integers, K&R code /* ANSI C code passes float arguments as integers, K&R code
passes float arguments as doubles. The .stabs record for passes float arguments as doubles. The .stabs record for

View file

@ -1,6 +1,7 @@
/* Common target dependent code for GDB on ARM systems. /* Common target dependent code for GDB on ARM systems.
Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1222,13 +1223,13 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct type *arg_type; struct type *arg_type;
struct type *target_type; struct type *target_type;
enum type_code typecode; enum type_code typecode;
char *val; bfd_byte *val;
arg_type = check_typedef (value_type (args[argnum])); arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type); len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (arg_type); target_type = TYPE_TARGET_TYPE (arg_type);
typecode = TYPE_CODE (arg_type); typecode = TYPE_CODE (arg_type);
val = VALUE_CONTENTS (args[argnum]); val = value_contents_writeable (args[argnum]);
/* If the argument is a pointer to a function, and it is a /* If the argument is a pointer to a function, and it is a
Thumb function, create a LOCAL copy of the value and set Thumb function, create a LOCAL copy of the value and set

View file

@ -1,6 +1,7 @@
/* Target-dependent code for Atmel AVR, for GDB. /* Target-dependent code for Atmel AVR, for GDB.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc. Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1081,10 +1082,8 @@ struct stack_item
void *data; void *data;
}; };
static struct stack_item *push_stack_item (struct stack_item *prev,
void *contents, int len);
static struct stack_item * static struct stack_item *
push_stack_item (struct stack_item *prev, void *contents, int len) push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
{ {
struct stack_item *si; struct stack_item *si;
si = xmalloc (sizeof (struct stack_item)); si = xmalloc (sizeof (struct stack_item));
@ -1173,7 +1172,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int j; int j;
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (value_type (arg));
char *contents = VALUE_CONTENTS (arg); const bfd_byte *contents = value_contents (arg);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
/* Calculate the potential last register needed. */ /* Calculate the potential last register needed. */

View file

@ -931,7 +931,7 @@ insert_bp_location (struct bp_location *bpt,
laziness to determine what memory GDB actually needed laziness to determine what memory GDB actually needed
in order to compute the value of the expression. */ in order to compute the value of the expression. */
v = evaluate_expression (bpt->owner->exp); v = evaluate_expression (bpt->owner->exp);
VALUE_CONTENTS (v); value_contents (v);
value_release_to_mark (mark); value_release_to_mark (mark);
bpt->owner->val_chain = v; bpt->owner->val_chain = v;

View file

@ -233,7 +233,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
wtype = TYPE_TARGET_TYPE (type); wtype = TYPE_TARGET_TYPE (type);
} }
vt_val = value_at (wtype, vt_address); vt_val = value_at (wtype, vt_address);
val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0, val_print (value_type (vt_val), value_contents (vt_val), 0,
VALUE_ADDRESS (vt_val), stream, format, VALUE_ADDRESS (vt_val), stream, format,
deref_ref, recurse + 1, pretty); deref_ref, recurse + 1, pretty);
if (pretty) if (pretty)
@ -284,7 +284,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
unpack_pointer (lookup_pointer_type (builtin_type_void), unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset)); valaddr + embedded_offset));
val_print (value_type (deref_val), val_print (value_type (deref_val),
VALUE_CONTENTS (deref_val), value_contents (deref_val),
0, 0,
VALUE_ADDRESS (deref_val), VALUE_ADDRESS (deref_val),
stream, stream,
@ -446,7 +446,7 @@ c_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
case TYPE_CODE_METHOD: case TYPE_CODE_METHOD:
{ {
struct value *v = value_at (type, address); struct value *v = value_at (type, address);
cp_print_class_method (VALUE_CONTENTS (value_addr (v)), cp_print_class_method (value_contents (value_addr (v)),
lookup_pointer_type (type), stream); lookup_pointer_type (type), stream);
break; break;
} }

View file

@ -300,7 +300,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
/* Have everything. Open/write the data. */ /* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0) if (file_format == NULL || strcmp (file_format, "binary") == 0)
{ {
dump_binary_file (filename, mode, VALUE_CONTENTS (val), dump_binary_file (filename, mode, value_contents (val),
TYPE_LENGTH (value_type (val))); TYPE_LENGTH (value_type (val)));
} }
else else
@ -318,7 +318,7 @@ dump_value_to_file (char *cmd, char *mode, char *file_format)
} }
dump_bfd_file (filename, mode, file_format, vaddr, dump_bfd_file (filename, mode, file_format, vaddr,
VALUE_CONTENTS (val), value_contents (val),
TYPE_LENGTH (value_type (val))); TYPE_LENGTH (value_type (val)));
} }

View file

@ -358,7 +358,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
(TYPE_FIELD_TYPE (type, i), (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr + offset, i)); unpack_field_as_long (type, valaddr + offset, i));
val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), val_print (TYPE_FIELD_TYPE (type, i), value_contents (v),
0, 0, stream, format, 0, recurse + 1, pretty); 0, 0, stream, format, 0, recurse + 1, pretty);
} }
} }
@ -423,7 +423,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long), v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long),
*(unsigned long *) (valaddr + offset)); *(unsigned long *) (valaddr + offset));
val_print (value_type (v), VALUE_CONTENTS (v), 0, 0, val_print (value_type (v), value_contents (v), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
fields_seen = 1; fields_seen = 1;
@ -789,7 +789,7 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
vf->type = value_type (v); /* make it a pointer */ vf->type = value_type (v); /* make it a pointer */
/* print out the entry */ /* print out the entry */
val_print (value_type (vf), VALUE_CONTENTS (vf), 0, 0, val_print (value_type (vf), value_contents (vf), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
field_physname field_physname
= TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi); = TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi);

View file

@ -1,6 +1,7 @@
/* Target dependent code for CRIS, for GDB, the GNU debugger. /* Target dependent code for CRIS, for GDB, the GNU debugger.
Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Inc.
Contributed by Axis Communications AB. Contributed by Axis Communications AB.
Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg. Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg.
@ -892,7 +893,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int i; int i;
len = TYPE_LENGTH (value_type (args[argnum])); len = TYPE_LENGTH (value_type (args[argnum]));
val = (char *) VALUE_CONTENTS (args[argnum]); val = (char *) value_contents (args[argnum]);
/* How may registers worth of storage do we need for this argument? */ /* How may registers worth of storage do we need for this argument? */
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0); reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);

View file

@ -209,7 +209,7 @@ evaluate_struct_tuple (struct value *struct_val,
struct value *val = NULL; struct value *val = NULL;
int nlabels = 0; int nlabels = 0;
int bitpos, bitsize; int bitpos, bitsize;
char *addr; bfd_byte *addr;
/* Skip past the labels, and count them. */ /* Skip past the labels, and count them. */
while (get_label (exp, pos) != NULL) while (get_label (exp, pos) != NULL)
@ -315,12 +315,12 @@ evaluate_struct_tuple (struct value *struct_val,
bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno); bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
if (variantno >= 0) if (variantno >= 0)
bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno); bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno);
addr = VALUE_CONTENTS (struct_val) + bitpos / 8; addr = value_contents_writeable (struct_val) + bitpos / 8;
if (bitsize) if (bitsize)
modify_field (addr, value_as_long (val), modify_field (addr, value_as_long (val),
bitpos % 8, bitsize); bitpos % 8, bitsize);
else else
memcpy (addr, VALUE_CONTENTS (val), memcpy (addr, value_contents (val),
TYPE_LENGTH (value_type (val))); TYPE_LENGTH (value_type (val)));
} }
while (--nlabels > 0); while (--nlabels > 0);
@ -362,7 +362,7 @@ init_array_element (struct value *array, struct value *element,
{ {
memcpy (value_contents_raw (array) memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size, + (index - low_bound) * element_size,
VALUE_CONTENTS (element), element_size); value_contents (element), element_size);
} }
} }
else else
@ -371,7 +371,7 @@ init_array_element (struct value *array, struct value *element,
if (index < low_bound || index > high_bound) if (index < low_bound || index > high_bound)
error ("tuple index out of range"); error ("tuple index out of range");
memcpy (value_contents_raw (array) + (index - low_bound) * element_size, memcpy (value_contents_raw (array) + (index - low_bound) * element_size,
VALUE_CONTENTS (element), element_size); value_contents (element), element_size);
} }
return index; return index;
} }
@ -546,7 +546,7 @@ evaluate_subexp_standard (struct type *expect_type,
error ("Too many array elements"); error ("Too many array elements");
memcpy (value_contents_raw (array) memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size, + (index - low_bound) * element_size,
VALUE_CONTENTS (element), value_contents (element),
element_size); element_size);
} }
index++; index++;
@ -1442,7 +1442,7 @@ evaluate_subexp_standard (struct type *expect_type,
if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) && if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) &&
(TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_MEMBER)) (TYPE_CODE (TYPE_TARGET_TYPE (value_type (arg1))) == TYPE_CODE_MEMBER))
{ {
unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (arg2); /* forces evaluation */ unsigned int *ptr = (unsigned int *) value_contents (arg2); /* forces evaluation */
*ptr |= 0x20000000; /* set 29th bit */ *ptr |= 0x20000000; /* set 29th bit */
} }
} }
@ -1939,7 +1939,7 @@ evaluate_subexp_standard (struct type *expect_type,
(TYPE_CODE (value_type (retvalp)) == TYPE_CODE_PTR) && (TYPE_CODE (value_type (retvalp)) == TYPE_CODE_PTR) &&
(TYPE_CODE (TYPE_TARGET_TYPE (value_type (retvalp))) == TYPE_CODE_MEMBER)) (TYPE_CODE (TYPE_TARGET_TYPE (value_type (retvalp))) == TYPE_CODE_MEMBER))
{ {
unsigned int *ptr = (unsigned int *) VALUE_CONTENTS (retvalp); /* forces evaluation */ unsigned int *ptr = (unsigned int *) value_contents (retvalp); /* forces evaluation */
*ptr |= 0x20000000; /* set 29th bit */ *ptr |= 0x20000000; /* set 29th bit */
} }
return retvalp; return retvalp;

View file

@ -441,7 +441,7 @@ f_val_print (struct type *type, const bfd_byte *valaddr, int embedded_offset,
unpack_pointer (lookup_pointer_type (builtin_type_void), unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset)); valaddr + embedded_offset));
val_print (value_type (deref_val), val_print (value_type (deref_val),
VALUE_CONTENTS (deref_val), value_contents (deref_val),
0, 0,
VALUE_ADDRESS (deref_val), VALUE_ADDRESS (deref_val),
stream, stream,

View file

@ -1,5 +1,6 @@
/* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger. /* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger.
Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1180,7 +1181,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
store_unsigned_integer store_unsigned_integer
(valbuf, 4, (valbuf, 4,
find_func_descr (gdbarch, find_func_descr (gdbarch,
extract_unsigned_integer (VALUE_CONTENTS (arg), extract_unsigned_integer (value_contents (arg),
4))); 4)));
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
@ -1188,7 +1189,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
else else
{ {
val = (char *) VALUE_CONTENTS (arg); val = (char *) value_contents (arg);
} }
while (len > 0) while (len > 0)

View file

@ -103,7 +103,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
/* pai: FIXME -- 32x64 possible problem? */ /* pai: FIXME -- 32x64 possible problem? */
/* First word (4 bytes) in object layout is the vtable pointer */ /* First word (4 bytes) in object layout is the vtable pointer */
coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (argp)); /* pai: (temp) */ coreptr = *(CORE_ADDR *) (value_contents (argp)); /* pai: (temp) */
/* + offset + VALUE_EMBEDDED_OFFSET (argp)); */ /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
if (!coreptr) if (!coreptr)
@ -132,7 +132,7 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) + coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) +
HP_ACC_VFUNC_START)); HP_ACC_VFUNC_START));
coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp)); coreptr = *(CORE_ADDR *) (value_contents (vp));
/* coreptr now contains the address of the virtual function */ /* coreptr now contains the address of the virtual function */
/* (Actually, it contains the pointer to the plabel for the function. */ /* (Actually, it contains the pointer to the plabel for the function. */
} }
@ -153,10 +153,10 @@ hpacc_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
/* Indirect once more, offset by function index */ /* Indirect once more, offset by function index */
/* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */ /* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */
coreptr = coreptr =
*(CORE_ADDR *) (VALUE_CONTENTS (vp) + *(CORE_ADDR *) (value_contents (vp) +
4 * TYPE_FN_FIELD_VOFFSET (f, j)); 4 * TYPE_FN_FIELD_VOFFSET (f, j));
vp = value_at (builtin_type_int, coreptr); vp = value_at (builtin_type_int, coreptr);
coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp)); coreptr = *(CORE_ADDR *) (value_contents (vp));
/* coreptr now contains the address of the virtual function */ /* coreptr now contains the address of the virtual function */
/* (Actually, it contains the pointer to the plabel for the function.) */ /* (Actually, it contains the pointer to the plabel for the function.) */
@ -241,7 +241,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET); vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET);
/* Indirect through the typeinfo pointer and retrieve the pointer /* Indirect through the typeinfo pointer and retrieve the pointer
* to the string name */ * to the string name */
coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp)); coreptr = *(CORE_ADDR *) (value_contents (vp));
if (!coreptr) if (!coreptr)
error ("Retrieved null typeinfo pointer in trying to determine " error ("Retrieved null typeinfo pointer in trying to determine "
"run-time type"); "run-time type");
@ -249,7 +249,7 @@ hpacc_value_rtti_type (struct value *v, int *full, int *top, int *using_enc)
vp = value_at (builtin_type_int, coreptr + 4); vp = value_at (builtin_type_int, coreptr + 4);
/* FIXME possible 32x64 problem */ /* FIXME possible 32x64 problem */
coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp)); coreptr = *(CORE_ADDR *) (value_contents (vp));
read_memory_string (coreptr, rtti_type_name, 256); read_memory_string (coreptr, rtti_type_name, 256);

View file

@ -1,7 +1,7 @@
/* Target-dependent code for the HP PA architecture, for GDB. /* Target-dependent code for the HP PA architecture, for GDB.
Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc. Foundation, Inc.
Contributed by the Center for Software Science at the Contributed by the Center for Software Science at the
@ -723,7 +723,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
param_len = 4; param_len = 4;
struct_ptr += align_up (TYPE_LENGTH (type), 8); struct_ptr += align_up (TYPE_LENGTH (type), 8);
if (write_pass) if (write_pass)
write_memory (struct_end - struct_ptr, VALUE_CONTENTS (arg), write_memory (struct_end - struct_ptr, value_contents (arg),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
store_unsigned_integer (param_val, 4, struct_end - struct_ptr); store_unsigned_integer (param_val, 4, struct_end - struct_ptr);
} }
@ -735,13 +735,13 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
param_len = align_up (TYPE_LENGTH (type), 4); param_len = align_up (TYPE_LENGTH (type), 4);
store_unsigned_integer (param_val, param_len, store_unsigned_integer (param_val, param_len,
unpack_long (type, unpack_long (type,
VALUE_CONTENTS (arg))); value_contents (arg)));
} }
else if (TYPE_CODE (type) == TYPE_CODE_FLT) else if (TYPE_CODE (type) == TYPE_CODE_FLT)
{ {
/* Floating point value store, right aligned. */ /* Floating point value store, right aligned. */
param_len = align_up (TYPE_LENGTH (type), 4); param_len = align_up (TYPE_LENGTH (type), 4);
memcpy (param_val, VALUE_CONTENTS (arg), param_len); memcpy (param_val, value_contents (arg), param_len);
} }
else else
{ {
@ -749,7 +749,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Small struct value are stored right-aligned. */ /* Small struct value are stored right-aligned. */
memcpy (param_val + param_len - TYPE_LENGTH (type), memcpy (param_val + param_len - TYPE_LENGTH (type),
VALUE_CONTENTS (arg), TYPE_LENGTH (type)); value_contents (arg), TYPE_LENGTH (type));
/* Structures of size 5, 6 and 7 bytes are special in that /* Structures of size 5, 6 and 7 bytes are special in that
the higher-ordered word is stored in the lower-ordered the higher-ordered word is stored in the lower-ordered
@ -901,7 +901,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[i]; struct value *arg = args[i];
struct type *type = value_type (arg); struct type *type = value_type (arg);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
char *valbuf; const bfd_byte *valbuf;
int regnum; int regnum;
/* "Each parameter begins on a 64-bit (8-byte) boundary." */ /* "Each parameter begins on a 64-bit (8-byte) boundary." */
@ -960,7 +960,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
the right halves of the floating point registers; the right halves of the floating point registers;
the left halves are unused." */ the left halves are unused." */
regcache_cooked_write_part (regcache, regnum, offset % 8, regcache_cooked_write_part (regcache, regnum, offset % 8,
len, VALUE_CONTENTS (arg)); len, value_contents (arg));
} }
} }
} }
@ -978,9 +978,9 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
} }
/* Always store the argument in memory. */ /* Always store the argument in memory. */
write_memory (sp + offset, VALUE_CONTENTS (arg), len); write_memory (sp + offset, value_contents (arg), len);
valbuf = VALUE_CONTENTS (arg); valbuf = value_contents (arg);
regnum = HPPA_ARG0_REGNUM - offset / 8; regnum = HPPA_ARG0_REGNUM - offset / 8;
while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0) while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0)
{ {

View file

@ -1,6 +1,6 @@
/* Target-dependent code for the IA-64 for GDB, the GNU debugger. /* Target-dependent code for the IA-64 for GDB, the GNU debugger.
Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -3089,7 +3089,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
char val_buf[8]; char val_buf[8];
store_unsigned_integer (val_buf, 8, store_unsigned_integer (val_buf, 8,
find_func_descr (extract_unsigned_integer (VALUE_CONTENTS (arg), 8), find_func_descr (extract_unsigned_integer (value_contents (arg), 8),
&funcdescaddr)); &funcdescaddr));
if (slotnum < rseslots) if (slotnum < rseslots)
write_memory (rse_address_add (bsp, slotnum), val_buf, 8); write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
@ -3111,7 +3111,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
char val_buf[8]; char val_buf[8];
memset (val_buf, 0, 8); memset (val_buf, 0, 8);
memcpy (val_buf, VALUE_CONTENTS (arg) + argoffset, (len > 8) ? 8 : len); memcpy (val_buf, value_contents (arg) + argoffset, (len > 8) ? 8 : len);
if (slotnum < rseslots) if (slotnum < rseslots)
write_memory (rse_address_add (bsp, slotnum), val_buf, 8); write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
@ -3132,7 +3132,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
while (len > 0 && floatreg < IA64_FR16_REGNUM) while (len > 0 && floatreg < IA64_FR16_REGNUM)
{ {
char to[MAX_REGISTER_SIZE]; char to[MAX_REGISTER_SIZE];
convert_typed_floating (VALUE_CONTENTS (arg) + argoffset, float_elt_type, convert_typed_floating (value_contents (arg) + argoffset, float_elt_type,
to, builtin_type_ia64_ext); to, builtin_type_ia64_ext);
regcache_cooked_write (regcache, floatreg, (void *)to); regcache_cooked_write (regcache, floatreg, (void *)to);
floatreg++; floatreg++;

View file

@ -54,7 +54,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
/* Get the run-time type, and cast the object into that */ /* Get the run-time type, and cast the object into that */
obj_addr = unpack_pointer (type, VALUE_CONTENTS (val)); obj_addr = unpack_pointer (type, value_contents (val));
if (obj_addr != 0) if (obj_addr != 0)
{ {
@ -172,7 +172,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
{ {
VALUE_LAZY (next_v) = 1; VALUE_LAZY (next_v) = 1;
next_v->offset += TYPE_LENGTH (el_type); next_v->offset += TYPE_LENGTH (el_type);
if (memcmp (VALUE_CONTENTS (v), VALUE_CONTENTS (next_v), if (memcmp (value_contents (v), value_contents (next_v),
TYPE_LENGTH (el_type)) != 0) TYPE_LENGTH (el_type)) != 0)
break; break;
} }
@ -182,7 +182,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
else else
fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1); fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
val_print (value_type (v), VALUE_CONTENTS (v), 0, 0, val_print (value_type (v), value_contents (v), 0, 0,
stream, format, 2, 1, pretty); stream, format, 2, 1, pretty);
things_printed++; things_printed++;
@ -235,7 +235,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
return 0; return 0;
} }
return (val_print (type, VALUE_CONTENTS (val), 0, address, return (val_print (type, value_contents (val), 0, address,
stream, format, 1, 0, pretty)); stream, format, 1, 0, pretty));
} }
@ -384,7 +384,7 @@ java_print_value_fields (struct type *type, const bfd_byte *valaddr,
v = value_from_longest (TYPE_FIELD_TYPE (type, i), v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i)); unpack_field_as_long (type, valaddr, i));
val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0,
0, stream, format, 0, recurse + 1, pretty); 0, stream, format, 0, recurse + 1, pretty);
} }
} }
@ -405,7 +405,7 @@ java_print_value_fields (struct type *type, const bfd_byte *valaddr,
if (TYPE_CODE (t) == TYPE_CODE_STRUCT) if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
v = value_addr (v); v = value_addr (v);
val_print (value_type (v), val_print (value_type (v),
VALUE_CONTENTS (v), 0, VALUE_ADDRESS (v), value_contents (v), 0, VALUE_ADDRESS (v),
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
} }
} }

View file

@ -1,7 +1,7 @@
/* Target-dependent code for Renesas M32R, for GDB. /* Target-dependent code for Renesas M32R, for GDB.
Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
Foundation, Inc. Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -726,11 +726,11 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* value gets right-justified in the register or stack word */ /* value gets right-justified in the register or stack word */
memcpy (valbuf + (register_size (gdbarch, argreg) - len), memcpy (valbuf + (register_size (gdbarch, argreg) - len),
(char *) VALUE_CONTENTS (args[argnum]), len); (char *) value_contents (args[argnum]), len);
val = valbuf; val = valbuf;
} }
else else
val = (char *) VALUE_CONTENTS (args[argnum]); val = (char *) value_contents (args[argnum]);
while (len > 0) while (len > 0)
{ {

View file

@ -1,6 +1,6 @@
/* Target-dependent code for Motorola 68HC11 & 68HC12 /* Target-dependent code for Motorola 68HC11 & 68HC12
Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc. Foundation, Inc.
Contributed by Stephane Carrez, stcarrez@nerim.fr Contributed by Stephane Carrez, stcarrez@nerim.fr
@ -1203,7 +1203,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
ULONGEST v; ULONGEST v;
v = extract_unsigned_integer (VALUE_CONTENTS (args[0]), len); v = extract_unsigned_integer (value_contents (args[0]), len);
first_stack_argnum = 1; first_stack_argnum = 1;
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v); regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
@ -1227,7 +1227,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sp--; sp--;
write_memory (sp, &zero, 1); write_memory (sp, &zero, 1);
} }
val = (char*) VALUE_CONTENTS (args[argnum]); val = (char*) value_contents (args[argnum]);
sp -= len; sp -= len;
write_memory (sp, val, len); write_memory (sp, val, len);
} }

View file

@ -1,6 +1,6 @@
/* Target-dependent code for the Motorola 88000 series. /* Target-dependent code for the Motorola 88000 series.
Copyright 2004 Free Software Foundation, Inc. Copyright 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -306,7 +306,7 @@ m88k_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
char *valbuf = VALUE_CONTENTS (args[i]); const bfd_byte *valbuf = value_contents (args[i]);
struct type *type = value_type (args[i]); struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
int stack_word = num_stack_words; int stack_word = num_stack_words;

View file

@ -1,7 +1,7 @@
/* MI Command Set. /* MI Command Set.
Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Inc. Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company). Contributed by Cygnus Solutions (a Red Hat company).
@ -679,7 +679,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
val = evaluate_expression (expr); val = evaluate_expression (expr);
/* Print the result of the expression evaluation. */ /* Print the result of the expression evaluation. */
val_print (value_type (val), VALUE_CONTENTS (val), val_print (value_type (val), value_contents (val),
VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val), VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
stb->stream, 0, 0, 0, 0); stb->stream, 0, 0, 0, 0);

View file

@ -2455,7 +2455,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
fprintf_unfiltered (gdb_stdlog, " push"); fprintf_unfiltered (gdb_stdlog, " push");
} }
else else
val = (char *) VALUE_CONTENTS (arg); val = (char *) value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an /* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register even-numbered floating point register. Round the FP register
@ -2723,7 +2723,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_n32n64_push_dummy_call: %d len=%d type=%d", "mips_n32n64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = (char *) VALUE_CONTENTS (arg); val = (char *) value_contents (arg);
if (fp_register_arg_p (typecode, arg_type) if (fp_register_arg_p (typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM) && float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
@ -3063,7 +3063,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_o32_push_dummy_call: %d len=%d type=%d", "mips_o32_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = (char *) VALUE_CONTENTS (arg); val = (char *) value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an /* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register even-numbered floating point register. Round the FP register
@ -3517,7 +3517,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
"mips_o64_push_dummy_call: %d len=%d type=%d", "mips_o64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode); argnum + 1, len, (int) typecode);
val = (char *) VALUE_CONTENTS (arg); val = (char *) value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an /* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register even-numbered floating point register. Round the FP register

View file

@ -239,7 +239,7 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
wtype = TYPE_TARGET_TYPE (type); wtype = TYPE_TARGET_TYPE (type);
} }
vt_val = value_at (wtype, vt_address); vt_val = value_at (wtype, vt_address);
val_print (value_type (vt_val), VALUE_CONTENTS (vt_val), 0, val_print (value_type (vt_val), value_contents (vt_val), 0,
VALUE_ADDRESS (vt_val), stream, format, VALUE_ADDRESS (vt_val), stream, format,
deref_ref, recurse + 1, pretty); deref_ref, recurse + 1, pretty);
if (pretty) if (pretty)
@ -292,7 +292,7 @@ pascal_val_print (struct type *type, const bfd_byte *valaddr,
unpack_pointer (lookup_pointer_type (builtin_type_void), unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset)); valaddr + embedded_offset));
val_print (value_type (deref_val), val_print (value_type (deref_val),
VALUE_CONTENTS (deref_val), 0, value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, format, VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty); deref_ref, recurse + 1, pretty);
} }
@ -565,7 +565,7 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
fprintf_filtered (stream, ") "); fprintf_filtered (stream, ") ");
} }
} }
return val_print (type, VALUE_CONTENTS (val), VALUE_EMBEDDED_OFFSET (val), return val_print (type, value_contents (val), VALUE_EMBEDDED_OFFSET (val),
VALUE_ADDRESS (val) + value_offset (val), VALUE_ADDRESS (val) + value_offset (val),
stream, format, 1, 0, pretty); stream, format, 1, 0, pretty);
} }
@ -846,7 +846,7 @@ pascal_object_print_value_fields (struct type *type, const bfd_byte *valaddr,
v = value_from_longest (TYPE_FIELD_TYPE (type, i), v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i)); unpack_field_as_long (type, valaddr, i));
val_print (TYPE_FIELD_TYPE (type, i), VALUE_CONTENTS (v), 0, 0, val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
stream, format, 0, recurse + 1, pretty); stream, format, 0, recurse + 1, pretty);
} }
} }
@ -1041,11 +1041,11 @@ pascal_object_print_static_field (struct type *type, struct value *val,
sizeof (CORE_ADDR)); sizeof (CORE_ADDR));
CHECK_TYPEDEF (type); CHECK_TYPEDEF (type);
pascal_object_print_value_fields (type, VALUE_CONTENTS (val), VALUE_ADDRESS (val), pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
stream, format, recurse, pretty, NULL, 1); stream, format, recurse, pretty, NULL, 1);
return; return;
} }
val_print (type, VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), val_print (type, value_contents (val), 0, VALUE_ADDRESS (val),
stream, format, 0, recurse, pretty); stream, format, 0, recurse, pretty);
} }

View file

@ -1,7 +1,8 @@
/* Target-dependent code for PowerPC systems using the SVR4 ABI /* Target-dependent code for PowerPC systems using the SVR4 ABI
for GDB, the GNU debugger. for GDB, the GNU debugger.
Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation,
Inc.
This file is part of GDB. This file is part of GDB.
@ -99,7 +100,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
char *val = VALUE_CONTENTS (arg); const bfd_byte *val = value_contents (arg);
if (TYPE_CODE (type) == TYPE_CODE_FLT if (TYPE_CODE (type) == TYPE_CODE_FLT
&& ppc_floating_point_unit_p (current_gdbarch) && len <= 8) && ppc_floating_point_unit_p (current_gdbarch) && len <= 8)
@ -635,7 +636,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
struct value *arg = args[argno]; struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg)); struct type *type = check_typedef (value_type (arg));
char *val = VALUE_CONTENTS (arg); const bfd_byte *val = value_contents (arg);
if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8) if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) <= 8)
{ {
/* Floats and Doubles go in f1 .. f13. They also /* Floats and Doubles go in f1 .. f13. They also

View file

@ -1,8 +1,8 @@
/* Print values for GNU debugger GDB. /* Print values for GNU debugger GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -321,7 +321,7 @@ print_formatted (struct value *val, int format, int size,
/* User specified format, so don't look to the /* User specified format, so don't look to the
* the type to tell us what to do. * the type to tell us what to do.
*/ */
print_scalar_formatted (VALUE_CONTENTS (val), type, print_scalar_formatted (value_contents (val), type,
format, size, stream); format, size, stream);
} }
} }

View file

@ -1,7 +1,7 @@
/* Target-dependent code for GDB, the GNU debugger. /* Target-dependent code for GDB, the GNU debugger.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1497,7 +1497,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write (regcache, regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + f_argno, tdep->ppc_fp0_regnum + 1 + f_argno,
VALUE_CONTENTS (arg)); value_contents (arg));
++f_argno; ++f_argno;
} }
@ -1510,7 +1510,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
char word[MAX_REGISTER_SIZE]; char word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size); memset (word, 0, reg_size);
memcpy (word, memcpy (word,
((char *) VALUE_CONTENTS (arg)) + argbytes, ((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size (len - argbytes) > reg_size
? reg_size : len - argbytes); ? reg_size : len - argbytes);
regcache_cooked_write (regcache, regcache_cooked_write (regcache,
@ -1531,7 +1531,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
char word[MAX_REGISTER_SIZE]; char word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size); memset (word, 0, reg_size);
memcpy (word, VALUE_CONTENTS (arg), len); memcpy (word, value_contents (arg), len);
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word); regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3 +ii, word);
} }
++argno; ++argno;
@ -1589,7 +1589,7 @@ ran_out_of_registers_for_arguments:
if (argbytes) if (argbytes)
{ {
write_memory (sp + 24 + (ii * 4), write_memory (sp + 24 + (ii * 4),
((char *) VALUE_CONTENTS (arg)) + argbytes, ((char *) value_contents (arg)) + argbytes,
len - argbytes); len - argbytes);
++argno; ++argno;
ii += ((len - argbytes + 3) & -4) / 4; ii += ((len - argbytes + 3) & -4) / 4;
@ -1613,12 +1613,12 @@ ran_out_of_registers_for_arguments:
regcache_cooked_write (regcache, regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + f_argno, tdep->ppc_fp0_regnum + 1 + f_argno,
VALUE_CONTENTS (arg)); value_contents (arg));
++f_argno; ++f_argno;
} }
write_memory (sp + 24 + (ii * 4), write_memory (sp + 24 + (ii * 4),
(char *) VALUE_CONTENTS (arg), (char *) value_contents (arg),
len); len);
ii += ((len + 3) & -4) / 4; ii += ((len + 3) & -4) / 4;
} }

View file

@ -1,6 +1,7 @@
/* Target-dependent code for GDB, the GNU debugger. /* Target-dependent code for GDB, the GNU debugger.
Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
Inc.
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation. for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@ -2434,10 +2435,10 @@ extend_simple_arg (struct value *arg)
register / memory word. It's not really right to extract them as register / memory word. It's not really right to extract them as
an integer, but it does take care of the extension. */ an integer, but it does take care of the extension. */
if (TYPE_UNSIGNED (type)) if (TYPE_UNSIGNED (type))
return extract_unsigned_integer (VALUE_CONTENTS (arg), return extract_unsigned_integer (value_contents (arg),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
else else
return extract_signed_integer (VALUE_CONTENTS (arg), return extract_signed_integer (value_contents (arg),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
} }
@ -2518,7 +2519,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
sp -= length; sp -= length;
sp = align_down (sp, alignment_of (type)); sp = align_down (sp, alignment_of (type));
write_memory (sp, VALUE_CONTENTS (arg), length); write_memory (sp, value_contents (arg), length);
copy_addr[i] = sp; copy_addr[i] = sp;
} }
} }
@ -2578,7 +2579,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* When we store a single-precision value in an FP register, /* When we store a single-precision value in an FP register,
it occupies the leftmost bits. */ it occupies the leftmost bits. */
regcache_cooked_write_part (regcache, S390_F0_REGNUM + fr, regcache_cooked_write_part (regcache, S390_F0_REGNUM + fr,
0, length, VALUE_CONTENTS (arg)); 0, length, value_contents (arg));
fr += 2; fr += 2;
} }
else else
@ -2586,7 +2587,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* When we store a single-precision value in a stack slot, /* When we store a single-precision value in a stack slot,
it occupies the rightmost bits. */ it occupies the rightmost bits. */
starg = align_up (starg + length, word_size); starg = align_up (starg + length, word_size);
write_memory (starg - length, VALUE_CONTENTS (arg), length); write_memory (starg - length, value_contents (arg), length);
} }
} }
else if (s390_function_arg_integer (type) && length <= word_size) else if (s390_function_arg_integer (type) && length <= word_size)
@ -2611,9 +2612,9 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (gr <= 5) if (gr <= 5)
{ {
regcache_cooked_write (regcache, S390_R0_REGNUM + gr, regcache_cooked_write (regcache, S390_R0_REGNUM + gr,
VALUE_CONTENTS (arg)); value_contents (arg));
regcache_cooked_write (regcache, S390_R0_REGNUM + gr + 1, regcache_cooked_write (regcache, S390_R0_REGNUM + gr + 1,
VALUE_CONTENTS (arg) + word_size); value_contents (arg) + word_size);
gr += 2; gr += 2;
} }
else else
@ -2622,7 +2623,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
in it, then don't go back and use it again later. */ in it, then don't go back and use it again later. */
gr = 7; gr = 7;
write_memory (starg, VALUE_CONTENTS (arg), length); write_memory (starg, value_contents (arg), length);
starg += length; starg += length;
} }
} }

View file

@ -1,6 +1,7 @@
/* Scheme/Guile language support routines for GDB, the GNU debugger. /* Scheme/Guile language support routines for GDB, the GNU debugger.
Copyright 1995, 1996, 2000, 2003 Free Software Foundation, Inc. Copyright 1995, 1996, 2000, 2003, 2005 Free Software Foundation,
Inc.
This file is part of GDB. This file is part of GDB.
@ -312,7 +313,7 @@ tryagain:
struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr); struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr);
if (!is_scmvalue_type (value_type (val))) if (!is_scmvalue_type (value_type (val)))
error ("quoted scm form yields non-SCM value"); error ("quoted scm form yields non-SCM value");
svalue = extract_signed_integer (VALUE_CONTENTS (val), svalue = extract_signed_integer (value_contents (val),
TYPE_LENGTH (value_type (val))); TYPE_LENGTH (value_type (val)));
goto handle_immediate; goto handle_immediate;
} }

View file

@ -391,6 +391,6 @@ int
scm_value_print (struct value *val, struct ui_file *stream, int format, scm_value_print (struct value *val, struct ui_file *stream, int format,
enum val_prettyprint pretty) enum val_prettyprint pretty)
{ {
return (val_print (value_type (val), VALUE_CONTENTS (val), 0, return (val_print (value_type (val), value_contents (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty)); VALUE_ADDRESS (val), stream, format, 1, 0, pretty));
} }

View file

@ -1,6 +1,7 @@
/* Target-dependent code for Renesas Super-H, for GDB. /* Target-dependent code for Renesas Super-H, for GDB.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004 Free Software Foundation, Inc. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -876,12 +877,12 @@ sh_justify_value_in_reg (struct value *val, int len)
{ {
/* value gets right-justified in the register or stack word */ /* value gets right-justified in the register or stack word */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
memcpy (valbuf + (4 - len), (char *) VALUE_CONTENTS (val), len); memcpy (valbuf + (4 - len), (char *) value_contents (val), len);
else else
memcpy (valbuf, (char *) VALUE_CONTENTS (val), len); memcpy (valbuf, (char *) value_contents (val), len);
return valbuf; return valbuf;
} }
return (char *) VALUE_CONTENTS (val); return (char *) value_contents (val);
} }
/* Helper function to eval number of bytes to allocate on stack. */ /* Helper function to eval number of bytes to allocate on stack. */

View file

@ -1,7 +1,7 @@
/* Target-dependent code for Renesas Super-H, for GDB. /* Target-dependent code for Renesas Super-H, for GDB.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004 Free Software Foundation, Inc. 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1520,14 +1520,14 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
/* value gets right-justified in the register or stack word */ /* value gets right-justified in the register or stack word */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
memcpy (valbuf + argreg_size - len, memcpy (valbuf + argreg_size - len,
(char *) VALUE_CONTENTS (args[argnum]), len); (char *) value_contents (args[argnum]), len);
else else
memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); memcpy (valbuf, (char *) value_contents (args[argnum]), len);
val = valbuf; val = valbuf;
} }
else else
val = (char *) VALUE_CONTENTS (args[argnum]); val = (char *) value_contents (args[argnum]);
while (len > 0) while (len > 0)
{ {
@ -1557,7 +1557,7 @@ sh64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
} }
else else
{ {
val = (char *) VALUE_CONTENTS (args[argnum]); val = (char *) value_contents (args[argnum]);
if (len == 4) if (len == 4)
{ {
/* Where is it going to be stored? */ /* Where is it going to be stored? */

View file

@ -1,6 +1,6 @@
/* Target-dependent code for SPARC. /* Target-dependent code for SPARC.
Copyright 2003, 2004 Free Software Foundation, Inc. Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -388,7 +388,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
correct, and wasting a few bytes shouldn't be a problem. */ correct, and wasting a few bytes shouldn't be a problem. */
sp &= ~0x7; sp &= ~0x7;
write_memory (sp, VALUE_CONTENTS (args[i]), len); 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), sp);
num_elements++; num_elements++;
} }
@ -423,7 +423,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
char *valbuf = VALUE_CONTENTS (args[i]); const bfd_byte *valbuf = value_contents (args[i]);
struct type *type = value_type (args[i]); struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);

View file

@ -1,6 +1,6 @@
/* Target-dependent code for UltraSPARC. /* Target-dependent code for UltraSPARC.
Copyright 2003, 2004 Free Software Foundation, Inc. Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -784,7 +784,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
a problem. */ a problem. */
sp &= ~0xf; sp &= ~0xf;
write_memory (sp, VALUE_CONTENTS (args[i]), len); 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), sp);
num_elements++; num_elements++;
} }
@ -853,7 +853,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
for (i = 0; i < nargs; i++) for (i = 0; i < nargs; i++)
{ {
char *valbuf = VALUE_CONTENTS (args[i]); char *valbuf = value_contents (args[i]);
struct type *type = value_type (args[i]); struct type *type = value_type (args[i]);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
int regnum = -1; int regnum = -1;

View file

@ -1,8 +1,8 @@
/* Print and select stack frames for GDB, the GNU debugger. /* Print and select stack frames for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -354,7 +354,7 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num,
if (val) if (val)
{ {
val_print (value_type (val), VALUE_CONTENTS (val), 0, val_print (value_type (val), value_contents (val), 0,
VALUE_ADDRESS (val), VALUE_ADDRESS (val),
stb->stream, 0, 0, 2, Val_no_prettyprint); stb->stream, 0, 0, 2, Val_no_prettyprint);
ui_out_field_stream (uiout, "value", stb); ui_out_field_stream (uiout, "value", stb);
@ -1906,7 +1906,7 @@ If you continue, the return value that you specified will be ignored.\n";
== RETURN_VALUE_REGISTER_CONVENTION); == RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, return_type, gdbarch_return_value (current_gdbarch, return_type,
current_regcache, NULL /*read*/, current_regcache, NULL /*read*/,
VALUE_CONTENTS (return_value) /*write*/); value_contents (return_value) /*write*/);
} }
/* If we are at the end of a call dummy now, pop the dummy frame /* If we are at the end of a call dummy now, pop the dummy frame

View file

@ -229,7 +229,7 @@ value_subscript (struct value *array, struct value *idx)
error ("bitstring index out of range"); error ("bitstring index out of range");
index -= lowerbound; index -= lowerbound;
offset = index / TARGET_CHAR_BIT; offset = index / TARGET_CHAR_BIT;
byte = *((char *) VALUE_CONTENTS (array) + offset); byte = *((char *) value_contents (array) + offset);
bit_index = index % TARGET_CHAR_BIT; bit_index = index % TARGET_CHAR_BIT;
byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index); byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index);
v = value_from_longest (LA_BOOL_TYPE, byte & 1); v = value_from_longest (LA_BOOL_TYPE, byte & 1);
@ -271,7 +271,8 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
if (value_lazy (array)) if (value_lazy (array))
VALUE_LAZY (v) = 1; VALUE_LAZY (v) = 1;
else else
memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs, elt_size); memcpy (value_contents_writeable (v),
value_contents (array) + elt_offs, elt_size);
if (VALUE_LVAL (array) == lval_internalvar) if (VALUE_LVAL (array) == lval_internalvar)
VALUE_LVAL (v) = lval_internalvar_component; VALUE_LVAL (v) = lval_internalvar_component;
@ -659,7 +660,7 @@ value_concat (struct value *arg1, struct value *arg2)
if (TYPE_CODE (type2) == TYPE_CODE_CHAR) if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{ {
inchar = (char) unpack_long (type2, inchar = (char) unpack_long (type2,
VALUE_CONTENTS (inval2)); value_contents (inval2));
for (idx = 0; idx < count; idx++) for (idx = 0; idx < count; idx++)
{ {
*(ptr + idx) = inchar; *(ptr + idx) = inchar;
@ -669,7 +670,7 @@ value_concat (struct value *arg1, struct value *arg2)
{ {
for (idx = 0; idx < count; idx++) for (idx = 0; idx < count; idx++)
{ {
memcpy (ptr + (idx * inval2len), VALUE_CONTENTS (inval2), memcpy (ptr + (idx * inval2len), value_contents (inval2),
inval2len); inval2len);
} }
} }
@ -699,20 +700,20 @@ value_concat (struct value *arg1, struct value *arg2)
ptr = (char *) alloca (inval1len + inval2len); ptr = (char *) alloca (inval1len + inval2len);
if (TYPE_CODE (type1) == TYPE_CODE_CHAR) if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{ {
*ptr = (char) unpack_long (type1, VALUE_CONTENTS (inval1)); *ptr = (char) unpack_long (type1, value_contents (inval1));
} }
else else
{ {
memcpy (ptr, VALUE_CONTENTS (inval1), inval1len); memcpy (ptr, value_contents (inval1), inval1len);
} }
if (TYPE_CODE (type2) == TYPE_CODE_CHAR) if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{ {
*(ptr + inval1len) = *(ptr + inval1len) =
(char) unpack_long (type2, VALUE_CONTENTS (inval2)); (char) unpack_long (type2, value_contents (inval2));
} }
else else
{ {
memcpy (ptr + inval1len, VALUE_CONTENTS (inval2), inval2len); memcpy (ptr + inval1len, value_contents (inval2), inval2len);
} }
outval = value_string (ptr, inval1len + inval2len); outval = value_string (ptr, inval1len + inval2len);
} }
@ -1154,7 +1155,7 @@ int
value_logical_not (struct value *arg1) value_logical_not (struct value *arg1)
{ {
int len; int len;
char *p; const bfd_byte *p;
struct type *type1; struct type *type1;
arg1 = coerce_number (arg1); arg1 = coerce_number (arg1);
@ -1164,7 +1165,7 @@ value_logical_not (struct value *arg1)
return 0 == value_as_double (arg1); return 0 == value_as_double (arg1);
len = TYPE_LENGTH (type1); len = TYPE_LENGTH (type1);
p = VALUE_CONTENTS (arg1); p = value_contents (arg1);
while (--len >= 0) while (--len >= 0)
{ {
@ -1183,8 +1184,8 @@ value_strcmp (struct value *arg1, struct value *arg2)
{ {
int len1 = TYPE_LENGTH (value_type (arg1)); int len1 = TYPE_LENGTH (value_type (arg1));
int len2 = TYPE_LENGTH (value_type (arg2)); int len2 = TYPE_LENGTH (value_type (arg2));
char *s1 = VALUE_CONTENTS (arg1); const bfd_byte *s1 = value_contents (arg1);
char *s2 = VALUE_CONTENTS (arg2); const bfd_byte *s2 = value_contents (arg2);
int i, len = len1 < len2 ? len1 : len2; int i, len = len1 < len2 ? len1 : len2;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -1212,7 +1213,8 @@ int
value_equal (struct value *arg1, struct value *arg2) value_equal (struct value *arg1, struct value *arg2)
{ {
int len; int len;
char *p1, *p2; const bfd_byte *p1;
const bfd_byte *p2;
struct type *type1, *type2; struct type *type1, *type2;
enum type_code code1; enum type_code code1;
enum type_code code2; enum type_code code2;
@ -1246,8 +1248,8 @@ value_equal (struct value *arg1, struct value *arg2)
&& ((len = (int) TYPE_LENGTH (type1)) && ((len = (int) TYPE_LENGTH (type1))
== (int) TYPE_LENGTH (type2))) == (int) TYPE_LENGTH (type2)))
{ {
p1 = VALUE_CONTENTS (arg1); p1 = value_contents (arg1);
p2 = VALUE_CONTENTS (arg2); p2 = value_contents (arg2);
while (--len >= 0) while (--len >= 0)
{ {
if (*p1++ != *p2++) if (*p1++ != *p2++)
@ -1363,7 +1365,7 @@ value_complement (struct value *arg1)
} }
/* The INDEX'th bit of SET value whose value_type is TYPE, /* The INDEX'th bit of SET value whose value_type is TYPE,
and whose VALUE_CONTENTS is valaddr. and whose value_contents is valaddr.
Return -1 if out of range, -2 other error. */ Return -1 if out of range, -2 other error. */
int int
@ -1401,7 +1403,7 @@ value_in (struct value *element, struct value *set)
&& TYPE_CODE (eltype) != TYPE_CODE_ENUM && TYPE_CODE (eltype) != TYPE_CODE_ENUM
&& TYPE_CODE (eltype) != TYPE_CODE_BOOL) && TYPE_CODE (eltype) != TYPE_CODE_BOOL)
error ("First argument of 'IN' has wrong type"); error ("First argument of 'IN' has wrong type");
member = value_bit_index (settype, VALUE_CONTENTS (set), member = value_bit_index (settype, value_contents (set),
value_as_long (element)); value_as_long (element));
if (member < 0) if (member < 0)
error ("First argument of 'IN' not in range"); error ("First argument of 'IN' not in range");

View file

@ -306,7 +306,7 @@ value_cast (struct type *type, struct value *arg2)
case TYPE_CODE_MEMBER: case TYPE_CODE_MEMBER:
retvalp = value_from_longest (type, value_as_long (arg2)); retvalp = value_from_longest (type, value_as_long (arg2));
/* force evaluation */ /* force evaluation */
ptr = (unsigned int *) VALUE_CONTENTS (retvalp); ptr = (unsigned int *) value_contents (retvalp);
*ptr &= ~0x20000000; /* zap 29th bit to remove bias */ *ptr &= ~0x20000000; /* zap 29th bit to remove bias */
return retvalp; return retvalp;
@ -326,7 +326,7 @@ value_cast (struct type *type, struct value *arg2)
sees a cast as a simple reinterpretation of the pointer's sees a cast as a simple reinterpretation of the pointer's
bits. */ bits. */
if (code2 == TYPE_CODE_PTR) if (code2 == TYPE_CODE_PTR)
longest = extract_unsigned_integer (VALUE_CONTENTS (arg2), longest = extract_unsigned_integer (value_contents (arg2),
TYPE_LENGTH (type2)); TYPE_LENGTH (type2));
else else
longest = value_as_long (arg2); longest = value_as_long (arg2);
@ -429,8 +429,6 @@ struct value *
value_zero (struct type *type, enum lval_type lv) value_zero (struct type *type, enum lval_type lv)
{ {
struct value *val = allocate_value (type); struct value *val = allocate_value (type);
memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (check_typedef (type)));
VALUE_LVAL (val) = lv; VALUE_LVAL (val) = lv;
return val; return val;
@ -442,7 +440,7 @@ value_zero (struct type *type, enum lval_type lv)
if we can be 'lazy' and defer the fetch, perhaps indefinately, call if we can be 'lazy' and defer the fetch, perhaps indefinately, call
value_at_lazy instead. value_at_lazy simply records the address of value_at_lazy instead. value_at_lazy simply records the address of
the data and sets the lazy-evaluation-required flag. The lazy flag the data and sets the lazy-evaluation-required flag. The lazy flag
is tested in the VALUE_CONTENTS macro, which is used if and when is tested in the value_contents macro, which is used if and when
the contents are actually required. the contents are actually required.
Note: value_at does *NOT* handle embedded offsets; perform such Note: value_at does *NOT* handle embedded offsets; perform such
@ -485,16 +483,16 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
return val; return val;
} }
/* Called only from the VALUE_CONTENTS and value_contents_all() /* Called only from the value_contents and value_contents_all()
macros, if the current data for a variable needs to be loaded into macros, if the current data for a variable needs to be loaded into
VALUE_CONTENTS(VAL). Fetches the data from the user's process, and value_contents(VAL). Fetches the data from the user's process, and
clears the lazy flag to indicate that the data in the buffer is clears the lazy flag to indicate that the data in the buffer is
valid. valid.
If the value is zero-length, we avoid calling read_memory, which would If the value is zero-length, we avoid calling read_memory, which would
abort. We mark the value as fetched anyway -- all 0 bytes of it. abort. We mark the value as fetched anyway -- all 0 bytes of it.
This function returns a value because it is used in the VALUE_CONTENTS This function returns a value because it is used in the value_contents
macro as part of an expression, where a void would not work. The macro as part of an expression, where a void would not work. The
value is ignored. */ value is ignored. */
@ -560,7 +558,7 @@ value_assign (struct value *toval, struct value *fromval)
case lval_memory: case lval_memory:
{ {
char *dest_buffer; const bfd_byte *dest_buffer;
CORE_ADDR changed_addr; CORE_ADDR changed_addr;
int changed_len; int changed_len;
char buffer[sizeof (LONGEST)]; char buffer[sizeof (LONGEST)];
@ -589,7 +587,7 @@ value_assign (struct value *toval, struct value *fromval)
{ {
changed_addr = VALUE_ADDRESS (toval) + value_offset (toval); changed_addr = VALUE_ADDRESS (toval) + value_offset (toval);
changed_len = TYPE_LENGTH (type); changed_len = TYPE_LENGTH (type);
dest_buffer = VALUE_CONTENTS (fromval); dest_buffer = value_contents (fromval);
} }
write_memory (changed_addr, dest_buffer, changed_len); write_memory (changed_addr, dest_buffer, changed_len);
@ -616,7 +614,7 @@ value_assign (struct value *toval, struct value *fromval)
/* If TOVAL is a special machine register requiring /* If TOVAL is a special machine register requiring
conversion of program values to a special raw format. */ conversion of program values to a special raw format. */
VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval), VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval),
type, VALUE_CONTENTS (fromval)); type, value_contents (fromval));
} }
else else
{ {
@ -663,7 +661,7 @@ value_assign (struct value *toval, struct value *fromval)
value_as_long (fromval), value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval)); value_bitpos (toval), value_bitsize (toval));
else else
memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval), memcpy (buffer + byte_offset, value_contents (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
/* Copy it out. */ /* Copy it out. */
@ -730,7 +728,7 @@ value_assign (struct value *toval, struct value *fromval)
} }
val = value_copy (toval); val = value_copy (toval);
memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval), memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
val->type = type; val->type = type;
val = value_change_enclosing_type (val, value_enclosing_type (fromval)); val = value_change_enclosing_type (val, value_enclosing_type (fromval));
@ -1284,7 +1282,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
struct value *v2 = allocate_value (basetype); struct value *v2 = allocate_value (basetype);
boffset = baseclass_offset (type, i, boffset = baseclass_offset (type, i,
VALUE_CONTENTS (arg1) + offset, value_contents (arg1) + offset,
VALUE_ADDRESS (arg1) VALUE_ADDRESS (arg1)
+ value_offset (arg1) + offset); + value_offset (arg1) + offset);
if (boffset == -1) if (boffset == -1)
@ -1514,7 +1512,7 @@ search_struct_method (char *name, struct value **arg1p,
else else
{ {
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
char *base_valaddr; const bfd_byte *base_valaddr;
/* The virtual base class pointer might have been clobbered by the /* The virtual base class pointer might have been clobbered by the
user program. Make sure that it still points to a valid memory user program. Make sure that it still points to a valid memory
@ -1522,15 +1520,15 @@ search_struct_method (char *name, struct value **arg1p,
if (offset < 0 || offset >= TYPE_LENGTH (type)) if (offset < 0 || offset >= TYPE_LENGTH (type))
{ {
base_valaddr = (char *) alloca (TYPE_LENGTH (baseclass)); bfd_byte *tmp = alloca (TYPE_LENGTH (baseclass));
if (target_read_memory (VALUE_ADDRESS (*arg1p) if (target_read_memory (VALUE_ADDRESS (*arg1p)
+ value_offset (*arg1p) + offset, + value_offset (*arg1p) + offset,
base_valaddr, tmp, TYPE_LENGTH (baseclass)) != 0)
TYPE_LENGTH (baseclass)) != 0)
error ("virtual baseclass botch"); error ("virtual baseclass botch");
base_valaddr = tmp;
} }
else else
base_valaddr = VALUE_CONTENTS (*arg1p) + offset; base_valaddr = value_contents (*arg1p) + offset;
base_offset = base_offset =
baseclass_offset (type, i, base_valaddr, baseclass_offset (type, i, base_valaddr,
@ -1751,7 +1749,7 @@ find_method_list (struct value **argp, char *method, int offset,
base_offset = value_offset (*argp) + offset; base_offset = value_offset (*argp) + offset;
base_offset = base_offset =
baseclass_offset (type, i, baseclass_offset (type, i,
VALUE_CONTENTS (*argp) + base_offset, value_contents (*argp) + base_offset,
VALUE_ADDRESS (*argp) + base_offset); VALUE_ADDRESS (*argp) + base_offset);
if (base_offset == -1) if (base_offset == -1)
error ("virtual baseclass botch"); error ("virtual baseclass botch");
@ -2738,7 +2736,7 @@ value_slice (struct value *array, int lowbound, int length)
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
{ {
int element = value_bit_index (array_type, int element = value_bit_index (array_type,
VALUE_CONTENTS (array), value_contents (array),
lowbound + i); lowbound + i);
if (element < 0) if (element < 0)
error ("internal error accessing bitstring"); error ("internal error accessing bitstring");
@ -2766,7 +2764,8 @@ value_slice (struct value *array, int lowbound, int length)
if (value_lazy (array)) if (value_lazy (array))
VALUE_LAZY (slice) = 1; VALUE_LAZY (slice) = 1;
else else
memcpy (VALUE_CONTENTS (slice), VALUE_CONTENTS (array) + offset, memcpy (value_contents_writeable (slice),
value_contents (array) + offset,
TYPE_LENGTH (slice_type)); TYPE_LENGTH (slice_type));
if (VALUE_LVAL (array) == lval_internalvar) if (VALUE_LVAL (array) == lval_internalvar)
VALUE_LVAL (slice) = lval_internalvar_component; VALUE_LVAL (slice) = lval_internalvar_component;
@ -2796,9 +2795,9 @@ value_literal_complex (struct value *arg1, struct value *arg2, struct type *type
arg2 = value_cast (real_type, arg2); arg2 = value_cast (real_type, arg2);
memcpy (value_contents_raw (val), memcpy (value_contents_raw (val),
VALUE_CONTENTS (arg1), TYPE_LENGTH (real_type)); value_contents (arg1), TYPE_LENGTH (real_type));
memcpy (value_contents_raw (val) + TYPE_LENGTH (real_type), memcpy (value_contents_raw (val) + TYPE_LENGTH (real_type),
VALUE_CONTENTS (arg2), TYPE_LENGTH (real_type)); value_contents (arg2), TYPE_LENGTH (real_type));
return val; return val;
} }
@ -2815,9 +2814,9 @@ cast_into_complex (struct type *type, struct value *val)
struct value *im_val = allocate_value (val_real_type); struct value *im_val = allocate_value (val_real_type);
memcpy (value_contents_raw (re_val), memcpy (value_contents_raw (re_val),
VALUE_CONTENTS (val), TYPE_LENGTH (val_real_type)); value_contents (val), TYPE_LENGTH (val_real_type));
memcpy (value_contents_raw (im_val), memcpy (value_contents_raw (im_val),
VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type), value_contents (val) + TYPE_LENGTH (val_real_type),
TYPE_LENGTH (val_real_type)); TYPE_LENGTH (val_real_type));
return value_literal_complex (re_val, im_val, type); return value_literal_complex (re_val, im_val, type);

View file

@ -179,6 +179,20 @@ value_lazy (struct value *value)
return value->lazy; return value->lazy;
} }
const bfd_byte *
value_contents (struct value *value)
{
return value_contents_writeable (value);
}
bfd_byte *
value_contents_writeable (struct value *value)
{
if (value->lazy)
value_fetch_lazy (value);
return value->aligner.contents;
}
/* Return a mark in the value chain. All values allocated after the /* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed mark is obtained (except for those released) are subject to being freed
@ -493,13 +507,13 @@ void
set_internalvar_component (struct internalvar *var, int offset, int bitpos, set_internalvar_component (struct internalvar *var, int offset, int bitpos,
int bitsize, struct value *newval) int bitsize, struct value *newval)
{ {
char *addr = VALUE_CONTENTS (var->value) + offset; bfd_byte *addr = value_contents_writeable (var->value) + offset;
if (bitsize) if (bitsize)
modify_field (addr, value_as_long (newval), modify_field (addr, value_as_long (newval),
bitpos, bitsize); bitpos, bitsize);
else else
memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (value_type (newval))); memcpy (addr, value_contents (newval), TYPE_LENGTH (value_type (newval)));
} }
void void
@ -586,7 +600,7 @@ value_as_long (struct value *val)
in disassemble_command). It also dereferences references, which in disassemble_command). It also dereferences references, which
I suspect is the most logical thing to do. */ I suspect is the most logical thing to do. */
val = coerce_array (val); val = coerce_array (val);
return unpack_long (value_type (val), VALUE_CONTENTS (val)); return unpack_long (value_type (val), value_contents (val));
} }
DOUBLEST DOUBLEST
@ -595,7 +609,7 @@ value_as_double (struct value *val)
DOUBLEST foo; DOUBLEST foo;
int inv; int inv;
foo = unpack_double (value_type (val), VALUE_CONTENTS (val), &inv); foo = unpack_double (value_type (val), value_contents (val), &inv);
if (inv) if (inv)
error ("Invalid floating value found in program."); error ("Invalid floating value found in program.");
return foo; return foo;
@ -699,9 +713,9 @@ value_as_address (struct value *val)
&& TYPE_CODE (value_type (val)) != TYPE_CODE_REF && TYPE_CODE (value_type (val)) != TYPE_CODE_REF
&& gdbarch_integer_to_address_p (current_gdbarch)) && gdbarch_integer_to_address_p (current_gdbarch))
return gdbarch_integer_to_address (current_gdbarch, value_type (val), return gdbarch_integer_to_address (current_gdbarch, value_type (val),
VALUE_CONTENTS (val)); value_contents (val));
return unpack_long (value_type (val), VALUE_CONTENTS (val)); return unpack_long (value_type (val), value_contents (val));
#endif #endif
} }
@ -953,7 +967,7 @@ value_primitive_field (struct value *arg1, int offset,
{ {
v = value_from_longest (type, v = value_from_longest (type,
unpack_field_as_long (arg_type, unpack_field_as_long (arg_type,
VALUE_CONTENTS (arg1) value_contents (arg1)
+ offset, + offset,
fieldno)); fieldno));
v->bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8; v->bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8;
@ -1266,7 +1280,7 @@ coerce_ref (struct value *arg)
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF) if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp), arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
unpack_pointer (value_type (arg), unpack_pointer (value_type (arg),
VALUE_CONTENTS (arg))); value_contents (arg)));
return arg; return arg;
} }

View file

@ -106,7 +106,7 @@ struct value
When we store the entire object, `enclosing_type' is the run-time When we store the entire object, `enclosing_type' is the run-time
type -- the complete object -- and `embedded_offset' is the type -- the complete object -- and `embedded_offset' is the
offset of `type' within that larger type, in bytes. The offset of `type' within that larger type, in bytes. The
VALUE_CONTENTS macro takes `embedded_offset' into account, so value_contents() macro takes `embedded_offset' into account, so
most GDB code continues to see the `type' portion of the value, most GDB code continues to see the `type' portion of the value,
just as the inferior would. just as the inferior would.
@ -182,23 +182,23 @@ extern struct type *value_enclosing_type (struct value *);
extern int value_lazy (struct value *); extern int value_lazy (struct value *);
#define VALUE_LAZY(val) (val)->lazy #define VALUE_LAZY(val) (val)->lazy
/* VALUE_CONTENTS and value_contents_raw() both return the address of /* value_contents() and value_contents_raw() both return the address
the gdb buffer used to hold a copy of the contents of the lval. of the gdb buffer used to hold a copy of the contents of the lval.
VALUE_CONTENTS is used when the contents of the buffer are needed value_contents() is used when the contents of the buffer are needed
-- it uses value_fetch_lazy() to load the buffer from the process -- it uses value_fetch_lazy() to load the buffer from the process
being debugged if it hasn't already been loaded. being debugged if it hasn't already been loaded
value_contents_raw() is used when data is being stored into the (value_contents_writeable() is used when a writeable but fetched
buffer, or when it is certain that the contents of the buffer are buffer is required).. value_contents_raw() is used when data is
valid. being stored into the buffer, or when it is certain that the
contents of the buffer are valid.
Note: The contents pointer is adjusted by the offset required to Note: The contents pointer is adjusted by the offset required to
get to the real subobject, if the value happens to represent get to the real subobject, if the value happens to represent
something embedded in a larger run-time object. */ something embedded in a larger run-time object. */
extern bfd_byte *value_contents_raw (struct value *); extern bfd_byte *value_contents_raw (struct value *);
#define VALUE_CONTENTS(val) \ extern const bfd_byte *value_contents (struct value *);
((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), \ extern bfd_byte *value_contents_writeable (struct value *);
(val)->aligner.contents)
/* The ALL variants of the above two macros do not adjust the returned /* The ALL variants of the above two macros do not adjust the returned
pointer by the embedded_offset value. */ pointer by the embedded_offset value. */

View file

@ -1909,9 +1909,9 @@ c_value_of_root (struct varobj **var_handle)
/* We need to catch errors because if /* We need to catch errors because if
value_fetch_lazy fails we still want to continue value_fetch_lazy fails we still want to continue
(after making val->error = 1) */ (after making val->error = 1) */
/* FIXME: Shouldn't be using VALUE_CONTENTS? The /* FIXME: Shouldn't be using value_contents()? The
comment on value_fetch_lazy() says it is only comment on value_fetch_lazy() says it is only called
called from the macro... */ from the macro... */
if (!gdb_value_fetch_lazy (new_val)) if (!gdb_value_fetch_lazy (new_val))
var->error = 1; var->error = 1;
else else

View file

@ -262,7 +262,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
break; break;
/* Put argument into registers wordwise. */ /* Put argument into registers wordwise. */
val = VALUE_CONTENTS (args[i]); val = value_contents (args[i]);
for (j = 0; j < typelen; j += xstormy16_reg_size) for (j = 0; j < typelen; j += xstormy16_reg_size)
regcache_cooked_write_unsigned (regcache, argreg++, regcache_cooked_write_unsigned (regcache, argreg++,
extract_unsigned_integer (val + j, extract_unsigned_integer (val + j,
@ -281,7 +281,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
typelen = TYPE_LENGTH (value_enclosing_type (args[j])); typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = typelen & 1; slacklen = typelen & 1;
val = alloca (typelen + slacklen); val = alloca (typelen + slacklen);
memcpy (val, VALUE_CONTENTS (args[j]), typelen); memcpy (val, value_contents (args[j]), typelen);
memset (val + typelen, 0, slacklen); memset (val + typelen, 0, slacklen);
/* Now write this data to the stack. The stack grows upwards. */ /* Now write this data to the stack. The stack grows upwards. */