mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
* ada-lang.c (ada_value_primitive_packed_val): Only check
value_lazy for memory lvals. * findvar.c (value_of_register_lazy): New function. (locate_var_value): Only check value_lazy for memory lvals. * valarith.c (value_subscripted_rvalue): Likewise. * valops.c (value_fetch_lazy): Handle both memory and register lvals. (search_struct_field, value_slice): Only check value_lazy for memory lvals. * value.c (struct value): Update comment for lazy. (value_primitive_field): Only check value_lazy for memory lvals. * value.h (value_lazy): Update comment. (value_of_register_lazy): Declare.
This commit is contained in:
@ -1,3 +1,19 @@
|
|||||||
|
2008-04-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* ada-lang.c (ada_value_primitive_packed_val): Only check
|
||||||
|
value_lazy for memory lvals.
|
||||||
|
* findvar.c (value_of_register_lazy): New function.
|
||||||
|
(locate_var_value): Only check value_lazy for memory lvals.
|
||||||
|
* valarith.c (value_subscripted_rvalue): Likewise.
|
||||||
|
* valops.c (value_fetch_lazy): Handle both memory and register
|
||||||
|
lvals.
|
||||||
|
(search_struct_field, value_slice): Only check value_lazy for memory
|
||||||
|
lvals.
|
||||||
|
* value.c (struct value): Update comment for lazy.
|
||||||
|
(value_primitive_field): Only check value_lazy for memory lvals.
|
||||||
|
* value.h (value_lazy): Update comment.
|
||||||
|
(value_of_register_lazy): Declare.
|
||||||
|
|
||||||
2008-04-30 Daniel Jacobowitz <dan@codesourcery.com>
|
2008-04-30 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* corefile.c (reopen_exec_file): Close any open files.
|
* corefile.c (reopen_exec_file): Close any open files.
|
||||||
|
@ -2039,7 +2039,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
|
|||||||
v = allocate_value (type);
|
v = allocate_value (type);
|
||||||
bytes = (unsigned char *) (valaddr + offset);
|
bytes = (unsigned char *) (valaddr + offset);
|
||||||
}
|
}
|
||||||
else if (value_lazy (obj))
|
else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj))
|
||||||
{
|
{
|
||||||
v = value_at (type,
|
v = value_at (type,
|
||||||
VALUE_ADDRESS (obj) + value_offset (obj) + offset);
|
VALUE_ADDRESS (obj) + value_offset (obj) + offset);
|
||||||
|
@ -281,6 +281,30 @@ value_of_register (int regnum, struct frame_info *frame)
|
|||||||
return reg_val;
|
return reg_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return a `value' with the contents of (virtual or cooked) register
|
||||||
|
REGNUM as found in the specified FRAME. The register's type is
|
||||||
|
determined by register_type(). The value is not fetched. */
|
||||||
|
|
||||||
|
struct value *
|
||||||
|
value_of_register_lazy (struct frame_info *frame, int regnum)
|
||||||
|
{
|
||||||
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
|
struct value *reg_val;
|
||||||
|
|
||||||
|
gdb_assert (regnum < (gdbarch_num_regs (gdbarch)
|
||||||
|
+ gdbarch_num_pseudo_regs (gdbarch)));
|
||||||
|
|
||||||
|
/* We should have a valid (i.e. non-sentinel) frame. */
|
||||||
|
gdb_assert (frame_id_p (get_frame_id (frame)));
|
||||||
|
|
||||||
|
reg_val = allocate_value (register_type (gdbarch, regnum));
|
||||||
|
VALUE_LVAL (reg_val) = lval_register;
|
||||||
|
VALUE_REGNUM (reg_val) = regnum;
|
||||||
|
VALUE_FRAME_ID (reg_val) = get_frame_id (frame);
|
||||||
|
set_value_lazy (reg_val, 1);
|
||||||
|
return reg_val;
|
||||||
|
}
|
||||||
|
|
||||||
/* Given a pointer of type TYPE in target form in BUF, return the
|
/* Given a pointer of type TYPE in target form in BUF, return the
|
||||||
address it represents. */
|
address it represents. */
|
||||||
CORE_ADDR
|
CORE_ADDR
|
||||||
@ -695,7 +719,7 @@ locate_var_value (struct symbol *var, struct frame_info *frame)
|
|||||||
if (lazy_value == 0)
|
if (lazy_value == 0)
|
||||||
error (_("Address of \"%s\" is unknown."), SYMBOL_PRINT_NAME (var));
|
error (_("Address of \"%s\" is unknown."), SYMBOL_PRINT_NAME (var));
|
||||||
|
|
||||||
if (value_lazy (lazy_value)
|
if ((VALUE_LVAL (lazy_value) == lval_memory && value_lazy (lazy_value))
|
||||||
|| TYPE_CODE (type) == TYPE_CODE_FUNC)
|
|| TYPE_CODE (type) == TYPE_CODE_FUNC)
|
||||||
{
|
{
|
||||||
struct value *val;
|
struct value *val;
|
||||||
|
@ -270,7 +270,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound
|
|||||||
error (_("no such vector element"));
|
error (_("no such vector element"));
|
||||||
|
|
||||||
v = allocate_value (elt_type);
|
v = allocate_value (elt_type);
|
||||||
if (value_lazy (array))
|
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
|
||||||
set_value_lazy (v, 1);
|
set_value_lazy (v, 1);
|
||||||
else
|
else
|
||||||
memcpy (value_contents_writeable (v),
|
memcpy (value_contents_writeable (v),
|
||||||
|
40
gdb/valops.c
40
gdb/valops.c
@ -611,12 +611,38 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
|
|||||||
int
|
int
|
||||||
value_fetch_lazy (struct value *val)
|
value_fetch_lazy (struct value *val)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
|
if (VALUE_LVAL (val) == lval_memory)
|
||||||
int length = TYPE_LENGTH (value_enclosing_type (val));
|
{
|
||||||
|
CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
|
||||||
|
int length = TYPE_LENGTH (value_enclosing_type (val));
|
||||||
|
|
||||||
struct type *type = value_type (val);
|
struct type *type = value_type (val);
|
||||||
if (length)
|
if (length)
|
||||||
read_memory (addr, value_contents_all_raw (val), length);
|
read_memory (addr, value_contents_all_raw (val), length);
|
||||||
|
}
|
||||||
|
else if (VALUE_LVAL (val) == lval_register)
|
||||||
|
{
|
||||||
|
struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (val));
|
||||||
|
int regnum = VALUE_REGNUM (val);
|
||||||
|
struct type *type = check_typedef (value_type (val));
|
||||||
|
|
||||||
|
gdb_assert (frame != NULL);
|
||||||
|
|
||||||
|
/* Convertible register routines are used for multi-register
|
||||||
|
values and for interpretation in different types (e.g. float
|
||||||
|
or int from a double register). Lazy register values should
|
||||||
|
have the register's natural type, so they do not apply. */
|
||||||
|
gdb_assert (!gdbarch_convert_register_p (get_frame_arch (frame), regnum,
|
||||||
|
type));
|
||||||
|
|
||||||
|
/* Get the data. */
|
||||||
|
if (!get_frame_register_bytes (frame, regnum, value_offset (val),
|
||||||
|
TYPE_LENGTH (value_type (val)),
|
||||||
|
value_contents_raw (val)))
|
||||||
|
set_value_optimized_out (val, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
internal_error (__FILE__, __LINE__, "Unexpected lazy value type.");
|
||||||
|
|
||||||
set_value_lazy (val, 0);
|
set_value_lazy (val, 0);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1464,7 +1490,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
|
|||||||
VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
|
VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
|
||||||
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
|
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
|
||||||
set_value_offset (v2, value_offset (arg1) + boffset);
|
set_value_offset (v2, value_offset (arg1) + boffset);
|
||||||
if (value_lazy (arg1))
|
if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
|
||||||
set_value_lazy (v2, 1);
|
set_value_lazy (v2, 1);
|
||||||
else
|
else
|
||||||
memcpy (value_contents_raw (v2),
|
memcpy (value_contents_raw (v2),
|
||||||
@ -2859,7 +2885,7 @@ value_slice (struct value *array, int lowbound, int length)
|
|||||||
TYPE_CODE (slice_type) = TYPE_CODE (array_type);
|
TYPE_CODE (slice_type) = TYPE_CODE (array_type);
|
||||||
|
|
||||||
slice = allocate_value (slice_type);
|
slice = allocate_value (slice_type);
|
||||||
if (value_lazy (array))
|
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
|
||||||
set_value_lazy (slice, 1);
|
set_value_lazy (slice, 1);
|
||||||
else
|
else
|
||||||
memcpy (value_contents_writeable (slice),
|
memcpy (value_contents_writeable (slice),
|
||||||
|
10
gdb/value.c
10
gdb/value.c
@ -137,9 +137,9 @@ struct value
|
|||||||
short regnum;
|
short regnum;
|
||||||
|
|
||||||
/* If zero, contents of this value are in the contents field. If
|
/* If zero, contents of this value are in the contents field. If
|
||||||
nonzero, contents are in inferior memory at address in the
|
nonzero, contents are in inferior. If the lval field is lval_memory,
|
||||||
location.address field plus the offset field (and the lval field
|
the contents are in inferior memory at location.address plus offset.
|
||||||
should be lval_memory).
|
The lval field may also be lval_register.
|
||||||
|
|
||||||
WARNING: This field is used by the code which handles watchpoints
|
WARNING: This field is used by the code which handles watchpoints
|
||||||
(see breakpoint.c) to decide whether a particular value can be
|
(see breakpoint.c) to decide whether a particular value can be
|
||||||
@ -1353,7 +1353,7 @@ value_primitive_field (struct value *arg1, int offset,
|
|||||||
bases, etc. */
|
bases, etc. */
|
||||||
v = allocate_value (value_enclosing_type (arg1));
|
v = allocate_value (value_enclosing_type (arg1));
|
||||||
v->type = type;
|
v->type = type;
|
||||||
if (value_lazy (arg1))
|
if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
|
||||||
set_value_lazy (v, 1);
|
set_value_lazy (v, 1);
|
||||||
else
|
else
|
||||||
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
|
memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1),
|
||||||
@ -1367,7 +1367,7 @@ value_primitive_field (struct value *arg1, int offset,
|
|||||||
/* Plain old data member */
|
/* Plain old data member */
|
||||||
offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
|
offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8;
|
||||||
v = allocate_value (type);
|
v = allocate_value (type);
|
||||||
if (value_lazy (arg1))
|
if (VALUE_LVAL (arg1) == lval_memory && value_lazy (arg1))
|
||||||
set_value_lazy (v, 1);
|
set_value_lazy (v, 1);
|
||||||
else
|
else
|
||||||
memcpy (value_contents_raw (v),
|
memcpy (value_contents_raw (v),
|
||||||
|
@ -135,9 +135,9 @@ extern int value_embedded_offset (struct value *value);
|
|||||||
extern void set_value_embedded_offset (struct value *value, int val);
|
extern void set_value_embedded_offset (struct value *value, int val);
|
||||||
|
|
||||||
/* If zero, contents of this value are in the contents field. If
|
/* If zero, contents of this value are in the contents field. If
|
||||||
nonzero, contents are in inferior memory at address in the
|
nonzero, contents are in inferior. If the lval field is lval_memory,
|
||||||
location.address field plus the offset field (and the lval field
|
the contents are in inferior memory at location.address plus offset.
|
||||||
should be lval_memory).
|
The lval field may also be lval_register.
|
||||||
|
|
||||||
WARNING: This field is used by the code which handles watchpoints
|
WARNING: This field is used by the code which handles watchpoints
|
||||||
(see breakpoint.c) to decide whether a particular value can be
|
(see breakpoint.c) to decide whether a particular value can be
|
||||||
@ -301,6 +301,8 @@ extern struct value *value_of_variable (struct symbol *var, struct block *b);
|
|||||||
|
|
||||||
extern struct value *value_of_register (int regnum, struct frame_info *frame);
|
extern struct value *value_of_register (int regnum, struct frame_info *frame);
|
||||||
|
|
||||||
|
struct value *value_of_register_lazy (struct frame_info *frame, int regnum);
|
||||||
|
|
||||||
extern int symbol_read_needs_frame (struct symbol *);
|
extern int symbol_read_needs_frame (struct symbol *);
|
||||||
|
|
||||||
extern struct value *read_var_value (struct symbol *var,
|
extern struct value *read_var_value (struct symbol *var,
|
||||||
|
Reference in New Issue
Block a user