+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * parse.c (parser_state::push_symbol, parser_state::push_dollar):
+ Update.
+ * p-exp.y (variable): Update.
+ * go-exp.y (variable): Update.
+ * expprint.c (dump_for_expression): Use bound_minimal_symbol.
+ Remove overload for objfile.
+ * expop.h (eval_op_var_msym_value): Use bound_minimal_symbol
+ parameter.
+ (check_objfile): Likewise.
+ (dump_for_expression): Likewise. Remove overload for objfile.
+ (class var_msym_value_operation): Use bound_minimal_symbol.
+ * eval.c (eval_op_var_msym_value): Use bound_minimal_symbol
+ parameter.
+ (var_msym_value_operation::evaluate_for_address)
+ (var_msym_value_operation::evaluate_for_sizeof)
+ (var_msym_value_operation::evaluate_for_cast): Update.
+ * d-exp.y (PrimaryExpression): Update.
+ * c-exp.y (variable): Update.
+ * ax-gdb.c (var_msym_value_operation::do_generate_ax): Update.
+ * ada-lang.c (ada_var_msym_value_operation::evaluate_for_cast):
+ Update.
+ * ada-exp.y (write_var_or_type): Update.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* parser-defs.h (exp_uses_objfile): Return bool.
= ada_lookup_simple_minsym (encoded_name);
if (msym.minsym != NULL)
{
- par_state->push_new<ada_var_msym_value_operation>
- (msym.minsym, msym.objfile);
+ par_state->push_new<ada_var_msym_value_operation> (msym);
/* Maybe cause error here rather than later? FIXME? */
write_selectors (par_state, encoded_name + tail_index);
return NULL;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (expect_type, not_lval);
- value *val = evaluate_var_msym_value (noside,
- std::get<1> (m_storage),
- std::get<0> (m_storage));
+ const bound_minimal_symbol &b = std::get<0> (m_storage);
+ value *val = evaluate_var_msym_value (noside, b.objfile, b.minsym);
val = ada_value_cast (expect_type, val);
struct axs_value *value,
struct type *cast_type)
{
- gen_msym_var_ref (ax, value, std::get<0> (m_storage),
- std::get<1> (m_storage));
+ const bound_minimal_symbol &b = std::get<0> (m_storage);
+ gen_msym_var_ref (ax, value, b.minsym, b.objfile);
if (value->type->code () == TYPE_CODE_ERROR)
{
if (cast_type == nullptr)
- error_unknown_type (std::get<0> (m_storage)->linkage_name ());
+ error_unknown_type (b.minsym->linkage_name ());
value->type = cast_type;
}
}
= find_gnu_ifunc (sym.symbol);
if (resolver.minsym != NULL)
pstate->push_new<var_msym_value_operation>
- (resolver.minsym, resolver.objfile);
+ (resolver);
else
pstate->push_new<var_value_operation>
(sym.symbol, sym.block);
(alias_target, SYMBOL_BLOCK_VALUE (alias_target));
else
pstate->push_new<var_msym_value_operation>
- (msymbol.minsym, msymbol.objfile);
+ (msymbol);
}
}
;
/* Lookup foreign name in global static symbols. */
msymbol = lookup_bound_minimal_symbol (copy.c_str ());
if (msymbol.minsym != NULL)
- pstate->push_new<var_msym_value_operation>
- (msymbol.minsym, msymbol.objfile);
+ pstate->push_new<var_msym_value_operation> (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command"));
else
struct value *
eval_op_var_msym_value (struct type *expect_type, struct expression *exp,
enum noside noside, bool outermost_p,
- minimal_symbol *msymbol, struct objfile *objfile)
+ bound_minimal_symbol msymbol)
{
- value *val = evaluate_var_msym_value (noside, objfile, msymbol);
+ value *val = evaluate_var_msym_value (noside, msymbol.objfile,
+ msymbol.minsym);
struct type *type = value_type (val);
if (type->code () == TYPE_CODE_ERROR
&& (noside != EVAL_AVOID_SIDE_EFFECTS || !outermost_p))
- error_unknown_type (msymbol->print_name ());
+ error_unknown_type (msymbol.minsym->print_name ());
return val;
}
var_msym_value_operation::evaluate_for_address (struct expression *exp,
enum noside noside)
{
- value *val = evaluate_var_msym_value (noside,
- std::get<1> (m_storage),
- std::get<0> (m_storage));
+ const bound_minimal_symbol &b = std::get<0> (m_storage);
+ value *val = evaluate_var_msym_value (noside, b.objfile, b.minsym);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type = lookup_pointer_type (value_type (val));
enum noside noside)
{
- minimal_symbol *msymbol = std::get<0> (m_storage);
- value *mval = evaluate_var_msym_value (noside,
- std::get<1> (m_storage),
- msymbol);
+ const bound_minimal_symbol &b = std::get<0> (m_storage);
+ value *mval = evaluate_var_msym_value (noside, b.objfile, b.minsym);
struct type *type = value_type (mval);
if (type->code () == TYPE_CODE_ERROR)
- error_unknown_type (msymbol->print_name ());
+ error_unknown_type (b.minsym->print_name ());
/* FIXME: This should be size_t. */
struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (to_type, not_lval);
- value *val = evaluate_var_msym_value (noside,
- std::get<1> (m_storage),
- std::get<0> (m_storage));
+ const bound_minimal_symbol &b = std::get<0> (m_storage);
+ value *val = evaluate_var_msym_value (noside, b.objfile, b.minsym);
val = value_cast (to_type, val);
struct expression *exp,
enum noside noside,
bool outermost_p,
- minimal_symbol *msymbol,
- struct objfile *objfile);
+ bound_minimal_symbol msymbol);
extern struct value *eval_op_var_entry_value (struct type *expect_type,
struct expression *exp,
enum noside noside, symbol *sym);
}
static inline bool
-check_objfile (minimal_symbol *minsym, struct objfile *objfile)
+check_objfile (bound_minimal_symbol minsym, struct objfile *objfile)
{
- /* This may seem strange but minsyms are only used with an objfile
- as well. */
- return false;
+ return check_objfile (minsym.objfile, objfile);
}
static inline bool
extern void dump_for_expression (struct ui_file *stream, int depth,
symbol *sym);
extern void dump_for_expression (struct ui_file *stream, int depth,
- minimal_symbol *msym);
+ bound_minimal_symbol msym);
extern void dump_for_expression (struct ui_file *stream, int depth,
const block *bl);
extern void dump_for_expression (struct ui_file *stream, int depth,
enum c_string_type_values flags);
extern void dump_for_expression (struct ui_file *stream, int depth,
enum range_flag flags);
-extern void dump_for_expression (struct ui_file *stream, int depth,
- objfile *objf);
extern void dump_for_expression (struct ui_file *stream, int depth,
const std::unique_ptr<ada_component> &comp);
}
static inline bool
-check_constant (struct minimal_symbol *msym)
+check_constant (bound_minimal_symbol msym)
{
return false;
}
return true;
}
-static inline bool
-check_constant (struct objfile *objfile)
-{
- return true;
-}
-
static inline bool
check_constant (ULONGEST cst)
{
};
class var_msym_value_operation
- : public maybe_constant_operation<minimal_symbol *, struct objfile *>
+ : public maybe_constant_operation<bound_minimal_symbol>
{
public:
enum noside noside) override
{
return eval_op_var_msym_value (expect_type, exp, noside, m_outermost,
- std::get<0> (m_storage),
- std::get<1> (m_storage));
+ std::get<0> (m_storage));
}
value *evaluate_for_sizeof (struct expression *exp, enum noside noside)
enum noside noside,
const std::vector<operation_up> &args) override
{
- const char *name = std::get<0> (m_storage)->print_name ();
+ const char *name = std::get<0> (m_storage).minsym->print_name ();
return operation::evaluate_funcall (expect_type, exp, noside, name, args);
}
}
void
-dump_for_expression (struct ui_file *stream, int depth, minimal_symbol *msym)
+dump_for_expression (struct ui_file *stream, int depth,
+ bound_minimal_symbol msym)
{
- fprintf_filtered (stream, _("%*sMinsym: %s\n"), depth, "",
- msym->print_name ());
+ fprintf_filtered (stream, _("%*sMinsym %s in objfile %s\n"), depth, "",
+ msym.minsym->print_name (), objfile_name (msym.objfile));
}
void
fputs_unfiltered ("\n", stream);
}
-void
-dump_for_expression (struct ui_file *stream, int depth, objfile *objf)
-{
- fprintf_filtered (stream, _("%*sObjfile: %s\n"), depth, "",
- objfile_name (objf));
-}
-
void
dump_for_expression (struct ui_file *stream, int depth,
enum range_flag flags)
lookup_bound_minimal_symbol (arg.c_str ());
if (msymbol.minsym != NULL)
pstate->push_new<var_msym_value_operation>
- (msymbol.minsym, msymbol.objfile);
+ (msymbol);
else if (!have_full_symbols ()
&& !have_partial_symbols ())
error (_("No symbol table is loaded. "
lookup_bound_minimal_symbol (arg.c_str ());
if (msymbol.minsym != NULL)
pstate->push_new<var_msym_value_operation>
- (msymbol.minsym, msymbol.objfile);
+ (msymbol);
else if (!have_full_symbols ()
&& !have_partial_symbols ())
error (_("No symbol table is loaded. "
{
struct bound_minimal_symbol msymbol = lookup_bound_minimal_symbol (name);
if (msymbol.minsym != NULL)
- push_new<expr::var_msym_value_operation> (msymbol.minsym,
- msymbol.objfile);
+ push_new<expr::var_msym_value_operation> (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
else
msym = lookup_bound_minimal_symbol (copy.c_str ());
if (msym.minsym)
{
- push_new<expr::var_msym_value_operation> (msym.minsym, msym.objfile);
+ push_new<expr::var_msym_value_operation> (msym);
return;
}