int k;
struct value *array_ind = ada_value_ind (arr);
struct type *type
- = check_typedef (value_enclosing_type (array_ind));
+ = check_typedef (array_ind->enclosing_type ());
if (type->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (type, 0) > 0)
if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
arr = value_ind (arr);
- arr_type = value_enclosing_type (arr);
+ arr_type = arr->enclosing_type ();
if (ada_is_constrained_packed_array_type (arr_type))
return ada_array_bound (decode_constrained_packed_array (arr), n, which);
if (check_typedef (arr->type ())->code () == TYPE_CODE_PTR)
arr = value_ind (arr);
- arr_type = value_enclosing_type (arr);
+ arr_type = arr->enclosing_type ();
if (ada_is_constrained_packed_array_type (arr_type))
return ada_array_length (decode_constrained_packed_array (arr), n);
for (i = nargs - 1; i >= 0; i--)
{
- struct type *value_type = value_enclosing_type (args[i]);
+ struct type *value_type = args[i]->enclosing_type ();
total_len += align_up (value_type->length (), 4);
}
for (i = nargs - 1; i >= 0; i--)
{
- struct type *value_type = value_enclosing_type (args[i]);
+ struct type *value_type = args[i]->enclosing_type ();
struct type *arg_type = check_typedef (value_type);
int container_len = align_up (arg_type->length (), 4);
better to leave the object as-is. */
if (!(full
&& (real_type->length ()
- < value_enclosing_type (val)->length ())))
+ < val->enclosing_type ()->length ())))
val = value_cast (real_type, val);
gdb_printf (stream, "(%s%s) ",
real_type->name (),
full ? "" : _(" [incomplete object]"));
}
- else if (type != check_typedef (value_enclosing_type (val)))
+ else if (type != check_typedef (val->enclosing_type ()))
{
/* No RTTI information, so let's do our best. */
gdb_printf (stream, "(%s ?) ",
- value_enclosing_type (val)->name ());
- val = value_cast (value_enclosing_type (val), val);
+ val->enclosing_type ()->name ());
+ val = value_cast (val->enclosing_type (), val);
}
}
value *val = allocate_value (the_struct);
gdb_byte *contents = value_contents_writeable (val).data ();
- store_unsigned_integer (contents, value_enclosing_type (val)->length (),
+ store_unsigned_integer (contents, val->enclosing_type ()->length (),
gdbarch_byte_order (arch), 0xe9);
string_file out;
if (full_p)
*full_p = (- offset_to_top == value_embedded_offset (value)
- && (value_enclosing_type (value)->length ()
+ && (value->enclosing_type ()->length ()
>= run_time_type->length ()));
if (top_p)
*top_p = - offset_to_top;
for (i = 0; i < nargs; i++)
{
- struct type *arg_type = value_enclosing_type (args[i]);
+ struct type *arg_type = args[i]->enclosing_type ();
if (i386_m128_p (arg_type) && num_m128 < 4)
{
for (i = thiscall ? 1 : 0; i < nargs; i++)
{
- int len = value_enclosing_type (args[i])->length ();
+ int len = args[i]->enclosing_type ()->length ();
if (write_pass)
{
- if (i386_16_byte_align_p (value_enclosing_type (args[i])))
+ if (i386_16_byte_align_p (args[i]->enclosing_type ()))
args_space_used = align_up (args_space_used, 16);
write_memory (sp + args_space_used,
}
else
{
- if (i386_16_byte_align_p (value_enclosing_type (args[i])))
+ if (i386_16_byte_align_p (args[i]->enclosing_type ()))
args_space = align_up (args_space, 16);
args_space += align_up (len, 4);
}
/* Push arguments in reverse order. */
for (i = nargs - 1; i >= 0; i--)
{
- struct type *value_type = value_enclosing_type (args[i]);
+ struct type *value_type = args[i]->enclosing_type ();
int len = value_type->length ();
int container_len = (len + 3) & ~3;
int offset;
/* Push arguments in reverse order. */
for (i = nargs - 1; i >= 0; i--)
{
- struct type *value_type = value_enclosing_type (args[i]);
+ struct type *value_type = args[i]->enclosing_type ();
int len = value_type->length ();
int container_len = (len + 1) & ~1;
for (i = 0; i < nargs && argreg <= TILEGX_R9_REGNUM; i++)
{
const gdb_byte *val;
- typelen = value_enclosing_type (args[i])->length ();
+ typelen = args[i]->enclosing_type ()->length ();
if (typelen > (TILEGX_R9_REGNUM - argreg + 1) * tilegx_reg_size)
break;
{
const gdb_byte *contents = value_contents (args[j]).data ();
- typelen = value_enclosing_type (args[j])->length ();
+ typelen = args[j]->enclosing_type ()->length ();
slacklen = align_up (typelen, 8) - typelen;
gdb::byte_vector val (typelen + slacklen);
memcpy (val.data (), contents, typelen);
/* No superclass found, just change the pointer type. */
arg2 = value_copy (arg2);
arg2->deprecated_set_type (type);
- set_value_enclosing_type (arg2, type);
+ arg2->set_enclosing_type (type);
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
arg2 = value_copy (arg2);
arg2->deprecated_set_type (to_type);
- set_value_enclosing_type (arg2, to_type);
+ arg2->set_enclosing_type (to_type);
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
to by TOVAL retains its original dynamic type after assignment. */
if (type->code () == TYPE_CODE_PTR)
{
- set_value_enclosing_type (val, value_enclosing_type (fromval));
+ val->set_enclosing_type (fromval->enclosing_type ());
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
}
if (count < 1)
error (_("Invalid number %d of repetitions."), count);
- val = allocate_repeat_value (value_enclosing_type (arg1), count);
+ val = allocate_repeat_value (arg1->enclosing_type (), count);
VALUE_LVAL (val) = lval_memory;
set_value_address (val, value_address (arg1));
read_value_memory (val, 0, value_stack (val), value_address (val),
value_contents_all_raw (val).data (),
- type_length_units (value_enclosing_type (val)));
+ type_length_units (val->enclosing_type ()));
return val;
}
struct type *type_ptr
= lookup_pointer_type (type->target_type ());
struct type *enclosing_type
- = check_typedef (value_enclosing_type (arg1));
+ = check_typedef (arg1->enclosing_type ());
struct type *enclosing_type_ptr
= lookup_pointer_type (enclosing_type->target_type ());
arg2 = value_copy (arg1);
arg2->deprecated_set_type (type_ptr);
- set_value_enclosing_type (arg2, enclosing_type_ptr);
+ arg2->set_enclosing_type (enclosing_type_ptr);
return arg2;
}
/* This may be a pointer to a base subobject; so remember the
full derived object's type ... */
- set_value_enclosing_type (arg2,
- lookup_pointer_type (value_enclosing_type (arg1)));
+ arg2->set_enclosing_type (lookup_pointer_type (arg1->enclosing_type ()));
/* ... and also the relative position of the subobject in the full
object. */
set_value_pointed_to_offset (arg2, value_embedded_offset (arg1));
/* We may be pointing to something embedded in a larger object.
Get the real type of the enclosing object. */
- enc_type = check_typedef (value_enclosing_type (arg1));
+ enc_type = check_typedef (arg1->enclosing_type ());
enc_type = enc_type->target_type ();
CORE_ADDR base_addr;
{
error (_("bad array bounds (%d, %d)"), lowbound, highbound);
}
- typelength = type_length_units (value_enclosing_type (elemvec[0]));
+ typelength = type_length_units (elemvec[0]->enclosing_type ());
for (idx = 1; idx < nelem; idx++)
{
- if (type_length_units (value_enclosing_type (elemvec[idx]))
+ if (type_length_units (elemvec[idx]->enclosing_type ())
!= typelength)
{
error (_("array elements must all be the same size"));
}
}
- arraytype = lookup_array_range_type (value_enclosing_type (elemvec[0]),
+ arraytype = lookup_array_range_type (elemvec[0]->enclosing_type (),
lowbound, highbound);
if (!current_language->c_style_arrays_p ())
boffset += value_embedded_offset (arg1) + offset;
if (boffset < 0
- || boffset >= value_enclosing_type (arg1)->length ())
+ || boffset >= arg1->enclosing_type ()->length ())
{
CORE_ADDR base_addr;
real_type = value_rtti_type (argp, &full, &top, &using_enc);
/* If no RTTI data, or if object is already complete, do nothing. */
- if (!real_type || real_type == value_enclosing_type (argp))
+ if (!real_type || real_type == argp->enclosing_type ())
return argp;
/* In a destructor we might see a real type that is a superclass of
the object's type. In this case it is better to leave the object
as-is. */
if (full
- && real_type->length () < value_enclosing_type (argp)->length ())
+ && real_type->length () < argp->enclosing_type ()->length ())
return argp;
/* If we have the full object, but for some reason the enclosing
if (full)
{
argp = value_copy (argp);
- set_value_enclosing_type (argp, real_type);
+ argp->set_enclosing_type (real_type);
return argp;
}
/* Don't pretend we have anything available there in the history beyond
the boundaries of the value recorded. It's not like inferior memory
where there is actual stuff underneath. */
- ULONGEST val_len = TARGET_CHAR_BIT * value_enclosing_type (value)->length ();
+ ULONGEST val_len = TARGET_CHAR_BIT * value->enclosing_type ()->length ();
return !((value->m_in_history
&& (offset < 0 || offset + length > val_len))
|| ranges_contain (value->m_unavailable, offset, length));
if (t.offset == 0
&& t.length == (TARGET_CHAR_BIT
- * value_enclosing_type (value)->length ()))
+ * value->enclosing_type ()->length ()))
return 1;
}
bool
value_contents_eq (const struct value *val1, const struct value *val2)
{
- ULONGEST len1 = check_typedef (value_enclosing_type (val1))->length ();
- ULONGEST len2 = check_typedef (value_enclosing_type (val2))->length ();
+ ULONGEST len1 = check_typedef (val1->enclosing_type ())->length ();
+ ULONGEST len2 = check_typedef (val2->enclosing_type ())->length ();
if (len1 != len2)
return false;
return value_contents_eq (val1, 0, val2, 0, len1);
{
if (!val->m_contents)
{
- struct type *enclosing_type = value_enclosing_type (val);
+ struct type *enclosing_type = val->enclosing_type ();
ULONGEST len = enclosing_type->length ();
if (check_size)
{
allocate_value_contents (value, true);
- ULONGEST length = value_enclosing_type (value)->length ();
+ ULONGEST length = value->enclosing_type ()->length ();
return gdb::make_array_view (value->m_contents.get (), length);
}
-struct type *
-value_enclosing_type (const struct value *value)
-{
- return value->m_enclosing_type;
-}
-
/* Look at value.h for description. */
struct type *
{
if (real_type_found)
*real_type_found = 1;
- result = value_enclosing_type (value);
+ result = value->enclosing_type ();
}
}
if (value->m_lazy)
value_fetch_lazy (value);
- ULONGEST length = value_enclosing_type (value)->length ();
+ ULONGEST length = value->enclosing_type ()->length ();
return gdb::make_array_view (value->m_contents.get (), length);
}
{
gdb_assert (!value->m_lazy);
- ULONGEST length = value_enclosing_type (value)->length ();
+ ULONGEST length = value->enclosing_type ()->length ();
return gdb::make_array_view (value->m_contents.get (), length);
}
struct value *
value_copy (const value *arg)
{
- struct type *encl_type = value_enclosing_type (arg);
+ struct type *encl_type = arg->enclosing_type ();
struct value *val;
val = allocate_value_lazy (encl_type);
{
ULONGEST length = val->m_limited_length;
if (length == 0)
- length = value_enclosing_type (val)->length ();
+ length = val->enclosing_type ()->length ();
gdb_assert (arg->m_contents != nullptr);
const auto &arg_view
make_cv_value (int cnst, int voltl, struct value *v)
{
struct type *val_type = v->type ();
- struct type *m_enclosing_type = value_enclosing_type (v);
+ struct type *m_enclosing_type = v->enclosing_type ();
struct value *cv_val = value_copy (v);
cv_val->deprecated_set_type (make_cv_type (cnst, voltl, val_type, NULL));
- set_value_enclosing_type (cv_val,
- make_cv_type (cnst, voltl, m_enclosing_type, NULL));
+ cv_val->set_enclosing_type (make_cv_type (cnst, voltl, m_enclosing_type, NULL));
return cv_val;
}
{
if (VALUE_LVAL (arg) != not_lval)
{
- struct type *enc_type = value_enclosing_type (arg);
+ struct type *enc_type = arg->enclosing_type ();
struct value *val = allocate_value (enc_type);
copy (value_contents_all (arg), value_contents_all_raw (val));
int
record_latest_value (struct value *val)
{
- struct type *enclosing_type = value_enclosing_type (val);
+ struct type *enclosing_type = val->enclosing_type ();
struct type *type = val->type ();
/* We don't want this value to have anything to do with the inferior anymore.
data. */
void
-set_value_enclosing_type (struct value *val, struct type *new_encl_type)
+value::set_enclosing_type (struct type *new_encl_type)
{
- if (new_encl_type->length () > value_enclosing_type (val)->length ())
+ if (new_encl_type->length () > enclosing_type ()->length ())
{
check_type_length_before_alloc (new_encl_type);
- val->m_contents
- .reset ((gdb_byte *) xrealloc (val->m_contents.release (),
- new_encl_type->length ()));
+ m_contents.reset ((gdb_byte *) xrealloc (m_contents.release (),
+ new_encl_type->length ()));
}
- val->m_enclosing_type = new_encl_type;
+ m_enclosing_type = new_encl_type;
}
/* Given a value ARG1 (offset by OFFSET bytes)
boffset = arg_type->field (fieldno).loc_bitpos () / 8;
if (value_lazy (arg1))
- v = allocate_value_lazy (value_enclosing_type (arg1));
+ v = allocate_value_lazy (arg1->enclosing_type ());
else
{
- v = allocate_value (value_enclosing_type (arg1));
+ v = allocate_value (arg1->enclosing_type ());
value_contents_copy_raw (v, 0, arg1, 0,
- value_enclosing_type (arg1)->length ());
+ arg1->enclosing_type ()->length ());
}
v->m_type = type;
v->m_offset = arg1->offset ();
value->deprecated_set_type (resolved_original_target_type);
/* Add embedding info. */
- set_value_enclosing_type (value, enc_type);
+ value->set_enclosing_type (enc_type);
set_value_embedded_offset (value, value_pointed_to_offset (original_value));
/* We may be pointing to an object of some derived type. */
if (!TYPE_IS_REFERENCE (value_type_arg_tmp))
return arg;
- enc_type = check_typedef (value_enclosing_type (arg));
+ enc_type = check_typedef (arg->enclosing_type ());
enc_type = enc_type->target_type ();
CORE_ADDR addr = unpack_pointer (arg->type (), value_contents (arg).data ());
gdb_assert (VALUE_LVAL (val) == lval_memory);
CORE_ADDR addr = value_address (val);
- struct type *type = check_typedef (value_enclosing_type (val));
+ struct type *type = check_typedef (val->enclosing_type ());
/* Figure out how much we should copy from memory. Usually, this is just
the size of the type, but, for arrays, we might only be loading a
int deprecated_modifiable () const
{ return m_modifiable; }
+ /* If a value represents a C++ object, then the `type' field gives the
+ object's compile-time type. If the object actually belongs to some
+ class derived from `type', perhaps with other base classes and
+ additional members, then `type' is just a subobject of the real
+ thing, and the full object is probably larger than `type' would
+ suggest.
+
+ If `type' is a dynamic class (i.e. one with a vtable), then GDB can
+ actually determine the object's run-time type by looking at the
+ run-time type information in the vtable. When this information is
+ available, we may elect to read in the entire object, for several
+ reasons:
+
+ - When printing the value, the user would probably rather see the
+ full object, not just the limited portion apparent from the
+ compile-time type.
+
+ - If `type' has virtual base classes, then even printing `type'
+ alone may require reaching outside the `type' portion of the
+ object to wherever the virtual base class has been stored.
+
+ 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 most GDB code
+ continues to see the `type' portion of the value, just as the
+ inferior would.
+
+ If `type' is a pointer to an object, then `enclosing_type' is a
+ pointer to the object's run-time type, and `pointed_to_offset' is
+ the offset in bytes from the full object to the pointed-to object
+ -- that is, the value `embedded_offset' would have if we followed
+ the pointer and fetched the complete object. (I don't really see
+ the point. Why not just determine the run-time type when you
+ indirect, and avoid the special case? The contents don't matter
+ until you indirect anyway.)
+
+ If we're not doing anything fancy, `enclosing_type' is equal to
+ `type', and `embedded_offset' is zero, so everything works
+ normally. */
+
+ struct type *enclosing_type () const
+ { return m_enclosing_type; }
+
+ void set_enclosing_type (struct type *new_type);
+
/* Type of value; either not an lval, or one of the various
different possible kinds of lval. */
ULONGEST m_limited_length = 0;
};
-/* If a value represents a C++ object, then the `type' field gives the
- object's compile-time type. If the object actually belongs to some
- class derived from `type', perhaps with other base classes and
- additional members, then `type' is just a subobject of the real
- thing, and the full object is probably larger than `type' would
- suggest.
-
- If `type' is a dynamic class (i.e. one with a vtable), then GDB can
- actually determine the object's run-time type by looking at the
- run-time type information in the vtable. When this information is
- available, we may elect to read in the entire object, for several
- reasons:
-
- - When printing the value, the user would probably rather see the
- full object, not just the limited portion apparent from the
- compile-time type.
-
- - If `type' has virtual base classes, then even printing `type'
- alone may require reaching outside the `type' portion of the
- object to wherever the virtual base class has been stored.
-
- 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 most GDB code
- continues to see the `type' portion of the value, just as the
- inferior would.
-
- If `type' is a pointer to an object, then `enclosing_type' is a
- pointer to the object's run-time type, and `pointed_to_offset' is
- the offset in bytes from the full object to the pointed-to object
- -- that is, the value `embedded_offset' would have if we followed
- the pointer and fetched the complete object. (I don't really see
- the point. Why not just determine the run-time type when you
- indirect, and avoid the special case? The contents don't matter
- until you indirect anyway.)
-
- If we're not doing anything fancy, `enclosing_type' is equal to
- `type', and `embedded_offset' is zero, so everything works
- normally. */
-
-extern struct type *value_enclosing_type (const struct value *);
-extern void set_value_enclosing_type (struct value *val,
- struct type *new_type);
-
/* Returns value_type or value_enclosing_type depending on
value_print_options.objectprint.
example, to compare a complete object value with itself, including
its enclosing type chunk, you'd do:
- int len = check_typedef (value_enclosing_type (val))->length ();
+ int len = check_typedef (val->enclosing_type ())->length ();
value_contents_eq (val, 0, val, 0, len);
Returns true iff the set of available/valid contents match.
/* Push arguments in reverse order. */
for (i = nargs - 1; i >= 0; i--)
{
- int len = value_enclosing_type (args[i])->length ();
+ int len = args[i]->enclosing_type ()->length ();
sp -= (len + 3) & ~3;
count += (len + 3) / 4;
would fit in the remaining unused registers. */
for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
{
- typelen = value_enclosing_type (args[i])->length ();
+ typelen = args[i]->enclosing_type ()->length ();
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
break;
{
const gdb_byte *bytes = value_contents (args[j]).data ();
- typelen = value_enclosing_type (args[j])->length ();
+ typelen = args[j]->enclosing_type ()->length ();
slacklen = typelen & 1;
gdb::byte_vector val (typelen + slacklen);
memcpy (val.data (), bytes, typelen);