mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
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.
This commit is contained in:
12
gdb/value.c
12
gdb/value.c
@@ -332,12 +332,11 @@ allocate_computed_value (struct type *type,
|
||||
struct lval_funcs *funcs,
|
||||
void *closure)
|
||||
{
|
||||
struct value *v = allocate_value (type);
|
||||
struct value *v = allocate_value_lazy (type);
|
||||
|
||||
VALUE_LVAL (v) = lval_computed;
|
||||
v->location.computed.funcs = funcs;
|
||||
v->location.computed.closure = closure;
|
||||
set_value_lazy (v, 1);
|
||||
|
||||
return v;
|
||||
}
|
||||
@@ -2400,12 +2399,15 @@ value_from_contents_and_address (struct type *type,
|
||||
const gdb_byte *valaddr,
|
||||
CORE_ADDR address)
|
||||
{
|
||||
struct value *v = allocate_value (type);
|
||||
struct value *v;
|
||||
|
||||
if (valaddr == NULL)
|
||||
set_value_lazy (v, 1);
|
||||
v = allocate_value_lazy (type);
|
||||
else
|
||||
memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
|
||||
{
|
||||
v = allocate_value (type);
|
||||
memcpy (value_contents_raw (v), valaddr, TYPE_LENGTH (type));
|
||||
}
|
||||
set_value_address (v, address);
|
||||
VALUE_LVAL (v) = lval_memory;
|
||||
return v;
|
||||
|
||||
Reference in New Issue
Block a user