Code cleanup making also optimized out values lazy.
	* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use
	allocate_optimized_out_value.  Twice.
	(loclist_read_variable)  Use allocate_optimized_out_value.  Once.
	* findvar.c (read_var_value): Likewise.
	* value.c (allocate_optimized_out_value): New function.
	* value.h (allocate_optimized_out_value): New declaration.
This commit is contained in:
Jan Kratochvil
2011-07-12 21:16:48 +00:00
parent d07ed419cf
commit a7035dbbd1
5 changed files with 28 additions and 18 deletions

View File

@ -1,3 +1,13 @@
2011-07-12 Jan Kratochvil <jan.kratochvil@redhat.com>
Code cleanup making also optimized out values lazy.
* dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use
allocate_optimized_out_value. Twice.
(loclist_read_variable) Use allocate_optimized_out_value. Once.
* findvar.c (read_var_value): Likewise.
* value.c (allocate_optimized_out_value): New function.
* value.h (allocate_optimized_out_value): New declaration.
2011-07-12 Jan Kratochvil <jan.kratochvil@redhat.com> 2011-07-12 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix occasional crash of CTRL-C during DWARF read in. Fix occasional crash of CTRL-C during DWARF read in.

View File

@ -1094,12 +1094,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
invalid_synthetic_pointer (); invalid_synthetic_pointer ();
if (size == 0) if (size == 0)
{ return allocate_optimized_out_value (type);
retval = allocate_value (type);
VALUE_LVAL (retval) = not_lval;
set_value_optimized_out (retval, 1);
return retval;
}
baton.frame = frame; baton.frame = frame;
baton.per_cu = per_cu; baton.per_cu = per_cu;
@ -1247,9 +1242,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
case DWARF_VALUE_OPTIMIZED_OUT: case DWARF_VALUE_OPTIMIZED_OUT:
do_cleanups (value_chain); do_cleanups (value_chain);
retval = allocate_value (type); retval = allocate_optimized_out_value (type);
VALUE_LVAL (retval) = not_lval;
set_value_optimized_out (retval, 1);
break; break;
/* DWARF_VALUE_IMPLICIT_POINTER was converted to a pieced /* DWARF_VALUE_IMPLICIT_POINTER was converted to a pieced
@ -2829,11 +2822,7 @@ loclist_read_variable (struct symbol *symbol, struct frame_info *frame)
data = dwarf2_find_location_expression (dlbaton, &size, pc); data = dwarf2_find_location_expression (dlbaton, &size, pc);
if (data == NULL) if (data == NULL)
{ val = allocate_optimized_out_value (SYMBOL_TYPE (symbol));
val = allocate_value (SYMBOL_TYPE (symbol));
VALUE_LVAL (val) = not_lval;
set_value_optimized_out (val, 1);
}
else else
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size, val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
dlbaton->per_cu); dlbaton->per_cu);

View File

@ -577,10 +577,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
break; break;
case LOC_OPTIMIZED_OUT: case LOC_OPTIMIZED_OUT:
v = allocate_value_lazy (type); return allocate_optimized_out_value (type);
VALUE_LVAL (v) = not_lval;
set_value_optimized_out (v, 1);
return v;
default: default:
error (_("Cannot look up value of a botched symbol.")); error (_("Cannot look up value of a botched symbol."));

View File

@ -728,6 +728,18 @@ allocate_computed_value (struct type *type,
return v; return v;
} }
/* Allocate NOT_LVAL value for type TYPE being OPTIMIZED_OUT. */
struct value *
allocate_optimized_out_value (struct type *type)
{
struct value *retval = allocate_value_lazy (type);
set_value_optimized_out (retval, 1);
return retval;
}
/* Accessor methods. */ /* Accessor methods. */
struct value * struct value *

View File

@ -207,6 +207,8 @@ extern struct value *allocate_computed_value (struct type *type,
struct lval_funcs *funcs, struct lval_funcs *funcs,
void *closure); void *closure);
extern struct value *allocate_optimized_out_value (struct type *type);
/* If VALUE is lval_computed, return its lval_funcs structure. */ /* If VALUE is lval_computed, return its lval_funcs structure. */
extern struct lval_funcs *value_computed_funcs (struct value *value); extern struct lval_funcs *value_computed_funcs (struct value *value);