struct field t1[], struct value *t2[]);
static struct value *search_struct_field (const char *, struct value *,
- int, struct type *, int);
+ struct type *, int);
static struct value *search_struct_method (const char *, struct value **,
struct value **,
if (TYPE_NAME (t1) != NULL)
{
v = search_struct_field (type_name_no_tag (t1),
- v2, 0, t2, 1);
+ v2, t2, 1);
if (v)
return v;
}
&& !strcmp (TYPE_NAME (real_type), TYPE_NAME (t1)))
return v;
- v = search_struct_field (type_name_no_tag (t2), v, 0, real_type, 1);
+ v = search_struct_field (type_name_no_tag (t2), v, real_type, 1);
if (v)
return v;
}
T2. This wouldn't work properly for classes with virtual
bases, but those were handled above. */
v = search_struct_field (type_name_no_tag (t2),
- value_zero (t1, not_lval), 0, t1, 1);
+ value_zero (t1, not_lval), t1, 1);
if (v)
{
/* Downcasting is possible (t1 is superclass of v2). */
/* We deref the value and then do the cast. */
return value_cast (type, coerce_ref (arg2));
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
code1 = TYPE_CODE (type);
arg2 = coerce_ref (arg2);
type2 = check_typedef (value_type (arg2));
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length)
{
- ULONGEST xfered = 0;
+ ULONGEST xfered_total = 0;
+ struct gdbarch *arch = get_value_arch (val);
+ int unit_size = gdbarch_addressable_memory_unit_size (arch);
- while (xfered < length)
+ while (xfered_total < length)
{
enum target_xfer_status status;
- ULONGEST xfered_len;
+ ULONGEST xfered_partial;
status = target_xfer_partial (current_target.beneath,
TARGET_OBJECT_MEMORY, NULL,
- buffer + xfered, NULL,
- memaddr + xfered, length - xfered,
- &xfered_len);
+ buffer + xfered_total * unit_size, NULL,
+ memaddr + xfered_total,
+ length - xfered_total,
+ &xfered_partial);
if (status == TARGET_XFER_OK)
/* nothing */;
else if (status == TARGET_XFER_UNAVAILABLE)
- mark_value_bytes_unavailable (val, embedded_offset + xfered,
- xfered_len);
+ mark_value_bytes_unavailable (val, embedded_offset + xfered_total,
+ xfered_partial);
else if (status == TARGET_XFER_EOF)
- memory_error (TARGET_XFER_E_IO, memaddr + xfered);
+ memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
else
- memory_error (status, memaddr + xfered);
+ memory_error (status, memaddr + xfered_total);
- xfered += xfered_len;
+ xfered_total += xfered_partial;
QUIT;
}
}
fromval = coerce_array (fromval);
}
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
/* Since modifying a register can trash the frame chain, and
modifying memory can trash the frame cache, we save the old frame
else
{
changed_addr = value_address (toval);
- changed_len = TYPE_LENGTH (type);
+ changed_len = type_length_units (type);
dest_buffer = value_contents (fromval);
}
}
observer_notify_register_changed (frame, value_reg);
- if (deprecated_register_changed_hook)
- deprecated_register_changed_hook (-1);
break;
}
read_value_memory (val, 0, value_stack (val), value_address (val),
value_contents_all_raw (val),
- TYPE_LENGTH (value_enclosing_type (val)));
+ type_length_units (value_enclosing_type (val)));
return val;
}
{
error (_("bad array bounds (%d, %d)"), lowbound, highbound);
}
- typelength = TYPE_LENGTH (value_enclosing_type (elemvec[0]));
+ typelength = type_length_units (value_enclosing_type (elemvec[0]));
for (idx = 1; idx < nelem; idx++)
{
- if (TYPE_LENGTH (value_enclosing_type (elemvec[idx])) != typelength)
+ if (type_length_units (value_enclosing_type (elemvec[idx]))
+ != typelength)
{
error (_("array elements must all be the same size"));
}
int i;
int nbases;
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
nbases = TYPE_N_BASECLASSES (type);
if (!looking_for_baseclass)
}
/* Helper function used by value_struct_elt to recurse through
- baseclasses. Look for a field NAME in ARG1. Adjust the address of
- ARG1 by OFFSET bytes, and search in it assuming it has (class) type
- TYPE. If found, return value, else return NULL.
+ baseclasses. Look for a field NAME in ARG1. Search in it assuming
+ it has (class) type TYPE. If found, return value, else return NULL.
If LOOKING_FOR_BASECLASS, then instead of looking for struct
fields, look for a baseclass named NAME. */
static struct value *
-search_struct_field (const char *name, struct value *arg1, int offset,
+search_struct_field (const char *name, struct value *arg1,
struct type *type, int looking_for_baseclass)
{
struct value *result = NULL;
int boffset = 0;
- do_search_struct_field (name, arg1, offset, type, looking_for_baseclass,
+ do_search_struct_field (name, arg1, 0, type, looking_for_baseclass,
&result, &boffset, type);
return result;
}
int name_matched = 0;
char dem_opname[64];
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
{
const char *t_field_name = TYPE_FN_FIELDLIST_NAME (type, i);
/* Try as a field first, because if we succeed, there is less
work to be done. */
- v = search_struct_field (name, *argp, 0, t, 0);
+ v = search_struct_field (name, *argp, t, 0);
if (v)
return v;
/* See if user tried to invoke data as function. If so, hand it
back. If it's not callable (i.e., a pointer to function),
gdb should give an error. */
- v = search_struct_field (name, *argp, 0, t, 0);
+ v = search_struct_field (name, *argp, t, 0);
/* If we found an ordinary field, then it is not a method call.
So, treat it as if it were a static member function. */
if (v && static_memfuncp)
VEC (xmethod_worker_ptr) *worker_vec = NULL, *new_vec = NULL;
gdb_assert (fn_list != NULL && xm_worker_vec != NULL);
- CHECK_TYPEDEF (type);
+ type = check_typedef (type);
/* First check in object itself.
This function is called recursively to search through base classes.
a function. */
if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT)
{
- *valp = search_struct_field (name, obj, 0,
+ *valp = search_struct_field (name, obj,
check_typedef (value_type (obj)), 0);
if (*valp)
{
{
slice = allocate_value (slice_type);
value_contents_copy (slice, 0, array, offset,
- TYPE_LENGTH (slice_type));
+ type_length_units (slice_type));
}
set_value_component_location (slice, array);