* value.h (value_lazy): Declare.
* varobj.c, value.c, valops.c, valarith.c, printcmd.c: Update.
* cp-valprint.c, breakpoint.c, ada-lang.c: Update.
2005-02-02 Andrew Cagney <cagney@gnu.org>
+ * value.h (value_lazy): Declare.
+ * varobj.c, value.c, valops.c, valarith.c, printcmd.c: Update.
+ * cp-valprint.c, breakpoint.c, ada-lang.c: Update.
+
* value.h (VALUE_CONTENTS_ALL): Delete.
(value_contents_all): Declare.
* value.c (value_contents_all): New function.
result->bitsize = value_bitsize (val);
result->bitpos = value_bitpos (val);
VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + value_offset (val);
- if (VALUE_LAZY (val)
+ if (value_lazy (val)
|| TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
VALUE_LAZY (result) = 1;
else
v = allocate_value (type);
bytes = (unsigned char *) (valaddr + offset);
}
- else if (VALUE_LAZY (obj))
+ else if (value_lazy (obj))
{
v = value_at (type,
VALUE_ADDRESS (obj) + value_offset (obj) + offset);
its contents to evaluate the expression, then we
must watch it. */
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
struct type *vtype = check_typedef (value_type (v));
struct value *val;
val = evaluate_expression (b->owner->exp);
release_value (val);
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
b->owner->val = val;
}
/* For each memory reference remove the watchpoint
at that address. */
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
struct type *vtype = check_typedef (value_type (v));
for (v = b->val_chain; v; v = v->next)
{
if (VALUE_LVAL (v) == lval_memory
- && ! VALUE_LAZY (v))
+ && ! value_lazy (v))
{
struct type *vtype = check_typedef (value_type (v));
mark = value_mark ();
val = evaluate_expression (exp);
release_value (val);
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
tok = arg;
{
if (VALUE_LVAL (v) == lval_memory)
{
- if (VALUE_LAZY (v))
+ if (value_lazy (v))
/* A lazy memory lvalue is one that GDB never needed to fetch;
we either just used its address (e.g., `a' in `a.b') or
we never needed it at all (e.g., `a' in `a,b'). */
}
b->val = evaluate_expression (b->exp);
release_value (b->val);
- if (VALUE_LAZY (b->val) && breakpoint_enabled (b))
+ if (value_lazy (b->val) && breakpoint_enabled (b))
value_fetch_lazy (b->val);
if (b->cond_string != NULL)
mark = value_mark ();
bpt->val = evaluate_expression (bpt->exp);
release_value (bpt->val);
- if (VALUE_LAZY (bpt->val))
+ if (value_lazy (bpt->val))
value_fetch_lazy (bpt->val);
if (bpt->type == bp_hardware_watchpoint ||
/* Get the address of the vfunction entry */
struct value *vf = value_copy (v);
- if (VALUE_LAZY (vf))
+ if (value_lazy (vf))
(void) value_fetch_lazy (vf);
/* adjust by offset */
vf->aligner.contents[0] += 4 * (HP_ACC_VFUNC_START + vx);
When used in contexts where arrays will be coerced anyway, this is
equivalent to `evaluate_subexp' but much faster because it avoids
actually fetching array contents (perhaps obsolete now that we have
- VALUE_LAZY).
+ value_lazy()).
Note that we currently only do the coercion for C expressions, where
arrays are zero based and the coercion is correct. For other languages,
if (lazy_value == 0)
error ("Address of \"%s\" is unknown.", SYMBOL_PRINT_NAME (var));
- if (VALUE_LAZY (lazy_value)
+ if (value_lazy (lazy_value)
|| TYPE_CODE (type) == TYPE_CODE_FUNC)
{
struct value *val;
/* Move the `this' pointer according to the virtual function table. */
arg1->offset += value_as_long (value_field (entry, 0));
- if (!VALUE_LAZY (arg1))
+ if (!value_lazy (arg1))
{
VALUE_LAZY (arg1) = 1;
value_fetch_lazy (arg1);
/* Make contents of last address examined available to the user as $__. */
/* If the last value has not been fetched from memory then don't
fetch it now - instead mark it by voiding the $__ variable. */
- if (VALUE_LAZY (last_examine_value))
+ if (value_lazy (last_examine_value))
set_internalvar (lookup_internalvar ("__"),
allocate_value (builtin_type_void));
else
/* Make sure the value is fully evaluated. It may live in the
stack frame we're about to pop. */
- if (VALUE_LAZY (return_value))
+ if (value_lazy (return_value))
value_fetch_lazy (return_value);
if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
error ("no such vector element");
v = allocate_value (elt_type);
- if (VALUE_LAZY (array))
+ if (value_lazy (array))
VALUE_LAZY (v) = 1;
else
memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs, elt_size);
VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
v2->offset = value_offset (arg1) + boffset;
- if (VALUE_LAZY (arg1))
+ if (value_lazy (arg1))
VALUE_LAZY (v2) = 1;
else
memcpy (value_contents_raw (v2),
slice_range_type);
TYPE_CODE (slice_type) = TYPE_CODE (array_type);
slice = allocate_value (slice_type);
- if (VALUE_LAZY (array))
+ if (value_lazy (array))
VALUE_LAZY (slice) = 1;
else
memcpy (VALUE_CONTENTS (slice), VALUE_CONTENTS (array) + offset,
val->bitpos = 0;
val->bitsize = 0;
VALUE_REGNUM (val) = -1;
- VALUE_LAZY (val) = 0;
+ val->lazy = 0;
VALUE_OPTIMIZED_OUT (val) = 0;
VALUE_EMBEDDED_OFFSET (val) = 0;
VALUE_POINTED_TO_OFFSET (val) = 0;
return value->aligner.contents;
}
+int
+value_lazy (struct value *value)
+{
+ return value->lazy;
+}
+
\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
val->bitsize = arg->bitsize;
VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg);
VALUE_REGNUM (val) = VALUE_REGNUM (arg);
- VALUE_LAZY (val) = VALUE_LAZY (arg);
+ val->lazy = arg->lazy;
VALUE_OPTIMIZED_OUT (val) = VALUE_OPTIMIZED_OUT (arg);
VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
val->modifiable = arg->modifiable;
- if (!VALUE_LAZY (val))
+ if (!value_lazy (val))
{
memcpy (value_contents_all_raw (val), value_contents_all_raw (arg),
TYPE_LENGTH (value_enclosing_type (arg)));
In particular, "set $1 = 50" should not affect the variable from which
the value was taken, and fast watchpoints should be able to assume that
a value on the value history never changes. */
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
/* We preserve VALUE_LVAL so that the user can find out where it was fetched
from. This is a bit dubious, because then *&$1 does not just return $1
struct value *val;
val = value_copy (var->value);
- if (VALUE_LAZY (val))
+ if (value_lazy (val))
value_fetch_lazy (val);
VALUE_LVAL (val) = lval_internalvar;
VALUE_INTERNALVAR (val) = var;
/* Force the value to be fetched from the target now, to avoid problems
later when this internalvar is referenced and the target is gone or
has changed. */
- if (VALUE_LAZY (newval))
+ if (value_lazy (newval))
value_fetch_lazy (newval);
/* Begin code which must not call error(). If var->value points to
bases, etc. */
v = allocate_value (value_enclosing_type (arg1));
v->type = type;
- if (VALUE_LAZY (arg1))
+ if (value_lazy (arg1))
VALUE_LAZY (v) = 1;
else
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
/* Plain old data member */
offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
v = allocate_value (type);
- if (VALUE_LAZY (arg1))
+ if (value_lazy (arg1))
VALUE_LAZY (v) = 1;
else
memcpy (value_contents_raw (v),
extern int value_offset (struct value *);
extern struct type *value_enclosing_type (struct value *);
+extern int value_lazy (struct value *);
#define VALUE_LAZY(val) (val)->lazy
/* VALUE_CONTENTS and value_contents_raw() both return the address of
{
/* no error */
release_value (var->value);
- if (VALUE_LAZY (var->value))
+ if (value_lazy (var->value))
gdb_value_fetch_lazy (var->value);
}
else
value = (*parent->root->lang->value_of_child) (parent, index);
/* If we're being lazy, fetch the real value of the variable. */
- if (value != NULL && VALUE_LAZY (value))
+ if (value != NULL && value_lazy (value))
{
/* If we fail to fetch the value of the child, return
NULL so that callers notice that we're leaving an
go on */
if (gdb_evaluate_expression (var->root->exp, &new_val))
{
- if (VALUE_LAZY (new_val))
+ if (value_lazy (new_val))
{
/* We need to catch errors because if
value_fetch_lazy fails we still want to continue
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
char *thevalue;
- if (VALUE_LAZY (var->value))
+ if (value_lazy (var->value))
gdb_value_fetch_lazy (var->value);
val_print (value_type (var->value),
value_contents_raw (var->value), 0,