diff options
-rw-r--r-- | gdb/ada-lang.c | 8 | ||||
-rw-r--r-- | gdb/ada-valprint.c | 2 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/c-varobj.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2/loc.c | 2 | ||||
-rw-r--r-- | gdb/eval.c | 6 | ||||
-rw-r--r-- | gdb/f-lang.c | 8 | ||||
-rw-r--r-- | gdb/frame.c | 2 | ||||
-rw-r--r-- | gdb/gnu-v2-abi.c | 4 | ||||
-rw-r--r-- | gdb/guile/scm-pretty-print.c | 2 | ||||
-rw-r--r-- | gdb/guile/scm-value.c | 4 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 2 | ||||
-rw-r--r-- | gdb/printcmd.c | 2 | ||||
-rw-r--r-- | gdb/python/py-prettyprint.c | 2 | ||||
-rw-r--r-- | gdb/python/py-value.c | 4 | ||||
-rw-r--r-- | gdb/stack.c | 10 | ||||
-rw-r--r-- | gdb/valarith.c | 2 | ||||
-rw-r--r-- | gdb/valops.c | 6 | ||||
-rw-r--r-- | gdb/valprint.c | 2 | ||||
-rw-r--r-- | gdb/value.c | 52 | ||||
-rw-r--r-- | gdb/value.h | 39 | ||||
-rw-r--r-- | gdb/varobj.c | 16 |
22 files changed, 87 insertions, 96 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index baffea7..05f8c3f 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -557,7 +557,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) if (value_optimized_out (val)) result = allocate_optimized_out_value (type); - else if (value_lazy (val) + else if (val->lazy () /* Be careful not to make a lazy not_lval value. */ || (VALUE_LVAL (val) != not_lval && type->length () > val->type ()->length ())) @@ -2810,7 +2810,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, v = allocate_value (type); src = valaddr + offset; } - else if (VALUE_LVAL (obj) == lval_memory && value_lazy (obj)) + else if (VALUE_LVAL (obj) == lval_memory && obj->lazy ()) { int src_len = (bit_size + bit_offset + HOST_CHAR_BIT - 1) / 8; gdb_byte *buf; @@ -10852,7 +10852,7 @@ ada_var_msym_value_operation::evaluate_for_cast (struct type *expect_type, an address of the result of a cast (view conversion in Ada). */ if (VALUE_LVAL (val) == lval_memory) { - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); VALUE_LVAL (val) = not_lval; } @@ -10874,7 +10874,7 @@ ada_var_value_operation::evaluate_for_cast (struct type *expect_type, an address of the result of a cast (view conversion in Ada). */ if (VALUE_LVAL (val) == lval_memory) { - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); VALUE_LVAL (val) = not_lval; } diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index c1004b5..64d7ac1 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -982,7 +982,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr, if (ada_is_tagged_type (deref_val->type (), 1)) deref_val = ada_tag_value_at_base_address (deref_val); - if (value_lazy (deref_val)) + if (deref_val->lazy ()) value_fetch_lazy (deref_val); common_val_print (deref_val, stream, recurse + 1, diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b8490b0..0c36ec0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2076,7 +2076,7 @@ update_watchpoint (struct watchpoint *b, bool reparse) still lazy, that means an error occurred reading it; watch it anyway in case it becomes readable. */ if (VALUE_LVAL (v) == lval_memory - && (v == val_chain[0] || ! value_lazy (v))) + && (v == val_chain[0] || ! v->lazy ())) { struct type *vtype = check_typedef (v->type ()); @@ -10415,7 +10415,7 @@ can_use_hardware_watchpoint (const std::vector<value_ref_ptr> &vals) if (VALUE_LVAL (v) == lval_memory) { - if (v != head && value_lazy (v)) + if (v != head && v->lazy ()) /* A lazy memory lvalue in the chain 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' diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c index d517c79..0009424 100644 --- a/gdb/c-varobj.c +++ b/gdb/c-varobj.c @@ -506,14 +506,14 @@ c_value_of_variable (const struct varobj *var, } else { - if (var->not_fetched && value_lazy (var->value.get ())) + if (var->not_fetched && var->value.get ()->lazy ()) /* Frozen variable and no value yet. We don't implicitly fetch the value. MI response will use empty string for the value, which is OK. */ return std::string (); gdb_assert (varobj_value_is_changeable_p (var)); - gdb_assert (!value_lazy (var->value.get ())); + gdb_assert (!var->value.get ()->lazy ()); /* If the specified format is the current one, we can reuse print_value. */ diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 4af4dfd..e5b35b8 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -1366,7 +1366,7 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame, memcpy (value_contents_raw (val).data (), value_contents_raw (outer_val).data (), checked_type->length ()); - set_value_lazy (val, 0); + val->set_lazy (0); return val; } @@ -205,7 +205,7 @@ fetch_subexp_value (struct expression *exp, have a non-lazy previous value to compare with. */ if (result != NULL) { - if (!value_lazy (result)) + if (!result->lazy ()) *valp = result; else { @@ -2877,7 +2877,7 @@ var_msym_value_operation::evaluate_for_cast (struct type *to_type, /* Don't allow e.g. '&(int)var_with_no_debug_info'. */ if (VALUE_LVAL (val) == lval_memory) { - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); VALUE_LVAL (val) = not_lval; } @@ -2898,7 +2898,7 @@ var_value_operation::evaluate_for_cast (struct type *to_type, /* Don't allow e.g. '&(int)var_with_no_debug_info'. */ if (VALUE_LVAL (val) == lval_memory) { - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); VALUE_LVAL (val) = not_lval; } diff --git a/gdb/f-lang.c b/gdb/f-lang.c index bf2471a..d88e81c 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -356,7 +356,7 @@ public: m_base_offset (base_offset), m_val (val) { - gdb_assert (!value_lazy (val)); + gdb_assert (!val->lazy ()); } /* Extract an element of ELT_TYPE at offset (M_BASE_OFFSET + ELT_OFF) @@ -1441,7 +1441,7 @@ fortran_undetermined::value_subarray (value *array, /* Now copy the elements from the original ARRAY into the packed array value DEST. */ struct value *dest = allocate_value (repacked_array_type); - if (value_lazy (array) + if (array->lazy () || (total_offset + array_slice_type->length () > check_typedef (array->type ())->length ())) { @@ -1466,7 +1466,7 @@ fortran_undetermined::value_subarray (value *array, the requested slice is outside the values content range then just create a new lazy value pointing at the memory where the contents we're looking for exist. */ - if (value_lazy (array) + if (array->lazy () || (total_offset + array_slice_type->length () > check_typedef (array->type ())->length ())) array = value_at_lazy (array_slice_type, @@ -1476,7 +1476,7 @@ fortran_undetermined::value_subarray (value *array, (array_slice_type, value_contents (array).data () + total_offset, value_address (array) + total_offset); } - else if (!value_lazy (array)) + else if (!array->lazy ()) array = value_from_component (array, array_slice_type, total_offset); else error (_("cannot subscript arrays that are not in memory")); diff --git a/gdb/frame.c b/gdb/frame.c index 61a7923..dd9d6bf 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1306,7 +1306,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum) else gdb_printf (&debug_file, " computed"); - if (value_lazy (value)) + if (value->lazy ()) gdb_printf (&debug_file, " lazy"); else { diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 632b46f..76dc719 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -161,9 +161,9 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, arg1->set_offset (arg1->offset () + value_as_long (value_field (entry, 0))); - if (!value_lazy (arg1)) + if (!arg1->lazy ()) { - set_value_lazy (arg1, 1); + arg1->set_lazy (1); value_fetch_lazy (arg1); } diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c index 3e93f35..7a680c0 100644 --- a/gdb/guile/scm-pretty-print.c +++ b/gdb/guile/scm-pretty-print.c @@ -965,7 +965,7 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang, enum ext_lang_rc result = EXT_LANG_RC_NOP; enum guile_string_repr_result print_result; - if (value_lazy (value)) + if (value->lazy ()) value_fetch_lazy (value); /* No pretty-printer support for unavailable values. */ diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c index 0d9e15a..5b9a4cf 100644 --- a/gdb/guile/scm-value.c +++ b/gdb/guile/scm-value.c @@ -1233,7 +1233,7 @@ gdbscm_value_lazy_p (SCM self) = vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct value *value = v_smob->value; - return scm_from_bool (value_lazy (value)); + return scm_from_bool (value->lazy ()); } /* (value-fetch-lazy! <gdb:value>) -> unspecified */ @@ -1247,7 +1247,7 @@ gdbscm_value_fetch_lazy_x (SCM self) return gdbscm_wrap ([=] { - if (value_lazy (value)) + if (value->lazy ()) value_fetch_lazy (value); return SCM_UNSPECIFIED; }); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index a796364..d6d1d0f 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -2462,7 +2462,7 @@ ppc_linux_nat_target::num_memory_accesses (const std::vector<value_ref_ptr> /* 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'). */ - if (!value_lazy (v)) + if (!v->lazy ()) found_memory_cnt++; } /* Other kinds of values are not fine. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index a1ad281..9e77bf1 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1943,7 +1943,7 @@ x_command (const char *exp, int from_tty) 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.get ())) + if (last_examine_value.get ()->lazy ()) clear_internalvar (lookup_internalvar ("__")); else set_internalvar (lookup_internalvar ("__"), last_examine_value.get ()); diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index 346395e..0bd54da 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -578,7 +578,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang, struct gdbarch *gdbarch = type->arch (); enum gdbpy_string_repr_result print_result; - if (value_lazy (value)) + if (value->lazy ()) value_fetch_lazy (value); /* No pretty-printer support for unavailable values. */ diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index c748a87..0e3bc69 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -1219,7 +1219,7 @@ valpy_get_is_lazy (PyObject *self, void *closure) try { - opt = value_lazy (value); + opt = value->lazy (); } catch (const gdb_exception &except) { @@ -1240,7 +1240,7 @@ valpy_fetch_lazy (PyObject *self, PyObject *args) try { - if (value_lazy (value)) + if (value->lazy ()) value_fetch_lazy (value); } catch (const gdb_exception &except) diff --git a/gdb/stack.c b/gdb/stack.c index 9e239ed..5efe024 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -580,9 +580,9 @@ read_frame_arg (const frame_print_options &fp_opts, { struct type *type = val->type (); - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); - if (value_lazy (entryval)) + if (entryval->lazy ()) value_fetch_lazy (entryval); if (value_contents_eq (val, 0, entryval, 0, type->length ())) @@ -599,12 +599,12 @@ read_frame_arg (const frame_print_options &fp_opts, struct type *type_deref; val_deref = coerce_ref (val); - if (value_lazy (val_deref)) + if (val_deref->lazy ()) value_fetch_lazy (val_deref); type_deref = val_deref->type (); entryval_deref = coerce_ref (entryval); - if (value_lazy (entryval_deref)) + if (entryval_deref->lazy ()) value_fetch_lazy (entryval_deref); /* If the reference addresses match but dereferenced @@ -2749,7 +2749,7 @@ return_command (const 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 (return_value->lazy ()) value_fetch_lazy (return_value); if (thisfun != NULL) diff --git a/gdb/valarith.c b/gdb/valarith.c index ae81ea5..98ccbc7 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -187,7 +187,7 @@ value_subscript (struct value *array, LONGEST index) Instead mock up a new one and give it the original address. */ struct type *elt_type = check_typedef (tarray->target_type ()); LONGEST elt_size = type_length_units (elt_type); - if (!value_lazy (array) + if (!array->lazy () && !value_bytes_available (array, elt_size * index, elt_size)) { struct value *val = allocate_value (elt_type); diff --git a/gdb/valops.c b/gdb/valops.c index 079b64d..1823b0b 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1343,7 +1343,7 @@ value_assign (struct value *toval, struct value *fromval) information, but its contents are updated from FROMVAL. This implies the returned value is not lazy, even if TOVAL was. */ val = value_copy (toval); - set_value_lazy (val, 0); + val->set_lazy (0); copy (value_contents (fromval), value_contents_raw (val)); /* We copy over the enclosing type and pointed-to offset from FROMVAL @@ -1406,7 +1406,7 @@ address_of_variable (struct symbol *var, const struct block *b) val = value_of_variable (var, b); type = val->type (); - if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) + if ((VALUE_LVAL (val) == lval_memory && val->lazy ()) || type->code () == TYPE_CODE_FUNC) { CORE_ADDR addr = value_address (val); @@ -4078,7 +4078,7 @@ value_slice (struct value *array, int lowbound, int length) slice_range_type); slice_type->set_code (array_type->code ()); - if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) + if (VALUE_LVAL (array) == lval_memory && array->lazy ()) slice = allocate_value_lazy (slice_type); else { diff --git a/gdb/valprint.c b/gdb/valprint.c index db718f3..8a41479 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1043,7 +1043,7 @@ common_val_print (struct value *value, struct ui_file *stream, int recurse, get a fixed representation of our value. */ value = ada_to_fixed_value (value); - if (value_lazy (value)) + if (value->lazy ()) value_fetch_lazy (value); struct value_print_options local_opts = *options; diff --git a/gdb/value.c b/gdb/value.c index c56e040..cb16901 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1018,7 +1018,7 @@ allocate_optimized_out_value (struct type *type) struct value *retval = allocate_value_lazy (type); mark_value_bytes_optimized_out (retval, 0, type->length ()); - set_value_lazy (retval, 0); + retval->set_lazy (0); return retval; } @@ -1292,18 +1292,6 @@ value_contents_copy (struct value *dst, LONGEST dst_offset, } int -value_lazy (const struct value *value) -{ - return value->m_lazy; -} - -void -set_value_lazy (struct value *value, int val) -{ - value->m_lazy = val; -} - -int value_stack (const struct value *value) { return value->m_stack; @@ -1607,7 +1595,7 @@ value_copy (const value *arg) val->m_parent = arg->m_parent; val->m_limited_length = arg->m_limited_length; - if (!value_lazy (val) + if (!val->lazy () && !(value_entirely_optimized_out (val) || value_entirely_unavailable (val))) { @@ -1740,7 +1728,7 @@ set_value_component_location (struct value *component, change to how values work in GDB. */ if (VALUE_LVAL (component) == lval_internalvar_component) { - gdb_assert (value_lazy (component)); + gdb_assert (component->lazy ()); VALUE_LVAL (component) = lval_memory; } else @@ -1764,7 +1752,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 (val->lazy ()) { /* We know that this is a _huge_ array, any attempt to fetch this is going to cause GDB to throw an error. However, to allow @@ -2150,7 +2138,7 @@ value_of_internalvar (struct gdbarch *gdbarch, struct internalvar *var) case INTERNALVAR_VALUE: val = value_copy (var->u.value); - if (value_lazy (val)) + if (val->lazy ()) value_fetch_lazy (val); break; @@ -2290,7 +2278,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 (copy)) + if (copy->lazy ()) value_fetch_lazy (copy); /* Release the value from the value chain to prevent it from being @@ -3003,7 +2991,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, + offset + (bitpos - v->m_bitpos) / 8); v->set_parent (arg1); - if (!value_lazy (arg1)) + if (!arg1->lazy ()) value_fetch_lazy (v); } else if (fieldno < TYPE_N_BASECLASSES (arg_type)) @@ -3014,7 +3002,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, LONGEST boffset; /* Lazy register values with offsets are not supported. */ - if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) + if (VALUE_LVAL (arg1) == lval_register && arg1->lazy ()) value_fetch_lazy (arg1); /* We special case virtual inheritance here because this @@ -3029,7 +3017,7 @@ value_primitive_field (struct value *arg1, LONGEST offset, else boffset = arg_type->field (fieldno).loc_bitpos () / 8; - if (value_lazy (arg1)) + if (arg1->lazy ()) v = allocate_value_lazy (arg1->enclosing_type ()); else { @@ -3059,10 +3047,10 @@ value_primitive_field (struct value *arg1, LONGEST offset, / (HOST_CHAR_BIT * unit_size)); /* Lazy register values with offsets are not supported. */ - if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) + if (VALUE_LVAL (arg1) == lval_register && arg1->lazy ()) value_fetch_lazy (arg1); - if (value_lazy (arg1)) + if (arg1->lazy ()) v = allocate_value_lazy (type); else { @@ -3664,7 +3652,7 @@ value_from_component (struct value *whole, struct type *type, LONGEST offset) { struct value *v; - if (VALUE_LVAL (whole) == lval_memory && value_lazy (whole)) + if (VALUE_LVAL (whole) == lval_memory && whole->lazy ()) v = allocate_value_lazy (type); else { @@ -3685,7 +3673,7 @@ struct value * value_from_component_bitsize (struct value *whole, struct type *type, LONGEST bit_offset, LONGEST bit_length) { - gdb_assert (!value_lazy (whole)); + gdb_assert (!whole->lazy ()); /* Preserve lvalue-ness if possible. This is needed to avoid array-printing failures (including crashes) when printing Ada @@ -3865,7 +3853,7 @@ value_fetch_lazy_bitfield (struct value *val) value have been fetched. */ struct value *parent = val->parent (); - if (value_lazy (parent)) + if (parent->lazy ()) value_fetch_lazy (parent); unpack_value_bitfield (val, val->bitpos (), val->bitsize (), @@ -3916,7 +3904,7 @@ value_fetch_lazy_register (struct value *val) refer to the entire register. */ gdb_assert (val->offset () == 0); - while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val)) + while (VALUE_LVAL (new_val) == lval_register && new_val->lazy ()) { struct frame_id next_frame_id = VALUE_NEXT_FRAME_ID (new_val); @@ -3952,19 +3940,19 @@ value_fetch_lazy_register (struct value *val) any case, it should always be an internal error to end up in this situation. */ if (VALUE_LVAL (new_val) == lval_register - && value_lazy (new_val) + && new_val->lazy () && VALUE_NEXT_FRAME_ID (new_val) == next_frame_id) internal_error (_("infinite loop while fetching a register")); } /* If it's still lazy (for instance, a saved register on the stack), fetch it. */ - if (value_lazy (new_val)) + if (new_val->lazy ()) value_fetch_lazy (new_val); /* Copy the contents and the unavailability/optimized-out meta-data from NEW_VAL to VAL. */ - set_value_lazy (val, 0); + val->set_lazy (0); value_contents_copy (val, val->embedded_offset (), new_val, new_val->embedded_offset (), type_length_units (type)); @@ -4031,7 +4019,7 @@ value_fetch_lazy_register (struct value *val) void value_fetch_lazy (struct value *val) { - gdb_assert (value_lazy (val)); + gdb_assert (val->lazy ()); allocate_value_contents (val, true); /* A value is either lazy, or fully fetched. The availability/validity is only established as we try to fetch a @@ -4054,7 +4042,7 @@ value_fetch_lazy (struct value *val) else internal_error (_("Unexpected lazy value type.")); - set_value_lazy (val, 0); + val->set_lazy (0); } /* Implementation of the convenience function $_isvoid. */ diff --git a/gdb/value.h b/gdb/value.h index d27ac7c..80946c0 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -227,6 +227,27 @@ struct value void set_embedded_offset (LONGEST val) { m_embedded_offset = val; } + /* If zero, contents of this value are in the contents field. If + nonzero, contents are in inferior. If the lval field is lval_memory, + the contents are in inferior memory at location.address plus offset. + The lval field may also be lval_register. + + WARNING: This field is used by the code which handles watchpoints + (see breakpoint.c) to decide whether a particular value can be + watched by hardware watchpoints. If the lazy flag is set for some + member of a value chain, it is assumed that this member of the + chain doesn't need to be watched as part of watching the value + itself. This is how GDB avoids watching the entire struct or array + when the user wants to watch a single struct member or array + element. If you ever change the way lazy flag is set and reset, be + sure to consider this use as well! */ + + int lazy () const + { return m_lazy; } + + void set_lazy (int val) + { m_lazy = val; } + /* If a value represents a C++ object, then the `type' field gives the object's compile-time type. If the object actually belongs to some @@ -547,24 +568,6 @@ extern const struct lval_funcs *value_computed_funcs (const struct value *); extern void *value_computed_closure (const struct value *value); -/* If zero, contents of this value are in the contents field. If - nonzero, contents are in inferior. If the lval field is lval_memory, - the contents are in inferior memory at location.address plus offset. - The lval field may also be lval_register. - - WARNING: This field is used by the code which handles watchpoints - (see breakpoint.c) to decide whether a particular value can be - watched by hardware watchpoints. If the lazy flag is set for some - member of a value chain, it is assumed that this member of the - chain doesn't need to be watched as part of watching the value - itself. This is how GDB avoids watching the entire struct or array - when the user wants to watch a single struct member or array - element. If you ever change the way lazy flag is set and reset, be - sure to consider this use as well! */ - -extern int value_lazy (const struct value *); -extern void set_value_lazy (struct value *value, int val); - extern int value_stack (const struct value *); extern void set_value_stack (struct value *value, int val); diff --git a/gdb/varobj.c b/gdb/varobj.c index fb846fd..0e023c0 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -504,7 +504,7 @@ varobj_set_display_format (struct varobj *var, } if (varobj_value_is_changeable_p (var) - && var->value != nullptr && !value_lazy (var->value.get ())) + && var->value != nullptr && !var->value.get ()->lazy ()) { var->print_value = varobj_value_get_print_value (var->value.get (), var->format, var); @@ -1007,7 +1007,7 @@ varobj_set_value (struct varobj *var, const char *expression) gdb_assert (varobj_value_is_changeable_p (var)); /* The value of a changeable variable object must not be lazy. */ - gdb_assert (!value_lazy (var->value.get ())); + gdb_assert (!var->value.get ()->lazy ()); /* Need to coerce the input. We want to check if the value of the variable object will be different @@ -1247,7 +1247,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial) that is we'll be comparing values of this type, fetch the value now. Otherwise, on the next update the old value will be lazy, which means we've lost that old value. */ - if (need_to_fetch && value && value_lazy (value)) + if (need_to_fetch && value && value->lazy ()) { const struct varobj *parent = var->parent; bool frozen = var->frozen; @@ -1292,7 +1292,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial) lazy -- if it is, the code above has decided that the value should not be fetched. */ std::string print_value; - if (value != NULL && !value_lazy (value) + if (value != NULL && !value->lazy () && var->dynamic->pretty_printer == NULL) print_value = varobj_value_get_print_value (value, var->format, var); @@ -1312,7 +1312,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial) { /* Try to compare the values. That requires that both values are non-lazy. */ - if (var->not_fetched && value_lazy (var->value.get ())) + if (var->not_fetched && var->value.get ()->lazy ()) { /* This is a frozen varobj and the value was never read. Presumably, UI shows some "never read" indicator. @@ -1330,8 +1330,8 @@ install_new_value (struct varobj *var, struct value *value, bool initial) } else { - gdb_assert (!value_lazy (var->value.get ())); - gdb_assert (!value_lazy (value)); + gdb_assert (!var->value.get ()->lazy ()); + gdb_assert (!value->lazy ()); gdb_assert (!var->print_value.empty () && !print_value.empty ()); if (var->print_value != print_value) @@ -1351,7 +1351,7 @@ install_new_value (struct varobj *var, struct value *value, bool initial) /* We must always keep the new value, since children depend on it. */ var->value = value_holder; - if (value && value_lazy (value) && intentionally_not_fetched) + if (value && value->lazy () && intentionally_not_fetched) var->not_fetched = true; else var->not_fetched = false; |