+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>
* utils.c (xzalloc): New function.
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
VALUE_LAZY (result) = 1;
else
- memcpy (value_contents_raw (result), VALUE_CONTENTS (val),
+ memcpy (value_contents_raw (result), value_contents (val),
TYPE_LENGTH (type));
return result;
}
else
{
v = allocate_value (type);
- bytes = (unsigned char *) VALUE_CONTENTS (obj) + offset;
+ bytes = (unsigned char *) value_contents (obj) + offset;
}
if (obj != NULL)
}
else
v->bitsize = bit_size;
- unpacked = (unsigned char *) VALUE_CONTENTS (v);
+ unpacked = (unsigned char *) value_contents (v);
srcBitsLeft = bit_size;
nsrc = len;
TARGET, starting at bit offset TARG_OFFSET. SOURCE and TARGET must
not overlap. */
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;
int accum_bits, chunk_size;
read_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer, len);
if (BITS_BIG_ENDIAN)
move_bits (buffer, value_bitpos (toval),
- VALUE_CONTENTS (fromval),
+ value_contents (fromval),
TYPE_LENGTH (value_type (fromval)) * TARGET_CHAR_BIT -
bits, bits);
else
- move_bits (buffer, value_bitpos (toval), VALUE_CONTENTS (fromval),
+ move_bits (buffer, value_bitpos (toval), value_contents (fromval),
0, bits);
write_memory (VALUE_ADDRESS (toval) + value_offset (toval), buffer,
len);
val = value_copy (toval);
- memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
+ memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type));
val->type = type;
actual_type = ada_check_typedef (value_type (actual));
val = allocate_value (actual_type);
memcpy ((char *) value_contents_raw (val),
- (char *) VALUE_CONTENTS (actual),
+ (char *) value_contents (actual),
TYPE_LENGTH (actual_type));
actual = ensure_lval (val, sp);
}
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)),
desc_bound_bitpos (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)),
desc_bound_bitpos (bounds_type, i, 1),
desc_bound_bitsize (bounds_type, i, 1));
bounds = ensure_lval (bounds, sp);
- modify_general_field (VALUE_CONTENTS (descriptor),
+ modify_general_field (value_contents_writeable (descriptor),
VALUE_ADDRESS (ensure_lval (arr, sp)),
fat_pntr_data_bitpos (desc_type),
fat_pntr_data_bitsize (desc_type));
- modify_general_field (VALUE_CONTENTS (descriptor),
+ modify_general_field (value_contents_writeable (descriptor),
VALUE_ADDRESS (bounds),
fat_pntr_bounds_bitpos (desc_type),
fat_pntr_bounds_bitsize (desc_type));
int bit_pos = TYPE_FIELD_BITPOS (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,
bit_pos % 8, bit_size, type);
}
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_contents (arg));
t1 = ada_to_fixed_type (ada_get_base_type (t1), NULL, address, NULL);
if (find_struct_field (name, t1, 0,
which =
ada_which_variant_applies (var_type,
- value_type (dval), VALUE_CONTENTS (dval));
+ value_type (dval), value_contents (dval));
if (which < 0)
return empty_record (TYPE_OBJFILE (var_type));
and do not have user-defined equality. */
return
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;
}
return value_equal (arg1, arg2);
(i * bitsize) / HOST_CHAR_BIT,
(i * bitsize) % HOST_CHAR_BIT,
bitsize, elttype);
- if (memcmp (VALUE_CONTENTS (v0), VALUE_CONTENTS (v1), eltlen) != 0)
+ if (memcmp (value_contents (v0), value_contents (v1), eltlen) != 0)
break;
}
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);
annotate_elt_rep (i - i0);
fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
}
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);
annotate_elt ();
}
retn = 0;
}
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,
deref_ref, recurse, pretty);
value_free_to_mark (mark);
call_function_by_hand (func, 1,
&val)));
- fprintf_filtered (stream, "%s", VALUE_CONTENTS (printable_val));
+ fprintf_filtered (stream, "%s", value_contents (printable_val));
return 0;
}
/* No special printing function. Do as best we can. */
struct value *v = value_cast (target_type,
value_from_contents_and_address
(type, valaddr, 0));
- return ada_val_print_1 (target_type, VALUE_CONTENTS (v), 0, 0,
+ return ada_val_print_1 (target_type, value_contents (v), 0, 0,
stream, format, 0, recurse + 1, pretty);
}
else
(lookup_pointer_type (elttype),
deref_val_int));
val_print (value_type (deref_val),
- VALUE_CONTENTS (deref_val), 0,
+ value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty);
}
ada_value_print (struct value *val0, struct ui_file *stream, int format,
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);
struct type *type =
ada_to_fixed_type (value_type (val0), valaddr, address, NULL);
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));
}
bit_pos % HOST_CHAR_BIT,
bit_size,
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);
}
}
/* 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.
sp = (sp & -16) - 16;
/* Write the real data into the stack. */
- write_memory (sp, VALUE_CONTENTS (arg), 16);
+ write_memory (sp, value_contents (arg), 16);
/* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type);
sp = (sp & -16) - 16;
/* Write the real data into the stack. */
- write_memory (sp, VALUE_CONTENTS (arg), 32);
+ write_memory (sp, value_contents (arg), 32);
/* Construct the indirection. */
arg_type = lookup_pointer_type (arg_type);
m_arg->len = TYPE_LENGTH (arg_type);
m_arg->offset = accumulate_size;
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
/* Target-dependent code for AMD64.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
- Contributed by Jiri Smid, SuSE Labs.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+ Inc. Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
else
{
/* The argument will be passed in registers. */
- char *valbuf = VALUE_CONTENTS (args[i]);
+ const bfd_byte *valbuf = value_contents (args[i]);
char buf[8];
gdb_assert (len <= 16);
for (i = 0; i < num_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);
write_memory (sp + element * 8, valbuf, len);
/* 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.
target_type = TYPE_TARGET_TYPE (arg_type);
len = TYPE_LENGTH (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
passes float arguments as doubles. The .stabs record for
/* 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.
struct type *arg_type;
struct type *target_type;
enum type_code typecode;
- char *val;
+ bfd_byte *val;
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (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
Thumb function, create a LOCAL copy of the value and set
/* 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.
void *data;
};
-static struct stack_item *push_stack_item (struct stack_item *prev,
- void *contents, int len);
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;
si = xmalloc (sizeof (struct stack_item));
int j;
struct value *arg = args[i];
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);
/* Calculate the potential last register needed. */
laziness to determine what memory GDB actually needed
in order to compute the value of the expression. */
v = evaluate_expression (bpt->owner->exp);
- VALUE_CONTENTS (v);
+ value_contents (v);
value_release_to_mark (mark);
bpt->owner->val_chain = v;
wtype = TYPE_TARGET_TYPE (type);
}
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,
deref_ref, recurse + 1, pretty);
if (pretty)
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
val_print (value_type (deref_val),
- VALUE_CONTENTS (deref_val),
+ value_contents (deref_val),
0,
VALUE_ADDRESS (deref_val),
stream,
case TYPE_CODE_METHOD:
{
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);
break;
}
/* Have everything. Open/write the data. */
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)));
}
else
}
dump_bfd_file (filename, mode, file_format, vaddr,
- VALUE_CONTENTS (val),
+ value_contents (val),
TYPE_LENGTH (value_type (val)));
}
(TYPE_FIELD_TYPE (type, 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);
}
}
v = value_from_pointer (lookup_pointer_type (builtin_type_unsigned_long),
*(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);
fields_seen = 1;
vf->type = value_type (v); /* make it a pointer */
/* 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);
field_physname
= TYPE_FN_FIELD_PHYSNAME (TYPE_FN_FIELDLIST1 (type, fn), oi);
/* 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.
Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg.
int i;
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? */
reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0);
struct value *val = NULL;
int nlabels = 0;
int bitpos, bitsize;
- char *addr;
+ bfd_byte *addr;
/* Skip past the labels, and count them. */
while (get_label (exp, pos) != NULL)
bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
if (variantno >= 0)
bitpos += TYPE_FIELD_BITPOS (substruct_type, subfieldno);
- addr = VALUE_CONTENTS (struct_val) + bitpos / 8;
+ addr = value_contents_writeable (struct_val) + bitpos / 8;
if (bitsize)
modify_field (addr, value_as_long (val),
bitpos % 8, bitsize);
else
- memcpy (addr, VALUE_CONTENTS (val),
+ memcpy (addr, value_contents (val),
TYPE_LENGTH (value_type (val)));
}
while (--nlabels > 0);
{
memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size,
- VALUE_CONTENTS (element), element_size);
+ value_contents (element), element_size);
}
}
else
if (index < low_bound || index > high_bound)
error ("tuple index out of range");
memcpy (value_contents_raw (array) + (index - low_bound) * element_size,
- VALUE_CONTENTS (element), element_size);
+ value_contents (element), element_size);
}
return index;
}
error ("Too many array elements");
memcpy (value_contents_raw (array)
+ (index - low_bound) * element_size,
- VALUE_CONTENTS (element),
+ value_contents (element),
element_size);
}
index++;
if ((TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR) &&
(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 */
}
}
(TYPE_CODE (value_type (retvalp)) == TYPE_CODE_PTR) &&
(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 */
}
return retvalp;
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
val_print (value_type (deref_val),
- VALUE_CONTENTS (deref_val),
+ value_contents (deref_val),
0,
VALUE_ADDRESS (deref_val),
stream,
/* 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.
store_unsigned_integer
(valbuf, 4,
find_func_descr (gdbarch,
- extract_unsigned_integer (VALUE_CONTENTS (arg),
+ extract_unsigned_integer (value_contents (arg),
4)));
typecode = TYPE_CODE_PTR;
len = 4;
}
else
{
- val = (char *) VALUE_CONTENTS (arg);
+ val = (char *) value_contents (arg);
}
while (len > 0)
/* pai: FIXME -- 32x64 possible problem? */
/* 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)); */
if (!coreptr)
coreptr + 4 * (TYPE_FN_FIELD_VOFFSET (f, j) +
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 */
/* (Actually, it contains the pointer to the plabel for the function. */
}
/* Indirect once more, offset by function index */
/* pai: FIXME 32x64 problem here, again multiplier could be 8 and value long */
coreptr =
- *(CORE_ADDR *) (VALUE_CONTENTS (vp) +
+ *(CORE_ADDR *) (value_contents (vp) +
4 * TYPE_FN_FIELD_VOFFSET (f, j));
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 */
/* (Actually, it contains the pointer to the plabel for the function.) */
vp = value_at (builtin_type_int, coreptr + 4 * HP_ACC_TYPEINFO_OFFSET);
/* Indirect through the typeinfo pointer and retrieve the pointer
* to the string name */
- coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+ coreptr = *(CORE_ADDR *) (value_contents (vp));
if (!coreptr)
error ("Retrieved null typeinfo pointer in trying to determine "
"run-time type");
vp = value_at (builtin_type_int, coreptr + 4);
/* FIXME possible 32x64 problem */
- coreptr = *(CORE_ADDR *) (VALUE_CONTENTS (vp));
+ coreptr = *(CORE_ADDR *) (value_contents (vp));
read_memory_string (coreptr, rtti_type_name, 256);
/* Target-dependent code for the HP PA architecture, for GDB.
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.
Contributed by the Center for Software Science at the
param_len = 4;
struct_ptr += align_up (TYPE_LENGTH (type), 8);
if (write_pass)
- write_memory (struct_end - struct_ptr, VALUE_CONTENTS (arg),
+ write_memory (struct_end - struct_ptr, value_contents (arg),
TYPE_LENGTH (type));
store_unsigned_integer (param_val, 4, struct_end - struct_ptr);
}
param_len = align_up (TYPE_LENGTH (type), 4);
store_unsigned_integer (param_val, param_len,
unpack_long (type,
- VALUE_CONTENTS (arg)));
+ value_contents (arg)));
}
else if (TYPE_CODE (type) == TYPE_CODE_FLT)
{
/* Floating point value store, right aligned. */
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
{
/* Small struct value are stored right-aligned. */
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
the higher-ordered word is stored in the lower-ordered
struct value *arg = args[i];
struct type *type = value_type (arg);
int len = TYPE_LENGTH (type);
- char *valbuf;
+ const bfd_byte *valbuf;
int regnum;
/* "Each parameter begins on a 64-bit (8-byte) boundary." */
the right halves of the floating point registers;
the left halves are unused." */
regcache_cooked_write_part (regcache, regnum, offset % 8,
- len, VALUE_CONTENTS (arg));
+ len, value_contents (arg));
}
}
}
}
/* 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;
while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0)
{
/* 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.
This file is part of GDB.
char 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));
if (slotnum < rseslots)
write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
char val_buf[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)
write_memory (rse_address_add (bsp, slotnum), val_buf, 8);
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
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);
regcache_cooked_write (regcache, floatreg, (void *)to);
floatreg++;
/* 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)
{
{
VALUE_LAZY (next_v) = 1;
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)
break;
}
else
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);
things_printed++;
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));
}
v = value_from_longest (TYPE_FIELD_TYPE (type, 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);
}
}
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
v = value_addr (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);
}
}
/* Target-dependent code for Renesas M32R, for GDB.
- Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
- Foundation, Inc.
+ Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free
+ Software Foundation, Inc.
This file is part of GDB.
{
/* value gets right-justified in the register or stack word */
memcpy (valbuf + (register_size (gdbarch, argreg) - len),
- (char *) VALUE_CONTENTS (args[argnum]), len);
+ (char *) value_contents (args[argnum]), len);
val = valbuf;
}
else
- val = (char *) VALUE_CONTENTS (args[argnum]);
+ val = (char *) value_contents (args[argnum]);
while (len > 0)
{
/* 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.
Contributed by Stephane Carrez, stcarrez@nerim.fr
{
ULONGEST v;
- v = extract_unsigned_integer (VALUE_CONTENTS (args[0]), len);
+ v = extract_unsigned_integer (value_contents (args[0]), len);
first_stack_argnum = 1;
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
sp--;
write_memory (sp, &zero, 1);
}
- val = (char*) VALUE_CONTENTS (args[argnum]);
+ val = (char*) value_contents (args[argnum]);
sp -= len;
write_memory (sp, val, len);
}
/* 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.
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]);
int len = TYPE_LENGTH (type);
int stack_word = num_stack_words;
/* MI Command Set.
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
- Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+ Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
val = evaluate_expression (expr);
/* 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),
stb->stream, 0, 0, 0, 0);
fprintf_unfiltered (gdb_stdlog, " push");
}
else
- val = (char *) VALUE_CONTENTS (arg);
+ val = (char *) value_contents (arg);
/* 32-bit ABIs always start floating point arguments in an
even-numbered floating point register. Round the FP register
"mips_n32n64_push_dummy_call: %d len=%d type=%d",
argnum + 1, len, (int) typecode);
- val = (char *) VALUE_CONTENTS (arg);
+ val = (char *) value_contents (arg);
if (fp_register_arg_p (typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM)
"mips_o32_push_dummy_call: %d len=%d type=%d",
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
even-numbered floating point register. Round the FP register
"mips_o64_push_dummy_call: %d len=%d type=%d",
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
even-numbered floating point register. Round the FP register
wtype = TYPE_TARGET_TYPE (type);
}
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,
deref_ref, recurse + 1, pretty);
if (pretty)
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
val_print (value_type (deref_val),
- VALUE_CONTENTS (deref_val), 0,
+ value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, format,
deref_ref, recurse + 1, pretty);
}
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),
stream, format, 1, 0, pretty);
}
v = value_from_longest (TYPE_FIELD_TYPE (type, 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);
}
}
sizeof (CORE_ADDR));
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);
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);
}
/* Target-dependent code for PowerPC systems using the SVR4 ABI
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.
struct value *arg = args[argno];
struct type *type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (type);
- char *val = VALUE_CONTENTS (arg);
+ const bfd_byte *val = value_contents (arg);
if (TYPE_CODE (type) == TYPE_CODE_FLT
&& ppc_floating_point_unit_p (current_gdbarch) && len <= 8)
{
struct value *arg = args[argno];
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)
{
/* Floats and Doubles go in f1 .. f13. They also
/* Print values for GNU debugger GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
- Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
/* User specified format, so don't look to the
* the type to tell us what to do.
*/
- print_scalar_formatted (VALUE_CONTENTS (val), type,
+ print_scalar_formatted (value_contents (val), type,
format, size, stream);
}
}
/* Target-dependent code for GDB, the GNU debugger.
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.
This file is part of GDB.
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + f_argno,
- VALUE_CONTENTS (arg));
+ value_contents (arg));
++f_argno;
}
char word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word,
- ((char *) VALUE_CONTENTS (arg)) + argbytes,
+ ((char *) value_contents (arg)) + argbytes,
(len - argbytes) > reg_size
? reg_size : len - argbytes);
regcache_cooked_write (regcache,
char word[MAX_REGISTER_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);
}
++argno;
if (argbytes)
{
write_memory (sp + 24 + (ii * 4),
- ((char *) VALUE_CONTENTS (arg)) + argbytes,
+ ((char *) value_contents (arg)) + argbytes,
len - argbytes);
++argno;
ii += ((len - argbytes + 3) & -4) / 4;
regcache_cooked_write (regcache,
tdep->ppc_fp0_regnum + 1 + f_argno,
- VALUE_CONTENTS (arg));
+ value_contents (arg));
++f_argno;
}
write_memory (sp + 24 + (ii * 4),
- (char *) VALUE_CONTENTS (arg),
+ (char *) value_contents (arg),
len);
ii += ((len + 3) & -4) / 4;
}
/* 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)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
register / memory word. It's not really right to extract them as
an integer, but it does take care of the extension. */
if (TYPE_UNSIGNED (type))
- return extract_unsigned_integer (VALUE_CONTENTS (arg),
+ return extract_unsigned_integer (value_contents (arg),
TYPE_LENGTH (type));
else
- return extract_signed_integer (VALUE_CONTENTS (arg),
+ return extract_signed_integer (value_contents (arg),
TYPE_LENGTH (type));
}
{
sp -= length;
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;
}
}
/* When we store a single-precision value in an FP register,
it occupies the leftmost bits. */
regcache_cooked_write_part (regcache, S390_F0_REGNUM + fr,
- 0, length, VALUE_CONTENTS (arg));
+ 0, length, value_contents (arg));
fr += 2;
}
else
/* When we store a single-precision value in a stack slot,
it occupies the rightmost bits. */
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)
if (gr <= 5)
{
regcache_cooked_write (regcache, S390_R0_REGNUM + gr,
- VALUE_CONTENTS (arg));
+ value_contents (arg));
regcache_cooked_write (regcache, S390_R0_REGNUM + gr + 1,
- VALUE_CONTENTS (arg) + word_size);
+ value_contents (arg) + word_size);
gr += 2;
}
else
in it, then don't go back and use it again later. */
gr = 7;
- write_memory (starg, VALUE_CONTENTS (arg), length);
+ write_memory (starg, value_contents (arg), length);
starg += length;
}
}
/* 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.
struct value *val = scm_evaluate_string (str.ptr, lexptr - str.ptr);
if (!is_scmvalue_type (value_type (val)))
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)));
goto handle_immediate;
}
scm_value_print (struct value *val, struct ui_file *stream, int format,
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));
}
/* 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.
{
/* value gets right-justified in the register or stack word */
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
- memcpy (valbuf, (char *) VALUE_CONTENTS (val), len);
+ memcpy (valbuf, (char *) value_contents (val), len);
return valbuf;
}
- return (char *) VALUE_CONTENTS (val);
+ return (char *) value_contents (val);
}
/* Helper function to eval number of bytes to allocate on stack. */
/* 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.
+ 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
/* value gets right-justified in the register or stack word */
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
memcpy (valbuf + argreg_size - len,
- (char *) VALUE_CONTENTS (args[argnum]), len);
+ (char *) value_contents (args[argnum]), len);
else
- memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len);
+ memcpy (valbuf, (char *) value_contents (args[argnum]), len);
val = valbuf;
}
else
- val = (char *) VALUE_CONTENTS (args[argnum]);
+ val = (char *) value_contents (args[argnum]);
while (len > 0)
{
}
else
{
- val = (char *) VALUE_CONTENTS (args[argnum]);
+ val = (char *) value_contents (args[argnum]);
if (len == 4)
{
/* Where is it going to be stored? */
/* 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.
correct, and wasting a few bytes shouldn't be a problem. */
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);
num_elements++;
}
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]);
int len = TYPE_LENGTH (type);
/* 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.
a problem. */
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);
num_elements++;
}
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]);
int len = TYPE_LENGTH (type);
int regnum = -1;
/* Print and select stack frames for GDB, the GNU debugger.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
- 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
- Software Foundation, Inc.
+ 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
if (val)
{
- val_print (value_type (val), VALUE_CONTENTS (val), 0,
+ val_print (value_type (val), value_contents (val), 0,
VALUE_ADDRESS (val),
stb->stream, 0, 0, 2, Val_no_prettyprint);
ui_out_field_stream (uiout, "value", stb);
== RETURN_VALUE_REGISTER_CONVENTION);
gdbarch_return_value (current_gdbarch, return_type,
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
error ("bitstring index out of range");
index -= lowerbound;
offset = index / TARGET_CHAR_BIT;
- byte = *((char *) VALUE_CONTENTS (array) + offset);
+ byte = *((char *) value_contents (array) + offset);
bit_index = index % TARGET_CHAR_BIT;
byte >>= (BITS_BIG_ENDIAN ? TARGET_CHAR_BIT - 1 - bit_index : bit_index);
v = value_from_longest (LA_BOOL_TYPE, byte & 1);
if (value_lazy (array))
VALUE_LAZY (v) = 1;
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)
VALUE_LVAL (v) = lval_internalvar_component;
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
inchar = (char) unpack_long (type2,
- VALUE_CONTENTS (inval2));
+ value_contents (inval2));
for (idx = 0; idx < count; idx++)
{
*(ptr + idx) = inchar;
{
for (idx = 0; idx < count; idx++)
{
- memcpy (ptr + (idx * inval2len), VALUE_CONTENTS (inval2),
+ memcpy (ptr + (idx * inval2len), value_contents (inval2),
inval2len);
}
}
ptr = (char *) alloca (inval1len + inval2len);
if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
- *ptr = (char) unpack_long (type1, VALUE_CONTENTS (inval1));
+ *ptr = (char) unpack_long (type1, value_contents (inval1));
}
else
{
- memcpy (ptr, VALUE_CONTENTS (inval1), inval1len);
+ memcpy (ptr, value_contents (inval1), inval1len);
}
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
*(ptr + inval1len) =
- (char) unpack_long (type2, VALUE_CONTENTS (inval2));
+ (char) unpack_long (type2, value_contents (inval2));
}
else
{
- memcpy (ptr + inval1len, VALUE_CONTENTS (inval2), inval2len);
+ memcpy (ptr + inval1len, value_contents (inval2), inval2len);
}
outval = value_string (ptr, inval1len + inval2len);
}
value_logical_not (struct value *arg1)
{
int len;
- char *p;
+ const bfd_byte *p;
struct type *type1;
arg1 = coerce_number (arg1);
return 0 == value_as_double (arg1);
len = TYPE_LENGTH (type1);
- p = VALUE_CONTENTS (arg1);
+ p = value_contents (arg1);
while (--len >= 0)
{
{
int len1 = TYPE_LENGTH (value_type (arg1));
int len2 = TYPE_LENGTH (value_type (arg2));
- char *s1 = VALUE_CONTENTS (arg1);
- char *s2 = VALUE_CONTENTS (arg2);
+ const bfd_byte *s1 = value_contents (arg1);
+ const bfd_byte *s2 = value_contents (arg2);
int i, len = len1 < len2 ? len1 : len2;
for (i = 0; i < len; i++)
value_equal (struct value *arg1, struct value *arg2)
{
int len;
- char *p1, *p2;
+ const bfd_byte *p1;
+ const bfd_byte *p2;
struct type *type1, *type2;
enum type_code code1;
enum type_code code2;
&& ((len = (int) TYPE_LENGTH (type1))
== (int) TYPE_LENGTH (type2)))
{
- p1 = VALUE_CONTENTS (arg1);
- p2 = VALUE_CONTENTS (arg2);
+ p1 = value_contents (arg1);
+ p2 = value_contents (arg2);
while (--len >= 0)
{
if (*p1++ != *p2++)
}
\f
/* 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. */
int
&& TYPE_CODE (eltype) != TYPE_CODE_ENUM
&& TYPE_CODE (eltype) != TYPE_CODE_BOOL)
error ("First argument of 'IN' has wrong type");
- member = value_bit_index (settype, VALUE_CONTENTS (set),
+ member = value_bit_index (settype, value_contents (set),
value_as_long (element));
if (member < 0)
error ("First argument of 'IN' not in range");
case TYPE_CODE_MEMBER:
retvalp = value_from_longest (type, value_as_long (arg2));
/* force evaluation */
- ptr = (unsigned int *) VALUE_CONTENTS (retvalp);
+ ptr = (unsigned int *) value_contents (retvalp);
*ptr &= ~0x20000000; /* zap 29th bit to remove bias */
return retvalp;
sees a cast as a simple reinterpretation of the pointer's
bits. */
if (code2 == TYPE_CODE_PTR)
- longest = extract_unsigned_integer (VALUE_CONTENTS (arg2),
+ longest = extract_unsigned_integer (value_contents (arg2),
TYPE_LENGTH (type2));
else
longest = value_as_long (arg2);
value_zero (struct type *type, enum lval_type lv)
{
struct value *val = allocate_value (type);
-
- memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (check_typedef (type)));
VALUE_LVAL (val) = lv;
return val;
if we can be 'lazy' and defer the fetch, perhaps indefinately, call
value_at_lazy instead. value_at_lazy simply records the address of
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.
Note: value_at does *NOT* handle embedded offsets; perform such
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
- 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
valid.
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.
- 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
value is ignored. */
case lval_memory:
{
- char *dest_buffer;
+ const bfd_byte *dest_buffer;
CORE_ADDR changed_addr;
int changed_len;
char buffer[sizeof (LONGEST)];
{
changed_addr = VALUE_ADDRESS (toval) + value_offset (toval);
changed_len = TYPE_LENGTH (type);
- dest_buffer = VALUE_CONTENTS (fromval);
+ dest_buffer = value_contents (fromval);
}
write_memory (changed_addr, dest_buffer, changed_len);
/* If TOVAL is a special machine register requiring
conversion of program values to a special raw format. */
VALUE_TO_REGISTER (frame, VALUE_REGNUM (toval),
- type, VALUE_CONTENTS (fromval));
+ type, value_contents (fromval));
}
else
{
value_as_long (fromval),
value_bitpos (toval), value_bitsize (toval));
else
- memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
+ memcpy (buffer + byte_offset, value_contents (fromval),
TYPE_LENGTH (type));
/* Copy it out. */
}
val = value_copy (toval);
- memcpy (value_contents_raw (val), VALUE_CONTENTS (fromval),
+ memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type));
val->type = type;
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
struct value *v2 = allocate_value (basetype);
boffset = baseclass_offset (type, i,
- VALUE_CONTENTS (arg1) + offset,
+ value_contents (arg1) + offset,
VALUE_ADDRESS (arg1)
+ value_offset (arg1) + offset);
if (boffset == -1)
else
{
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
user program. Make sure that it still points to a valid memory
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)
+ value_offset (*arg1p) + offset,
- base_valaddr,
- TYPE_LENGTH (baseclass)) != 0)
+ tmp, TYPE_LENGTH (baseclass)) != 0)
error ("virtual baseclass botch");
+ base_valaddr = tmp;
}
else
- base_valaddr = VALUE_CONTENTS (*arg1p) + offset;
+ base_valaddr = value_contents (*arg1p) + offset;
base_offset =
baseclass_offset (type, i, base_valaddr,
base_offset = value_offset (*argp) + offset;
base_offset =
baseclass_offset (type, i,
- VALUE_CONTENTS (*argp) + base_offset,
+ value_contents (*argp) + base_offset,
VALUE_ADDRESS (*argp) + base_offset);
if (base_offset == -1)
error ("virtual baseclass botch");
for (i = 0; i < length; i++)
{
int element = value_bit_index (array_type,
- VALUE_CONTENTS (array),
+ value_contents (array),
lowbound + i);
if (element < 0)
error ("internal error accessing bitstring");
if (value_lazy (array))
VALUE_LAZY (slice) = 1;
else
- memcpy (VALUE_CONTENTS (slice), VALUE_CONTENTS (array) + offset,
+ memcpy (value_contents_writeable (slice),
+ value_contents (array) + offset,
TYPE_LENGTH (slice_type));
if (VALUE_LVAL (array) == lval_internalvar)
VALUE_LVAL (slice) = lval_internalvar_component;
arg2 = value_cast (real_type, arg2);
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),
- VALUE_CONTENTS (arg2), TYPE_LENGTH (real_type));
+ value_contents (arg2), TYPE_LENGTH (real_type));
return val;
}
struct value *im_val = allocate_value (val_real_type);
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),
- VALUE_CONTENTS (val) + TYPE_LENGTH (val_real_type),
+ value_contents (val) + TYPE_LENGTH (val_real_type),
TYPE_LENGTH (val_real_type));
return value_literal_complex (re_val, im_val, type);
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;
+}
+
\f
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
set_internalvar_component (struct internalvar *var, int offset, int bitpos,
int bitsize, struct value *newval)
{
- char *addr = VALUE_CONTENTS (var->value) + offset;
+ bfd_byte *addr = value_contents_writeable (var->value) + offset;
if (bitsize)
modify_field (addr, value_as_long (newval),
bitpos, bitsize);
else
- memcpy (addr, VALUE_CONTENTS (newval), TYPE_LENGTH (value_type (newval)));
+ memcpy (addr, value_contents (newval), TYPE_LENGTH (value_type (newval)));
}
void
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_contents (val));
}
DOUBLEST
DOUBLEST foo;
int inv;
- foo = unpack_double (value_type (val), VALUE_CONTENTS (val), &inv);
+ foo = unpack_double (value_type (val), value_contents (val), &inv);
if (inv)
error ("Invalid floating value found in program.");
return foo;
&& TYPE_CODE (value_type (val)) != TYPE_CODE_REF
&& gdbarch_integer_to_address_p (current_gdbarch))
return gdbarch_integer_to_address (current_gdbarch, value_type (val),
- 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
}
\f
{
v = value_from_longest (type,
unpack_field_as_long (arg_type,
- VALUE_CONTENTS (arg1)
+ value_contents (arg1)
+ offset,
fieldno));
v->bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8;
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
unpack_pointer (value_type (arg),
- VALUE_CONTENTS (arg)));
+ value_contents (arg)));
return arg;
}
When we store the entire object, `enclosing_type' is the run-time
type -- the complete object -- and `embedded_offset' is 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,
just as the inferior would.
extern int value_lazy (struct value *);
#define VALUE_LAZY(val) (val)->lazy
-/* VALUE_CONTENTS and value_contents_raw() both return the address 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() and value_contents_raw() both return the address
+ 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
-- it uses value_fetch_lazy() to load the buffer from the process
- being debugged if it hasn't already been loaded.
- value_contents_raw() is used when data is being stored into the
- buffer, or when it is certain that the contents of the buffer are
- valid.
+ being debugged if it hasn't already been loaded
+ (value_contents_writeable() is used when a writeable but fetched
+ buffer is required).. value_contents_raw() is used when data is
+ 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
get to the real subobject, if the value happens to represent
something embedded in a larger run-time object. */
extern bfd_byte *value_contents_raw (struct value *);
-#define VALUE_CONTENTS(val) \
- ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), \
- (val)->aligner.contents)
+extern const bfd_byte *value_contents (struct value *);
+extern bfd_byte *value_contents_writeable (struct value *);
/* The ALL variants of the above two macros do not adjust the returned
pointer by the embedded_offset value. */
/* We need to catch errors because if
value_fetch_lazy fails we still want to continue
(after making val->error = 1) */
- /* FIXME: Shouldn't be using VALUE_CONTENTS? The
- comment on value_fetch_lazy() says it is only
- called from the macro... */
+ /* FIXME: Shouldn't be using value_contents()? The
+ comment on value_fetch_lazy() says it is only called
+ from the macro... */
if (!gdb_value_fetch_lazy (new_val))
var->error = 1;
else
break;
/* Put argument into registers wordwise. */
- val = VALUE_CONTENTS (args[i]);
+ val = value_contents (args[i]);
for (j = 0; j < typelen; j += xstormy16_reg_size)
regcache_cooked_write_unsigned (regcache, argreg++,
extract_unsigned_integer (val + j,
typelen = TYPE_LENGTH (value_enclosing_type (args[j]));
slacklen = typelen & 1;
val = alloca (typelen + slacklen);
- memcpy (val, VALUE_CONTENTS (args[j]), typelen);
+ memcpy (val, value_contents (args[j]), typelen);
memset (val + typelen, 0, slacklen);
/* Now write this data to the stack. The stack grows upwards. */