/* Get the size of the task image by checking the value of the bounds.
The lower bound is always 1, so we only need to read the upper bound. */
- bounds_val = value_ind (value_field (val, bounds_fieldno));
- len = value_as_long (value_field (bounds_val, upper_bound_fieldno));
+ bounds_val = value_ind (val->field (bounds_fieldno));
+ len = value_as_long (bounds_val->field (upper_bound_fieldno));
/* Make sure that we do not read more than max_len characters... */
if (len > max_len)
len = max_len;
/* Extract LEN characters from the fat string. */
- array_val = value_ind (value_field (val, array_fieldno));
+ array_val = value_ind (val->field (array_fieldno));
read_memory (array_val->address (), (gdb_byte *) dest, len);
/* Add the NUL character to close the string. */
const struct ada_tasks_pspace_data *pspace_data
= get_ada_tasks_pspace_data (current_program_space);
- ll_value = value_field (common_value, pspace_data->atcb_fieldno.ll);
+ ll_value = common_value->field (pspace_data->atcb_fieldno.ll);
if (pspace_data->atcb_fieldno.ll_lwp >= 0)
- lwp = value_as_address (value_field (ll_value,
- pspace_data->atcb_fieldno.ll_lwp));
- thread = value_as_long (value_field (ll_value,
- pspace_data->atcb_fieldno.ll_thread));
+ lwp = value_as_address (ll_value->field (pspace_data->atcb_fieldno.ll_lwp));
+ thread = value_as_long (ll_value->field (pspace_data->atcb_fieldno.ll_thread));
ptid = target_get_ada_task_ptid (lwp, thread);
tcb_value = value_from_contents_and_address (pspace_data->atcb_type,
NULL, task_id);
- common_value = value_field (tcb_value, pspace_data->atcb_fieldno.common);
+ common_value = tcb_value->field (pspace_data->atcb_fieldno.common);
/* Fill in the task_id. */
{
if (pspace_data->atcb_fieldno.image >= 0)
read_fat_string_value (task_info->name,
- value_field (common_value,
- pspace_data->atcb_fieldno.image),
+ common_value->field (pspace_data->atcb_fieldno.image),
sizeof (task_info->name) - 1);
else
{
else
{
int len = value_as_long
- (value_field (common_value,
- pspace_data->atcb_fieldno.image_len));
+ (common_value->field (pspace_data->atcb_fieldno.image_len));
value_as_string (task_info->name,
- value_field (common_value,
- pspace_data->atcb_fieldno.image),
+ common_value->field (pspace_data->atcb_fieldno.image),
len);
}
/* Compute the task state and priority. */
task_info->state =
- value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.state));
+ value_as_long (common_value->field (pspace_data->atcb_fieldno.state));
task_info->priority =
- value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.priority));
+ value_as_long (common_value->field (pspace_data->atcb_fieldno.priority));
/* If the ATCB contains some information about the parent task,
then compute it as well. Otherwise, zero. */
if (pspace_data->atcb_fieldno.parent >= 0)
task_info->parent =
- value_as_address (value_field (common_value,
- pspace_data->atcb_fieldno.parent));
+ value_as_address (common_value->field (pspace_data->atcb_fieldno.parent));
/* If the task is in an entry call waiting for another task,
then determine which task it is. */
entry of another task; then the Task_Id of the called task is
in My_ATCB.Entry_Calls (My_ATCB.ATC_Nesting_Level).Called_Task. */
atc_nesting_level_value =
- value_field (tcb_value, pspace_data->atcb_fieldno.atc_nesting_level);
+ tcb_value->field (pspace_data->atcb_fieldno.atc_nesting_level);
entry_calls_value =
ada_coerce_to_simple_array_ptr
- (value_field (tcb_value, pspace_data->atcb_fieldno.entry_calls));
+ (tcb_value->field (pspace_data->atcb_fieldno.entry_calls));
entry_calls_value_element =
value_subscript (entry_calls_value,
value_as_long (atc_nesting_level_value));
ada_get_field_index (entry_calls_value_element->type (),
"called_task", 0);
task_info->called_task =
- value_as_address (value_field (entry_calls_value_element,
- called_task_fieldno));
+ value_as_address (entry_calls_value_element->field (called_task_fieldno));
}
/* If the ATCB contains some information about RV callers, then
/* Get the ID of the caller task from Common_ATCB.Call.all.Self.
If Common_ATCB.Call is null, then there is no caller. */
const CORE_ADDR call =
- value_as_address (value_field (common_value,
- pspace_data->atcb_fieldno.call));
+ value_as_address (common_value->field (pspace_data->atcb_fieldno.call));
struct value *call_val;
if (call != 0)
NULL, call);
task_info->caller_task =
value_as_address
- (value_field (call_val, pspace_data->atcb_fieldno.call_self));
+ (call_val->field (pspace_data->atcb_fieldno.call_self));
}
}
task_info->base_cpu
= (pspace_data->cpu_id_offset
- + value_as_long (value_field (common_value,
- pspace_data->atcb_fieldno.base_cpu)));
+ + value_as_long (common_value->field (pspace_data->atcb_fieldno.base_cpu)));
/* And finally, compute the task ptid. Note that there is not point
in computing it if the task is no longer alive, in which case
/* Read the chain. */
tcb_value = value_from_contents_and_address (pspace_data->atcb_type,
NULL, task_id);
- common_value = value_field (tcb_value, pspace_data->atcb_fieldno.common);
+ common_value = tcb_value->field (pspace_data->atcb_fieldno.common);
task_id = value_as_address
- (value_field (common_value,
- pspace_data->atcb_fieldno.activation_link));
+ (common_value->field (pspace_data->atcb_fieldno.activation_link));
}
return true;
if (which < 0)
return 0;
- struct value *variant_field = value_field (value, field_num);
- struct value *active_component = value_field (variant_field, which);
+ struct value *variant_field = value->field (field_num);
+ struct value *active_component = variant_field->field (which);
return print_field_values (active_component, outer_value, stream, recurse,
options, comma_needed, language);
}
opts.deref_ref = false;
- struct value *v = value_field (value, i);
+ struct value *v = value->field (i);
common_val_print (v, stream, recurse + 1, &opts, language);
}
annotate_field_end ();
if (parent_value)
{
- value = value_field (parent_value, fieldno);
+ value = parent_value->field (fieldno);
type = value->type ();
}
else
field = value_of_variable (sym.symbol, sym.block);
}
else
- field = value_field (val, index);
+ field = val->field (index);
if (printed_field > 0)
gdb_puts (", ", stream);
{
/* Move the `this' pointer according to the virtual function table. */
arg1->set_offset (arg1->offset ()
- + value_as_long (value_field (entry, 0)));
+ + value_as_long (entry->field (0)));
if (!arg1->lazy ())
{
arg1->fetch_lazy ();
}
- vfn = value_field (entry, 2);
+ vfn = entry->field (2);
}
else if (entry_type->code () == TYPE_CODE_PTR)
vfn = entry;
/* We can't use value_ind here, because it would want to use RTTI, and
we'd waste a bunch of time figuring out we already know the type.
Besides, we don't care about the type, just the actual pointer. */
- if (value_field (v, known_type_vptr_fieldno)->address () == 0)
+ if (v->field (known_type_vptr_fieldno)->address () == 0)
return NULL;
- vtbl = value_as_address (value_field (v, known_type_vptr_fieldno));
+ vtbl = value_as_address (v->field (known_type_vptr_fieldno));
/* Try to find a symbol that is the vtable. */
bound_minimal_symbol minsym = lookup_minimal_symbol_by_pc (vtbl);
/* Get the offset from VALUE to the top of the complete object.
NOTE: this is the reverse of the meaning of *TOP_P. */
offset_to_top
- = value_as_long (value_field (vtable, vtable_field_offset_to_top));
+ = value_as_long (vtable->field (vtable_field_offset_to_top));
if (full_p)
*full_p = (- offset_to_top == value->embedded_offset ()
gdb_assert (vtable != NULL);
/* Fetch the appropriate function pointer from the vtable. */
- vfn = value_subscript (value_field (vtable, vtable_field_virtual_functions),
+ vfn = value_subscript (vtable->field (vtable_field_virtual_functions),
vtable_index);
/* If this architecture uses function descriptors directly in the vtable,
vtable = gnuv3_get_vtable (gdbarch, type, address + embedded_offset);
gdb_assert (vtable != NULL);
- vbase_array = value_field (vtable, vtable_field_vcall_and_vbase_offsets);
+ vbase_array = vtable->field (vtable_field_vcall_and_vbase_offsets);
base_offset = value_as_long (value_subscript (vbase_array, cur_base_offset));
return base_offset;
}
/* Recurse into base classes. */
for (i = 0; i < TYPE_N_BASECLASSES (type); ++i)
- compute_vtable_size (offset_hash, value_field (value, i));
+ compute_vtable_size (offset_hash, value->field (i));
}
/* Helper for gnuv3_print_vtable that prints a single vtable. */
vtable = gnuv3_get_vtable (gdbarch, type,
value->address ()
+ value->embedded_offset ());
- vt_addr = value_field (vtable,
- vtable_field_virtual_functions)->address ();
+ vt_addr = vtable->field (vtable_field_virtual_functions)->address ();
gdb_printf (_("vtable for '%s' @ %s (subobject @ %s):\n"),
TYPE_SAFE_NAME (type),
gdb_printf ("[%d]: ", i);
- vfn = value_subscript (value_field (vtable,
- vtable_field_virtual_functions),
+ vfn = value_subscript (vtable->field (vtable_field_virtual_functions),
i);
if (gdbarch_vtable_function_descriptors (gdbarch))
if (vtable == NULL)
error (_("cannot find typeinfo for object of type '%s'"),
name);
- typeinfo_value = value_field (vtable, vtable_field_type_info);
+ typeinfo_value = vtable->field (vtable_field_type_info);
result = value_ind (value_cast (make_pointer_type (typeinfo_type),
typeinfo_value));
}
return NULL;
}
- CORE_ADDR vtable = value_as_address (value_field (value, vtable_field));
+ CORE_ADDR vtable = value_as_address (value->field (vtable_field));
struct symbol *symbol = find_symbol_at_address (vtable);
if (symbol == NULL || symbol->subclass != SYMBOL_RUST_VTABLE)
return NULL;
struct rust_vtable_symbol *vtable_sym
= static_cast<struct rust_vtable_symbol *> (symbol);
struct type *pointer_type = lookup_pointer_type (vtable_sym->concrete_type);
- return value_cast (pointer_type, value_field (value, 1 - vtable_field));
+ return value_cast (pointer_type, value->field (1 - vtable_field));
}
/* Find and possibly rewrite the unsized part of a slice-like type.
gdb_puts (": ", stream);
}
- common_val_print (value_field (val, i), stream, recurse + 1, &opts,
+ common_val_print (val->field (i), stream, recurse + 1, &opts,
this);
}
styled_string (variable_name_style.style (),
variant_type->field (j).name ()));
- common_val_print (value_field (val, j), stream, recurse + 1, &opts,
+ common_val_print (val->field (j), stream, recurse + 1, &opts,
this);
}
if (strcmp (type->field (0).name (), "start") == 0)
{
*kind = RANGE_HIGH_BOUND_DEFAULT;
- *low = value_as_long (value_field (range, 0));
+ *low = value_as_long (range->field (0));
++i;
}
if (type->num_fields () > i
{
*kind = (*kind == (RANGE_LOW_BOUND_DEFAULT | RANGE_HIGH_BOUND_DEFAULT)
? RANGE_LOW_BOUND_DEFAULT : RANGE_STANDARD);
- *high = value_as_long (value_field (range, i));
+ *high = value_as_long (range->field (i));
if (rust_inclusive_range_type_p (type))
++*high;
addr = value_as_long (addrval);
tem = value_at_lazy (slice, addr);
- value_assign (value_field (tem, 0), value_addr (result));
- value_assign (value_field (tem, 1),
+ value_assign (tem->field (0), value_addr (result));
+ value_assign (tem->field (1),
value_from_longest (usize, high - low));
result = value_at_lazy (slice, addr);
return v;
}
-/* Given a value ARG1 of a struct or union type,
- extract and return the value of one of its (non-static) fields.
- FIELDNO says which field. */
-
-struct value *
-value_field (struct value *arg1, int fieldno)
-{
- return arg1->primitive_field (0, fieldno, arg1->type ());
-}
-
/* Return a non-virtual function as a value.
F is the list of member functions which contains the desired method.
J is an index into F which provides the desired method.
struct value *primitive_field (LONGEST offset, int fieldno,
struct type *arg_type);
+ /* Given that this value is of a struct or union type, extract and
+ return the value of one of its (non-static) fields. FIELDNO says
+ which field. */
+ value *field (int fieldno)
+ {
+ return primitive_field (0, fieldno, type ());
+ }
+
/* Create a new value by extracting it from this value. TYPE is the
type of the new value. BIT_OFFSET and BIT_LENGTH describe the
offset and field width of the value to extract from this value --
int *staticp, const int no_adl,
enum noside noside);
-extern struct value *value_field (struct value *arg1, int fieldno);
-
extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *,
int *);