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.
This commit is contained in:
Andrew Cagney 2005-02-02 22:34:36 +00:00
parent 46615f07c3
commit d69fe07ead
14 changed files with 42 additions and 31 deletions

View File

@ -1,5 +1,9 @@
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.

View File

@ -451,7 +451,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type)
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
@ -1811,7 +1811,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr,
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);

View File

@ -944,7 +944,7 @@ insert_bp_location (struct bp_location *bpt,
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));
@ -1123,7 +1123,7 @@ insert_breakpoints (void)
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;
}
@ -1475,7 +1475,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
/* 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));
@ -2728,7 +2728,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint)
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));
@ -5619,7 +5619,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty)
mark = value_mark ();
val = evaluate_expression (exp);
release_value (val);
if (VALUE_LAZY (val))
if (value_lazy (val))
value_fetch_lazy (val);
tok = arg;
@ -5793,7 +5793,7 @@ can_use_hardware_watchpoint (struct value *v)
{
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'). */
@ -7116,7 +7116,7 @@ breakpoint_re_set_one (void *bint)
}
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)
@ -7472,7 +7472,7 @@ is valid is not currently in scope.\n", bpt->number);
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 ||

View File

@ -781,7 +781,7 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs,
/* 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);

View File

@ -2143,7 +2143,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
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,

View File

@ -738,7 +738,7 @@ locate_var_value (struct symbol *var, struct frame_info *frame)
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;

View File

@ -164,7 +164,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j,
/* 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);

View File

@ -1316,7 +1316,7 @@ x_command (char *exp, int from_tty)
/* 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

View File

@ -1824,7 +1824,7 @@ return_command (char *retval_exp, int from_tty)
/* 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)

View File

@ -268,7 +268,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
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);

View File

@ -1312,7 +1312,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
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),
@ -2763,7 +2763,7 @@ value_slice (struct value *array, int lowbound, int length)
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,

View File

@ -95,7 +95,7 @@ allocate_value (struct type *type)
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;
@ -173,6 +173,12 @@ value_contents_all (struct value *value)
return value->aligner.contents;
}
int
value_lazy (struct value *value)
{
return value->lazy;
}
/* Return a mark in the value chain. All values allocated after the
mark is obtained (except for those released) are subject to being freed
@ -276,12 +282,12 @@ value_copy (struct value *arg)
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)));
@ -306,7 +312,7 @@ record_latest_value (struct value *val)
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
@ -476,7 +482,7 @@ value_of_internalvar (struct internalvar *var)
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;
@ -507,7 +513,7 @@ set_internalvar (struct internalvar *var, struct value *val)
/* 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
@ -962,7 +968,7 @@ value_primitive_field (struct value *arg1, int offset,
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),
@ -978,7 +984,7 @@ value_primitive_field (struct value *arg1, int offset,
/* 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),

View File

@ -179,6 +179,7 @@ extern int value_bitpos (struct value *);
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

View File

@ -500,7 +500,7 @@ varobj_create (char *objname,
{
/* no error */
release_value (var->value);
if (VALUE_LAZY (var->value))
if (value_lazy (var->value))
gdb_value_fetch_lazy (var->value);
}
else
@ -1686,7 +1686,7 @@ value_of_child (struct varobj *parent, int index)
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
@ -1904,7 +1904,7 @@ c_value_of_root (struct varobj **var_handle)
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
@ -2092,7 +2092,7 @@ c_value_of_variable (struct varobj *var)
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,