@@ -11389,7 +11389,7 @@ get_var_value (const char *name, const char *err_msg)
error (("%s"), err_msg);
}
- return value_of_variable (syms[0].symbol, syms[0].block);
+ return value_of_variable (syms[0]);
}
/* Value of integer variable named NAME in the current environment.
@@ -627,7 +627,7 @@ compute_var_value (const char *name)
struct block_symbol sym = lookup_symbol (name, nullptr, VAR_DOMAIN,
nullptr);
if (sym.symbol != nullptr)
- return value_of_variable (sym.symbol, sym.block);
+ return value_of_variable (sym);
return nullptr;
}
@@ -532,7 +532,7 @@ evaluate_var_value (enum noside noside, block_symbol var)
try
{
- ret = value_of_variable (var.symbol, var.block);
+ ret = value_of_variable (var);
}
catch (const gdb_exception_error &except)
@@ -773,7 +773,7 @@ scope_operation::evaluate_funcall (struct type *expect_type,
find_overload_match (arg_view, nullptr,
NON_METHOD, nullptr, function,
nullptr, &symp, nullptr, 1, noside);
- callee = value_of_variable (symp.symbol, get_selected_block (0));
+ callee = value_of_variable (symp);
}
return evaluate_subexp_do_call (exp, noside, callee, arg_view,
@@ -2028,17 +2028,15 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
addr = value_as_long (ret);
if (addr)
{
- struct symbol *sym = NULL;
-
/* The address might point to a function descriptor;
resolve it to the actual code address instead. */
addr = gdbarch_convert_from_func_ptr_addr
(exp->gdbarch, addr, current_inferior ()->top_target ());
/* Is it a high_level symbol? */
- sym = find_pc_function (addr).symbol;
- if (sym != NULL)
- method = value_of_variable (sym, 0);
+ block_symbol sym = find_pc_function (addr);
+ if (sym.symbol != nullptr)
+ method = value_of_variable (sym);
}
/* If we found a method with symbol information, check to see
@@ -2668,7 +2666,7 @@ var_value_operation::evaluate_for_address (struct expression *exp,
return value::zero (type, not_lval);
}
else
- return address_of_variable (var, std::get<0> (m_storage).block);
+ return address_of_variable (std::get<0> (m_storage));
}
value *
@@ -2681,8 +2679,7 @@ var_value_operation::evaluate_with_coercion (struct expression *exp,
&& !type->is_vector ()
&& CAST_IS_CONVERSION (exp->language_defn))
{
- struct value *val = address_of_variable (var,
- std::get<0> (m_storage).block);
+ struct value *val = address_of_variable (std::get<0> (m_storage));
return value_cast (lookup_pointer_type (type->target_type ()), val);
}
return evaluate (nullptr, exp, noside);
@@ -556,7 +556,7 @@ f_language::value_print_inner (struct value *val, struct ui_file *stream,
if (sym.symbol == nullptr)
error (_("failed to find symbol for name list component %s"),
field_name);
- field = value_of_variable (sym.symbol, sym.block);
+ field = value_of_variable (sym);
}
else
field = value_field (val, index);
@@ -657,7 +657,7 @@ info_common_command_for_block (const struct block *block, const char *comname,
try
{
- val = value_of_variable (common->contents[index], block);
+ val = value_of_variable ({ common->contents[index], block });
value_print (val, gdb_stdout, &opts);
}
@@ -1065,7 +1065,7 @@ typy_template_argument (PyObject *self, PyObject *args)
try
{
scoped_value_mark free_values;
- struct value *val = value_of_variable (sym, block);
+ struct value *val = value_of_variable ({ sym, block });
result = value_to_value_object (val);
}
catch (const gdb_exception &except)
@@ -1574,7 +1574,7 @@ rust_structop::evaluate_funcall (struct type *expect_type,
if (fn_type->field (0).type ()->code () == TYPE_CODE_PTR)
args[0] = value_addr (args[0]);
- value *function = address_of_variable (sym.symbol, block);
+ value *function = address_of_variable (sym);
for (int i = 0; i < ops.size (); ++i)
args[i + 1] = ops[i]->evaluate (nullptr, exp, noside);
@@ -355,7 +355,7 @@ value_user_defined_cpp_op (gdb::array_view<value *> args, char *oper,
expect a reference as its first argument
rather the explicit structure. */
args[0] = value_ind (args[0]);
- return value_of_variable (symp.symbol, symp.block);
+ return value_of_variable (symp);
}
error (_("Could not find %s."), oper);
@@ -130,7 +130,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
if (objf_p)
*objf_p = sym.symbol->objfile ();
- return value_of_variable (sym.symbol, sym.block);
+ return value_of_variable (sym);
}
else
{
@@ -1383,26 +1383,27 @@ value_repeat (struct value *arg1, int count)
}
struct value *
-value_of_variable (struct symbol *var, const struct block *b)
+value_of_variable (block_symbol var)
{
frame_info_ptr frame = NULL;
- if (symbol_read_needs_frame (var))
+ if (symbol_read_needs_frame (var.symbol))
frame = get_selected_frame (_("No frame selected."));
- return read_var_value (var, b, frame);
+ return read_var_value (var, frame);
}
struct value *
-address_of_variable (struct symbol *var, const struct block *b)
+address_of_variable (block_symbol bvar)
{
+ symbol *var = bvar.symbol;
struct type *type = var->type ();
struct value *val;
/* Evaluate it first; if the result is a memory address, we're fine.
Lazy evaluation pays off here. */
- val = value_of_variable (var, b);
+ val = value_of_variable (bvar);
type = val->type ();
if ((val->lval () == lval_memory && val->lazy ())
@@ -3830,7 +3831,7 @@ value_maybe_namespace_elt (const struct type *curtype,
&& (sym.symbol->aclass () == LOC_TYPEDEF))
result = value::allocate (sym.symbol->type ());
else
- result = value_of_variable (sym.symbol, sym.block);
+ result = value_of_variable (sym);
if (want_address)
result = value_addr (result);
@@ -2897,7 +2897,7 @@ value_static_field (struct type *type, int fieldno)
retval = value_at_lazy (field_type, msym.value_address ());
}
else
- retval = value_of_variable (sym.symbol, sym.block);
+ retval = value_of_variable (sym);
break;
}
default:
@@ -1117,11 +1117,9 @@ extern struct value *value_from_register (struct type *type, int regnum,
extern CORE_ADDR address_from_register (int regnum,
frame_info_ptr frame);
-extern struct value *value_of_variable (struct symbol *var,
- const struct block *b);
+extern struct value *value_of_variable (block_symbol var);
-extern struct value *address_of_variable (struct symbol *var,
- const struct block *b);
+extern struct value *address_of_variable (block_symbol var);
extern struct value *value_of_register (int regnum, frame_info_ptr frame);