mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
* eval.c (evaluate_subexp_for_address): Clarify error message.
Use value_must_coerce_to_target. * infcall.c (value_arg_coerce): Call value_coerce_to_target. * valops.c (value_assign): Call value_coerce_to_target when assigning to anything but internalvars. Leave GDB-side arrays as arrays when assigning to internalvars. (value_must_coerce_to_target, value_coerce_to_target): New. (value_coerce_array, value_addr): Call value_coerce_to_target. (value_array): Create the array in GDB's memory instead of the inferior's. * value.h (value_must_coerce_to_target, value_coerce_to_target): Declare. * gdb.texinfo (Expressions): Update description of malloced arrays. * gdb.base/printcmds.exp (test_print_array_constants): Do not expect *& to work on created array elements. (Top level): Test print $pc with a file. Test string operations without a target. * gdb.base/ptype.exp: Do not expect *& to work on created array elements.
This commit is contained in:
@@ -2204,14 +2204,14 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
|
||||
{
|
||||
struct type *type = check_typedef (value_type (x));
|
||||
|
||||
if (VALUE_LVAL (x) == lval_memory)
|
||||
if (VALUE_LVAL (x) == lval_memory || value_must_coerce_to_target (x))
|
||||
return value_zero (lookup_pointer_type (value_type (x)),
|
||||
not_lval);
|
||||
else if (TYPE_CODE (type) == TYPE_CODE_REF)
|
||||
return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
|
||||
not_lval);
|
||||
else
|
||||
error (_("Attempt to take address of non-lval"));
|
||||
error (_("Attempt to take address of value not located in memory."));
|
||||
}
|
||||
return value_addr (x);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user