@@ -155,7 +155,7 @@ convert_one_symbol (compile_c_instance *context,
sym.symbol->print_name ());
}
- val = read_var_value (sym.symbol, sym.block, frame);
+ val = read_var_value (sym, frame);
if (val->lval () != lval_memory)
error (_("Symbol \"%s\" cannot be used for compilation "
"evaluation as its address has not been found."),
@@ -151,7 +151,7 @@ convert_one_symbol (compile_cplus_instance *instance,
sym.symbol->print_name ());
}
- val = read_var_value (sym.symbol, sym.block, frame);
+ val = read_var_value (sym, frame);
if (val->lval () != lval_memory)
error (_("Symbol \"%s\" cannot be used for compilation "
"evaluation as its address has not been found."),
@@ -794,6 +794,18 @@ read_var_value (struct symbol *var, const struct block *var_block,
return lang->read_var_value (var, var_block, frame);
}
+/* Calls VAR's language read_var_value hook with the given arguments. */
+
+struct value *
+read_var_value (block_symbol var, frame_info_ptr frame)
+{
+ const struct language_defn *lang = language_def (var.symbol->language ());
+
+ gdb_assert (lang != NULL);
+
+ return lang->read_var_value (var.symbol, var.block, frame);
+}
+
/* Install default attributes for register values. */
struct value *
@@ -8311,7 +8311,7 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
vsym = lookup_symbol_search_name (sym->search_name (),
b, VAR_DOMAIN);
- value = read_var_value (vsym.symbol, vsym.block, frame);
+ value = read_var_value (vsym, frame);
/* If the value was optimized out, revert to the old behavior. */
if (! value->optimized_out ())
{
@@ -3711,17 +3711,16 @@ value_struct_elt_for_reference (struct type *domain, int offset,
if (TYPE_FN_FIELD_STATIC_P (f, j))
{
- struct symbol *s =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
- 0, VAR_DOMAIN, 0).symbol;
+ block_symbol s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
+ 0, VAR_DOMAIN, 0);
- if (s == NULL)
- return NULL;
+ if (s.symbol == nullptr)
+ return nullptr;
if (want_address)
- return value_addr (read_var_value (s, 0, 0));
+ return value_addr (read_var_value (s, 0));
else
- return read_var_value (s, 0, 0);
+ return read_var_value (s, 0);
}
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
@@ -3742,14 +3741,13 @@ value_struct_elt_for_reference (struct type *domain, int offset,
}
else
{
- struct symbol *s =
- lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
- 0, VAR_DOMAIN, 0).symbol;
+ block_symbol s = lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, j),
+ 0, VAR_DOMAIN, 0);
- if (s == NULL)
- return NULL;
+ if (s.symbol == nullptr)
+ return nullptr;
- struct value *v = read_var_value (s, 0, 0);
+ struct value *v = read_var_value (s, 0);
if (!want_address)
result = v;
else
@@ -4000,7 +3998,7 @@ value_of_this (const struct language_defn *lang)
error (_("current stack frame does not contain a variable named `%s'"),
lang->name_of_this ());
- return read_var_value (sym.symbol, sym.block, frame);
+ return read_var_value (sym, frame);
}
/* Return the value of the local variable, if one exists. Return NULL
@@ -1140,6 +1140,9 @@ extern struct value *read_var_value (struct symbol *var,
const struct block *var_block,
frame_info_ptr frame);
+extern struct value *read_var_value (block_symbol var,
+ frame_info_ptr frame);
+
extern struct value *allocate_repeat_value (struct type *type, int count);
extern struct value *value_mark (void);