* value.h (value_embedded_offset): Delete.
(value_embedded_offset): Declare.
* value.c (value_embedded_offset): Define.
* valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
* gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
* cp-abi.h: Update.
2005-02-07 Andrew Cagney <cagney@gnu.org>
+ * value.h (value_embedded_offset): Delete.
+ (value_embedded_offset): Declare.
+ * value.c (value_embedded_offset): Define.
+ * valops.c, p-valprint.c, mi/mi-main.c, hpacc-abi.c: Update.
+ * gnu-v3-abi.c, eval.c, c-valprint.c, cp-valprint.c: Update.
+ * cp-abi.h: Update.
+
* value.h (VALUE_LAZY): Delete
(set_value_lazy): Declare.
* value.c (set_value_lazy): Define.
}
return val_print (type, value_contents_all (val),
- VALUE_EMBEDDED_OFFSET (val),
+ value_embedded_offset (val),
VALUE_ADDRESS (val) + value_offset (val),
stream, format, 1, 0, pretty);
}
of the complete object to the start of the embedded subobject
VALUE represents. In other words, the enclosing object starts
at VALUE_ADDR (VALUE) + VALUE_OFFSET (VALUE) +
- VALUE_EMBEDDED_OFFSET (VALUE) + *TOP
+ value_embedded_offset (VALUE) + *TOP
- If *USING_ENC is non-zero, then *TOP is the offset from the
address of the complete object to the enclosing object stored
in VALUE. In other words, the enclosing object starts at
CHECK_TYPEDEF (type);
cp_print_value_fields (type, type, value_contents_all (val),
- VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), VALUE_ADDRESS (val),
stream, format, recurse, pretty, NULL, 1);
return;
}
val_print (type, value_contents_all (val),
- VALUE_EMBEDDED_OFFSET (val), VALUE_ADDRESS (val),
+ value_embedded_offset (val), VALUE_ADDRESS (val),
stream, format, 0, recurse, pretty);
}
reflect any ``this'' changes. */
arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
VALUE_ADDRESS (temp) + value_offset (temp)
- + VALUE_EMBEDDED_OFFSET (temp));
+ + value_embedded_offset (temp));
argvec[1] = arg2; /* the ``this'' pointer */
}
vtable_symbol
= lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtable)
+ value_offset (vtable)
- + VALUE_EMBEDDED_OFFSET (vtable));
+ + value_embedded_offset (vtable));
if (! vtable_symbol)
return NULL;
= value_as_long (value_field (vtable, vtable_field_offset_to_top));
if (full_p)
- *full_p = (- offset_to_top == VALUE_EMBEDDED_OFFSET (value)
+ *full_p = (- offset_to_top == value_embedded_offset (value)
&& (TYPE_LENGTH (value_enclosing_type (value))
>= TYPE_LENGTH (run_time_type)));
if (top_p)
/* pai: FIXME -- 32x64 possible problem? */
/* First word (4 bytes) in object layout is the vtable pointer */
coreptr = *(CORE_ADDR *) (value_contents (argp)); /* pai: (temp) */
- /* + offset + VALUE_EMBEDDED_OFFSET (argp)); */
+ /* + offset + value_embedded_offset (argp)); */
if (!coreptr)
error
+ value_offset (v)
+ (using_enclosing
? 0
- : VALUE_EMBEDDED_OFFSET (v)));
+ : value_embedded_offset (v)));
if (coreptr == 0)
/* return silently -- maybe called on gdb-generated value */
return NULL;
||
/* Or we checked on the embedded object and top offset was the
same as the embedded offset */
- ((top_offset == VALUE_EMBEDDED_OFFSET (v)) &&
+ ((top_offset == value_embedded_offset (v)) &&
!using_enclosing &&
TYPE_LENGTH (value_enclosing_type (v)) == TYPE_LENGTH (rtti_type))))
/* Print the result of the expression evaluation. */
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);
ui_out_field_stream (uiout, "value", stb);
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);
}
CORE_ADDR addr2 = value_as_address (arg2);
addr2 -= (VALUE_ADDRESS (v)
+ value_offset (v)
- + VALUE_EMBEDDED_OFFSET (v));
+ + value_embedded_offset (v));
return value_from_pointer (type, addr2);
}
}
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
val = value_copy (VALUE_INTERNALVAR (toval)->value);
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
- VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
+ set_value_embedded_offset (val, value_embedded_offset (fromval));
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
return val;
TYPE_LENGTH (type));
val->type = type;
val = value_change_enclosing_type (val, value_enclosing_type (fromval));
- VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (fromval);
+ set_value_embedded_offset (val, value_embedded_offset (fromval));
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (fromval);
return val;
arg2 = value_from_pointer (lookup_pointer_type (value_type (arg1)),
(VALUE_ADDRESS (arg1)
+ value_offset (arg1)
- + VALUE_EMBEDDED_OFFSET (arg1)));
+ + value_embedded_offset (arg1)));
/* This may be a pointer to a base subobject; so remember the
full derived object's type ... */
arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
/* ... and also the relative position of the subobject in the full object */
- VALUE_POINTED_TO_OFFSET (arg2) = VALUE_EMBEDDED_OFFSET (arg1);
+ VALUE_POINTED_TO_OFFSET (arg2) = value_embedded_offset (arg1);
return arg2;
}
arg2->type = TYPE_TARGET_TYPE (base_type);
/* Add embedding info */
arg2 = value_change_enclosing_type (arg2, enc_type);
- VALUE_EMBEDDED_OFFSET (arg2) = VALUE_POINTED_TO_OFFSET (arg1);
+ set_value_embedded_offset (arg2, VALUE_POINTED_TO_OFFSET (arg1));
/* We may be pointing to an object of some derived type */
arg2 = value_full_object (arg2, NULL, 0, 0, 0);
int skip;
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
value_contents_all (*arg1p),
- offset + VALUE_EMBEDDED_OFFSET (*arg1p),
+ offset + value_embedded_offset (*arg1p),
&base_offset, &skip);
if (skip >= 0)
error ("Virtual base class offset not found in vtable");
int skip;
find_rt_vbase_offset (type, TYPE_BASECLASS (type, i),
value_contents_all (*argp),
- offset + VALUE_EMBEDDED_OFFSET (*argp),
+ offset + value_embedded_offset (*argp),
&base_offset, &skip);
if (skip >= 0)
error ("Virtual base class offset not found in vtable");
adjusting for the embedded offset of argp if that's what value_rtti_type
used for its computation. */
new_val = value_at_lazy (real_type, VALUE_ADDRESS (argp) - top +
- (using_enc ? 0 : VALUE_EMBEDDED_OFFSET (argp)));
+ (using_enc ? 0 : value_embedded_offset (argp)));
new_val->type = value_type (argp);
- VALUE_EMBEDDED_OFFSET (new_val) = using_enc ? top + VALUE_EMBEDDED_OFFSET (argp) : top;
+ set_value_embedded_offset (new_val, (using_enc
+ ? top + value_embedded_offset (argp)
+ : top));
return new_val;
}
VALUE_REGNUM (val) = -1;
val->lazy = 0;
val->optimized_out = 0;
- VALUE_EMBEDDED_OFFSET (val) = 0;
+ val->embedded_offset = 0;
VALUE_POINTED_TO_OFFSET (val) = 0;
val->modifiable = 1;
return val;
{
value->optimized_out = val;
}
+
+int
+value_embedded_offset (struct value *value)
+{
+ return value->embedded_offset;
+}
+
+void
+set_value_embedded_offset (struct value *value, int val)
+{
+ value->embedded_offset = val;
+}
\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
VALUE_REGNUM (val) = VALUE_REGNUM (arg);
val->lazy = arg->lazy;
val->optimized_out = arg->optimized_out;
- VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg);
+ val->embedded_offset = value_embedded_offset (arg);
VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg);
val->modifiable = arg->modifiable;
if (!value_lazy (val))
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
TYPE_LENGTH (value_enclosing_type (arg1)));
v->offset = value_offset (arg1);
- VALUE_EMBEDDED_OFFSET (v)
- = offset +
- VALUE_EMBEDDED_OFFSET (arg1) +
- TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
+ v->embedded_offset = (offset + value_embedded_offset (arg1)
+ + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8);
}
else
{
value_contents_raw (arg1) + offset,
TYPE_LENGTH (type));
v->offset = (value_offset (arg1) + offset
- + VALUE_EMBEDDED_OFFSET (arg1));
+ + value_embedded_offset (arg1));
}
VALUE_LVAL (v) = VALUE_LVAL (arg1);
if (VALUE_LVAL (arg1) == lval_internalvar)
#define VALUE_REGNUM(val) (val)->regnum
extern int value_optimized_out (struct value *value);
extern void set_value_optimized_out (struct value *value, int val);
-#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
+extern int value_embedded_offset (struct value *value);
+extern void set_value_embedded_offset (struct value *value, int val);
#define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
/* Convert a REF to the object referenced. */