diff options
author | Sanimir Agovic <sagovic@sourceware.org> | 2013-08-29 12:25:03 +0000 |
---|---|---|
committer | Sanimir Agovic <sagovic@sourceware.org> | 2013-08-29 12:25:03 +0000 |
commit | 08039c9efdbe7602bfb0d1b4396a3f3a39130239 (patch) | |
tree | afe0ee66e5898cb06bffecb52789cc2bddd8abf3 /gdb/valops.c | |
parent | 314c7de970512fe51bcd24829306c4aee2ada762 (diff) | |
download | gdb-08039c9efdbe7602bfb0d1b4396a3f3a39130239.zip gdb-08039c9efdbe7602bfb0d1b4396a3f3a39130239.tar.gz gdb-08039c9efdbe7602bfb0d1b4396a3f3a39130239.tar.bz2 |
cleanup: use value_lazy_at instead of allocate_value_lazy/attribute setter
I came across a pattern used to construct a value in the following way:
struct value *val = allocate_value_lazy (type);
VALUE_LVAL (val) = lval_memory;
set_value_address (val, address);
Instead we fold the above call into:
value_at_lazy (type, addr);
2013-08-27 Sanimir Agovic <sanimir.agovic@intel.com>
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use value_at_lazy instead
of assembling value via allocate_value_lazy and attribute setter.
* findvar.c (default_read_var_value): Use value_at_lazy instead of
assembling value via allocate_value_lazy and attribute setter.
* valops.c (do_search_struct_field): Use value_at_lazy instead of
assembling value via allocate_value_lazy and attribute setter.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index f86b283..890735e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1950,14 +1950,12 @@ do_search_struct_field (const char *name, struct value *arg1, int offset, { CORE_ADDR base_addr; - v2 = allocate_value (basetype); base_addr = value_address (arg1) + boffset; + v2 = value_at_lazy (basetype, base_addr); if (target_read_memory (base_addr, value_contents_raw (v2), - TYPE_LENGTH (basetype)) != 0) + TYPE_LENGTH (value_type (basetype))) != 0) error (_("virtual baseclass botch")); - VALUE_LVAL (v2) = lval_memory; - set_value_address (v2, base_addr); } else { |