diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/ada-lang.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 16 | ||||
-rw-r--r-- | gdb/cp-valprint.c | 2 | ||||
-rw-r--r-- | gdb/eval.c | 2 | ||||
-rw-r--r-- | gdb/findvar.c | 2 | ||||
-rw-r--r-- | gdb/gnu-v2-abi.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/stack.c | 2 | ||||
-rw-r--r-- | gdb/valarith.c | 2 | ||||
-rw-r--r-- | gdb/valops.c | 4 | ||||
-rw-r--r-- | gdb/value.c | 22 | ||||
-rw-r--r-- | gdb/value.h | 1 | ||||
-rw-r--r-- | gdb/varobj.c | 8 |
14 files changed, 42 insertions, 31 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c56d5e3..e2e38a2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2005-02-02 Andrew Cagney <cagney@gnu.org> + * value.h (value_lazy): Declare. + * varobj.c, value.c, valops.c, valarith.c, printcmd.c: Update. + * cp-valprint.c, breakpoint.c, ada-lang.c: Update. + * value.h (VALUE_CONTENTS_ALL): Delete. (value_contents_all): Declare. * value.c (value_contents_all): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 97ffba8..3228fe5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -451,7 +451,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) result->bitsize = value_bitsize (val); result->bitpos = value_bitpos (val); VALUE_ADDRESS (result) = VALUE_ADDRESS (val) + value_offset (val); - if (VALUE_LAZY (val) + if (value_lazy (val) || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val))) VALUE_LAZY (result) = 1; else @@ -1811,7 +1811,7 @@ ada_value_primitive_packed_val (struct value *obj, const bfd_byte *valaddr, v = allocate_value (type); bytes = (unsigned char *) (valaddr + offset); } - else if (VALUE_LAZY (obj)) + else if (value_lazy (obj)) { v = value_at (type, VALUE_ADDRESS (obj) + value_offset (obj) + offset); diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index d92dbeb..bf8a29f 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -944,7 +944,7 @@ insert_bp_location (struct bp_location *bpt, its contents to evaluate the expression, then we must watch it. */ if (VALUE_LVAL (v) == lval_memory - && ! VALUE_LAZY (v)) + && ! value_lazy (v)) { struct type *vtype = check_typedef (value_type (v)); @@ -1123,7 +1123,7 @@ insert_breakpoints (void) struct value *val; val = evaluate_expression (b->owner->exp); release_value (val); - if (VALUE_LAZY (val)) + if (value_lazy (val)) value_fetch_lazy (val); b->owner->val = val; } @@ -1475,7 +1475,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is) /* For each memory reference remove the watchpoint at that address. */ if (VALUE_LVAL (v) == lval_memory - && ! VALUE_LAZY (v)) + && ! value_lazy (v)) { struct type *vtype = check_typedef (value_type (v)); @@ -2728,7 +2728,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid, int stopped_by_watchpoint) for (v = b->val_chain; v; v = v->next) { if (VALUE_LVAL (v) == lval_memory - && ! VALUE_LAZY (v)) + && ! value_lazy (v)) { struct type *vtype = check_typedef (value_type (v)); @@ -5619,7 +5619,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty) mark = value_mark (); val = evaluate_expression (exp); release_value (val); - if (VALUE_LAZY (val)) + if (value_lazy (val)) value_fetch_lazy (val); tok = arg; @@ -5793,7 +5793,7 @@ can_use_hardware_watchpoint (struct value *v) { if (VALUE_LVAL (v) == lval_memory) { - if (VALUE_LAZY (v)) + if (value_lazy (v)) /* A lazy memory lvalue is one that GDB never needed to fetch; we either just used its address (e.g., `a' in `a.b') or we never needed it at all (e.g., `a' in `a,b'). */ @@ -7116,7 +7116,7 @@ breakpoint_re_set_one (void *bint) } b->val = evaluate_expression (b->exp); release_value (b->val); - if (VALUE_LAZY (b->val) && breakpoint_enabled (b)) + if (value_lazy (b->val) && breakpoint_enabled (b)) value_fetch_lazy (b->val); if (b->cond_string != NULL) @@ -7472,7 +7472,7 @@ is valid is not currently in scope.\n", bpt->number); mark = value_mark (); bpt->val = evaluate_expression (bpt->exp); release_value (bpt->val); - if (VALUE_LAZY (bpt->val)) + if (value_lazy (bpt->val)) value_fetch_lazy (bpt->val); if (bpt->type == bp_hardware_watchpoint || diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index e90a2b5..4079b8f 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -781,7 +781,7 @@ cp_print_hpacc_virtual_table_entries (struct type *type, int *vfuncs, /* Get the address of the vfunction entry */ struct value *vf = value_copy (v); - if (VALUE_LAZY (vf)) + if (value_lazy (vf)) (void) value_fetch_lazy (vf); /* adjust by offset */ vf->aligner.contents[0] += 4 * (HP_ACC_VFUNC_START + vx); @@ -2143,7 +2143,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos, When used in contexts where arrays will be coerced anyway, this is equivalent to `evaluate_subexp' but much faster because it avoids actually fetching array contents (perhaps obsolete now that we have - VALUE_LAZY). + value_lazy()). Note that we currently only do the coercion for C expressions, where arrays are zero based and the coercion is correct. For other languages, diff --git a/gdb/findvar.c b/gdb/findvar.c index 5fc3685..94140d6 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -738,7 +738,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_lazy (lazy_value) || TYPE_CODE (type) == TYPE_CODE_FUNC) { struct value *val; diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index f545ac1..4d932c4 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -164,7 +164,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, /* Move the `this' pointer according to the virtual function table. */ arg1->offset += value_as_long (value_field (entry, 0)); - if (!VALUE_LAZY (arg1)) + if (!value_lazy (arg1)) { VALUE_LAZY (arg1) = 1; value_fetch_lazy (arg1); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index fb13ecb..1efd5d3 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1316,7 +1316,7 @@ x_command (char *exp, int from_tty) /* Make contents of last address examined available to the user as $__. */ /* If the last value has not been fetched from memory then don't fetch it now - instead mark it by voiding the $__ variable. */ - if (VALUE_LAZY (last_examine_value)) + if (value_lazy (last_examine_value)) set_internalvar (lookup_internalvar ("__"), allocate_value (builtin_type_void)); else diff --git a/gdb/stack.c b/gdb/stack.c index 2d8968c..aa0cb82 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1824,7 +1824,7 @@ return_command (char *retval_exp, int from_tty) /* Make sure the value is fully evaluated. It may live in the stack frame we're about to pop. */ - if (VALUE_LAZY (return_value)) + if (value_lazy (return_value)) value_fetch_lazy (return_value); if (TYPE_CODE (return_type) == TYPE_CODE_VOID) diff --git a/gdb/valarith.c b/gdb/valarith.c index 5233d08..5b21957 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -268,7 +268,7 @@ value_subscripted_rvalue (struct value *array, struct value *idx, int lowerbound error ("no such vector element"); v = allocate_value (elt_type); - if (VALUE_LAZY (array)) + if (value_lazy (array)) VALUE_LAZY (v) = 1; else memcpy (VALUE_CONTENTS (v), VALUE_CONTENTS (array) + elt_offs, elt_size); diff --git a/gdb/valops.c b/gdb/valops.c index 50b7e7c..442bb51 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1312,7 +1312,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); v2->offset = value_offset (arg1) + boffset; - if (VALUE_LAZY (arg1)) + if (value_lazy (arg1)) VALUE_LAZY (v2) = 1; else memcpy (value_contents_raw (v2), @@ -2763,7 +2763,7 @@ value_slice (struct value *array, int lowbound, int length) slice_range_type); TYPE_CODE (slice_type) = TYPE_CODE (array_type); slice = allocate_value (slice_type); - if (VALUE_LAZY (array)) + if (value_lazy (array)) VALUE_LAZY (slice) = 1; else memcpy (VALUE_CONTENTS (slice), VALUE_CONTENTS (array) + offset, diff --git a/gdb/value.c b/gdb/value.c index 690ef9a..3ff911c 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -95,7 +95,7 @@ allocate_value (struct type *type) val->bitpos = 0; val->bitsize = 0; VALUE_REGNUM (val) = -1; - VALUE_LAZY (val) = 0; + val->lazy = 0; VALUE_OPTIMIZED_OUT (val) = 0; VALUE_EMBEDDED_OFFSET (val) = 0; VALUE_POINTED_TO_OFFSET (val) = 0; @@ -173,6 +173,12 @@ value_contents_all (struct value *value) return value->aligner.contents; } +int +value_lazy (struct value *value) +{ + return value->lazy; +} + /* Return a mark in the value chain. All values allocated after the mark is obtained (except for those released) are subject to being freed @@ -276,12 +282,12 @@ value_copy (struct value *arg) val->bitsize = arg->bitsize; VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg); VALUE_REGNUM (val) = VALUE_REGNUM (arg); - VALUE_LAZY (val) = VALUE_LAZY (arg); + val->lazy = arg->lazy; VALUE_OPTIMIZED_OUT (val) = VALUE_OPTIMIZED_OUT (arg); VALUE_EMBEDDED_OFFSET (val) = VALUE_EMBEDDED_OFFSET (arg); VALUE_POINTED_TO_OFFSET (val) = VALUE_POINTED_TO_OFFSET (arg); val->modifiable = arg->modifiable; - if (!VALUE_LAZY (val)) + if (!value_lazy (val)) { memcpy (value_contents_all_raw (val), value_contents_all_raw (arg), TYPE_LENGTH (value_enclosing_type (arg))); @@ -306,7 +312,7 @@ record_latest_value (struct value *val) In particular, "set $1 = 50" should not affect the variable from which the value was taken, and fast watchpoints should be able to assume that a value on the value history never changes. */ - if (VALUE_LAZY (val)) + if (value_lazy (val)) value_fetch_lazy (val); /* We preserve VALUE_LVAL so that the user can find out where it was fetched from. This is a bit dubious, because then *&$1 does not just return $1 @@ -476,7 +482,7 @@ value_of_internalvar (struct internalvar *var) struct value *val; val = value_copy (var->value); - if (VALUE_LAZY (val)) + if (value_lazy (val)) value_fetch_lazy (val); VALUE_LVAL (val) = lval_internalvar; VALUE_INTERNALVAR (val) = var; @@ -507,7 +513,7 @@ set_internalvar (struct internalvar *var, struct value *val) /* Force the value to be fetched from the target now, to avoid problems later when this internalvar is referenced and the target is gone or has changed. */ - if (VALUE_LAZY (newval)) + if (value_lazy (newval)) value_fetch_lazy (newval); /* Begin code which must not call error(). If var->value points to @@ -962,7 +968,7 @@ value_primitive_field (struct value *arg1, int offset, bases, etc. */ v = allocate_value (value_enclosing_type (arg1)); v->type = type; - if (VALUE_LAZY (arg1)) + if (value_lazy (arg1)) VALUE_LAZY (v) = 1; else memcpy (value_contents_all_raw (v), value_contents_all_raw (arg1), @@ -978,7 +984,7 @@ value_primitive_field (struct value *arg1, int offset, /* Plain old data member */ offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; v = allocate_value (type); - if (VALUE_LAZY (arg1)) + if (value_lazy (arg1)) VALUE_LAZY (v) = 1; else memcpy (value_contents_raw (v), diff --git a/gdb/value.h b/gdb/value.h index ba435bc..7963bf1 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -179,6 +179,7 @@ extern int value_bitpos (struct value *); extern int value_offset (struct value *); extern struct type *value_enclosing_type (struct value *); +extern int value_lazy (struct value *); #define VALUE_LAZY(val) (val)->lazy /* VALUE_CONTENTS and value_contents_raw() both return the address of diff --git a/gdb/varobj.c b/gdb/varobj.c index d58c8bd..78bea7c 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -500,7 +500,7 @@ varobj_create (char *objname, { /* no error */ release_value (var->value); - if (VALUE_LAZY (var->value)) + if (value_lazy (var->value)) gdb_value_fetch_lazy (var->value); } else @@ -1686,7 +1686,7 @@ value_of_child (struct varobj *parent, int index) value = (*parent->root->lang->value_of_child) (parent, index); /* If we're being lazy, fetch the real value of the variable. */ - if (value != NULL && VALUE_LAZY (value)) + if (value != NULL && value_lazy (value)) { /* If we fail to fetch the value of the child, return NULL so that callers notice that we're leaving an @@ -1904,7 +1904,7 @@ c_value_of_root (struct varobj **var_handle) go on */ if (gdb_evaluate_expression (var->root->exp, &new_val)) { - if (VALUE_LAZY (new_val)) + if (value_lazy (new_val)) { /* We need to catch errors because if value_fetch_lazy fails we still want to continue @@ -2092,7 +2092,7 @@ c_value_of_variable (struct varobj *var) struct cleanup *old_chain = make_cleanup_ui_file_delete (stb); char *thevalue; - if (VALUE_LAZY (var->value)) + if (value_lazy (var->value)) gdb_value_fetch_lazy (var->value); val_print (value_type (var->value), value_contents_raw (var->value), 0, |