case MEMORY_ERROR:
if (!preserve_errors)
break;
+ /* Fall through. */
default:
throw_exception (ex);
break;
evaluate_var_msym_value (enum noside noside,
struct objfile *objfile, minimal_symbol *msymbol)
{
- if (noside == EVAL_AVOID_SIDE_EFFECTS)
- {
- type *the_type = find_minsym_type_and_address (msymbol, objfile, NULL);
- return value_zero (the_type, not_lval);
- }
+ CORE_ADDR address;
+ type *the_type = find_minsym_type_and_address (msymbol, objfile, &address);
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS && !TYPE_GNU_IFUNC (the_type))
+ return value_zero (the_type, not_lval);
else
- {
- CORE_ADDR address;
- type *the_type = find_minsym_type_and_address (msymbol, objfile, &address);
- return value_at_lazy (the_type, address);
- }
+ return value_at_lazy (the_type, address);
}
/* Helper for returning a value when handling EVAL_SKIP. */
else if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
|| TYPE_CODE (ftype) == TYPE_CODE_METHOD)
{
+ if (TYPE_GNU_IFUNC (ftype))
+ {
+ CORE_ADDR address = value_address (argvec[0]);
+ type *resolved_type = find_gnu_ifunc_target_type (address);
+
+ if (resolved_type != NULL)
+ ftype = resolved_type;
+ }
+
type *return_type = TYPE_TARGET_TYPE (ftype);
if (return_type == 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,
- ¤t_target);
+ target_stack);
/* Is it a high_level symbol? */
sym = find_pc_function (addr);
}
return evaluate_subexp_for_sizeof (exp, pos, noside);
+ case UNOP_ALIGNOF:
+ {
+ struct type *type
+ = value_type (evaluate_subexp (NULL_TYPE, exp, pos,
+ EVAL_AVOID_SIDE_EFFECTS));
+ /* FIXME: This should be size_t. */
+ struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
+ ULONGEST align = type_align (type);
+ if (align == 0)
+ error (_("could not determine alignment of type"));
+ return value_from_longest (size_type, align);
+ }
+
case UNOP_CAST:
(*pos) += 2;
type = exp->elts[pc + 1].type;