aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-01-12 16:10:05 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-01-12 16:10:05 +0000
commit41e8491fdf450e560451afb71c2d6c20708f78d6 (patch)
tree918ed00c8129ba9d9919af78235b8a462f2ee45c /gdb/valarith.c
parentb716877b54891ba162293f5ec6b6cd222f711e4d (diff)
downloadgdb-41e8491fdf450e560451afb71c2d6c20708f78d6.zip
gdb-41e8491fdf450e560451afb71c2d6c20708f78d6.tar.gz
gdb-41e8491fdf450e560451afb71c2d6c20708f78d6.tar.bz2
gdb/
Make value allocations more lazy. * ada-lang.c (coerce_unspec_val_to_type): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use allocate_value_lazy instead of allocate_value and set_value_lazy. * findvar.c (value_of_register_lazy): Likewise. (read_var_value): Remove V preallocation, call just check_typedef in advance. Move allocate_value to LOC_CONST, LOC_LABEL, LOC_CONST_BYTES. Use allocate_value_lazy in LOC_STATIC, LOC_ARG, LOC_REF_ARG, LOC_LOCAL, LOC_BLOCK. Set ADDR instead of set_value_address and break in LOC_BLOCK. Use allocate_value_lazy and remove lval_memory set in LOC_REGPARM_ADDR. Use allocate_value_lazy in LOC_UNRESOLVED and LOC_OPTIMIZED_OUT. Add setting lval_memory at the end, remove set_value_lazy there. * valarith.c (value_subscripted_rvalue): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible. * valops.c (value_fetch_lazy): Do nop for value_optimized_out VAL. * value.c (allocate_computed_value): Use allocate_value_lazy instead of allocate_value and set_value_lazy. (value_from_contents_and_address): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index a2bf7b0..265532c 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -205,12 +205,14 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound)
&& elt_offs >= TYPE_LENGTH (array_type)))
error (_("no such vector element"));
- v = allocate_value (elt_type);
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
- set_value_lazy (v, 1);
+ v = allocate_value_lazy (elt_type);
else
- memcpy (value_contents_writeable (v),
- value_contents (array) + elt_offs, elt_size);
+ {
+ v = allocate_value (elt_type);
+ memcpy (value_contents_writeable (v),
+ value_contents (array) + elt_offs, elt_size);
+ }
set_value_component_location (v, array);
VALUE_REGNUM (v) = VALUE_REGNUM (array);