* [patch] Code cleanup: Introduce allocate_optimized_out_value
@ 2011-07-12 21:09 Jan Kratochvil
2011-07-12 21:17 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2011-07-12 21:09 UTC (permalink / raw)
To: gdb-patches
Hi,
this is a code cleanup. Additionally it makes more optimized_out values lazy.
IIRC I had some compatibility problems before with it but I no longer see any
regressions, maybe since:
[patch 1/2] Make values more lazy if possible
http://sourceware.org/ml/gdb-patches/2011-01/msg00123.html
or thanks to some other patch.
allocate_optimized_out_value gets used more by my later entryval patch.
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
I will check it in in some time if no comments appear.
Thanks,
Jan
gdb/
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.
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1094,12 +1094,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
invalid_synthetic_pointer ();
if (size == 0)
- {
- retval = allocate_value (type);
- VALUE_LVAL (retval) = not_lval;
- set_value_optimized_out (retval, 1);
- return retval;
- }
+ return allocate_optimized_out_value (type);
baton.frame = frame;
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:
do_cleanups (value_chain);
- retval = allocate_value (type);
- VALUE_LVAL (retval) = not_lval;
- set_value_optimized_out (retval, 1);
+ retval = allocate_optimized_out_value (type);
break;
/* 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);
if (data == NULL)
- {
- val = allocate_value (SYMBOL_TYPE (symbol));
- VALUE_LVAL (val) = not_lval;
- set_value_optimized_out (val, 1);
- }
+ val = allocate_optimized_out_value (SYMBOL_TYPE (symbol));
else
val = dwarf2_evaluate_loc_desc (SYMBOL_TYPE (symbol), frame, data, size,
dlbaton->per_cu);
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -577,10 +577,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
break;
case LOC_OPTIMIZED_OUT:
- v = allocate_value_lazy (type);
- VALUE_LVAL (v) = not_lval;
- set_value_optimized_out (v, 1);
- return v;
+ return allocate_optimized_out_value (type);
default:
error (_("Cannot look up value of a botched symbol."));
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -728,6 +728,18 @@ allocate_computed_value (struct type *type,
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. */
struct value *
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -207,6 +207,8 @@ extern struct value *allocate_computed_value (struct type *type,
struct lval_funcs *funcs,
void *closure);
+extern struct value *allocate_optimized_out_value (struct type *type);
+
/* If VALUE is lval_computed, return its lval_funcs structure. */
extern struct lval_funcs *value_computed_funcs (struct value *value);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Code cleanup: Introduce allocate_optimized_out_value
2011-07-12 21:09 [patch] Code cleanup: Introduce allocate_optimized_out_value Jan Kratochvil
@ 2011-07-12 21:17 ` Tom Tromey
2011-07-12 21:37 ` Jan Kratochvil
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-07-12 21:17 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> this is a code cleanup. Additionally it makes more optimized_out values lazy.
Jan> IIRC I had some compatibility problems before with it but I no longer see any
Jan> regressions, maybe since:
Jan> [patch 1/2] Make values more lazy if possible
Jan> http://sourceware.org/ml/gdb-patches/2011-01/msg00123.html
Jan> or thanks to some other patch.
It looks ok to me.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Code cleanup: Introduce allocate_optimized_out_value
2011-07-12 21:17 ` Tom Tromey
@ 2011-07-12 21:37 ` Jan Kratochvil
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2011-07-12 21:37 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On Tue, 12 Jul 2011 23:10:02 +0200, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>
> Jan> this is a code cleanup. Additionally it makes more optimized_out values lazy.
> Jan> IIRC I had some compatibility problems before with it but I no longer see any
> Jan> regressions, maybe since:
> Jan> [patch 1/2] Make values more lazy if possible
> Jan> http://sourceware.org/ml/gdb-patches/2011-01/msg00123.html
> Jan> or thanks to some other patch.
>
> It looks ok to me.
It is true it would be definitely a bug in a code incompatible with such
change so one may rather fix that possible regression there.
Checked it in:
http://sourceware.org/ml/gdb-cvs/2011-07/msg00124.html
Thanks for the review,
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-12 21:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 21:09 [patch] Code cleanup: Introduce allocate_optimized_out_value Jan Kratochvil
2011-07-12 21:17 ` Tom Tromey
2011-07-12 21:37 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox