aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-02-07 00:09:56 +0000
committerAndrew Cagney <cagney@redhat.com>2005-02-07 00:09:56 +0000
commit0fd88904d91d1a137779cd5da6dc9d223fa88d14 (patch)
tree34dfdde621bdd7cfcdbb59c69d53a749c7d48d8f /gdb/value.c
parent1b3a857543e77eedd244b0d7d8cadce4e2e0500e (diff)
downloadgdb-0fd88904d91d1a137779cd5da6dc9d223fa88d14.zip
gdb-0fd88904d91d1a137779cd5da6dc9d223fa88d14.tar.gz
gdb-0fd88904d91d1a137779cd5da6dc9d223fa88d14.tar.bz2
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.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/gdb/value.c b/gdb/value.c
index a871df3..fecbbf5 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -179,6 +179,20 @@ value_lazy (struct value *value)
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
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,
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
@@ -586,7 +600,7 @@ value_as_long (struct value *val)
in disassemble_command). It also dereferences references, which
I suspect is the most logical thing to do. */
val = coerce_array (val);
- return unpack_long (value_type (val), VALUE_CONTENTS (val));
+ return unpack_long (value_type (val), value_contents (val));
}
DOUBLEST
@@ -595,7 +609,7 @@ value_as_double (struct value *val)
DOUBLEST foo;
int inv;
- foo = unpack_double (value_type (val), VALUE_CONTENTS (val), &inv);
+ foo = unpack_double (value_type (val), value_contents (val), &inv);
if (inv)
error ("Invalid floating value found in program.");
return foo;
@@ -699,9 +713,9 @@ value_as_address (struct value *val)
&& 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
}
@@ -953,7 +967,7 @@ value_primitive_field (struct value *arg1, int offset,
{
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;
@@ -1266,7 +1280,7 @@ coerce_ref (struct value *arg)
if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)
arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),
unpack_pointer (value_type (arg),
- VALUE_CONTENTS (arg)));
+ value_contents (arg)));
return arg;
}