aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-04-30 21:13:49 +0000
committerDaniel Jacobowitz <drow@false.org>2008-04-30 21:13:49 +0000
commit9214ee5f5f55de5082571ea066ea6060497fa229 (patch)
tree6b661593eb61332347bf60ccafeb3be5d2ac5067 /gdb/valops.c
parent8d4e307105edd5f21154824fd5839896ae6e6d84 (diff)
downloadgdb-9214ee5f5f55de5082571ea066ea6060497fa229.zip
gdb-9214ee5f5f55de5082571ea066ea6060497fa229.tar.gz
gdb-9214ee5f5f55de5082571ea066ea6060497fa229.tar.bz2
* 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.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index b11a088..7f9868c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -611,12 +611,38 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
int
value_fetch_lazy (struct value *val)
{
- CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
- int length = TYPE_LENGTH (value_enclosing_type (val));
+ if (VALUE_LVAL (val) == lval_memory)
+ {
+ CORE_ADDR addr = VALUE_ADDRESS (val) + value_offset (val);
+ int length = TYPE_LENGTH (value_enclosing_type (val));
+
+ struct type *type = value_type (val);
+ if (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));
- struct type *type = value_type (val);
- if (length)
- read_memory (addr, value_contents_all_raw (val), length);
+ 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);
return 0;
@@ -1464,7 +1490,7 @@ search_struct_field (char *name, struct value *arg1, int offset,
VALUE_ADDRESS (v2) = VALUE_ADDRESS (arg1);
VALUE_FRAME_ID (v2) = VALUE_FRAME_ID (arg1);
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);
else
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);
slice = allocate_value (slice_type);
- if (value_lazy (array))
+ if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
set_value_lazy (slice, 1);
else
memcpy (value_contents_writeable (slice),