aboutsummaryrefslogtreecommitdiff
path: root/gdb/findvar.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/findvar.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/findvar.c')
-rw-r--r--gdb/findvar.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 4e1f6d1..69fb6fb 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -281,6 +281,30 @@ value_of_register (int regnum, struct frame_info *frame)
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
address it represents. */
CORE_ADDR
@@ -695,7 +719,7 @@ locate_var_value (struct symbol *var, struct frame_info *frame)
if (lazy_value == 0)
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)
{
struct value *val;