Re: [PATCH 03/12] Mark optimized out values as non-lazy.

Pedro Alves
2013-11-26T16:28:26Z

On 08/12/2013 01:20 PM, Andrew Burgess wrote:
> This is a re-posting of this patch:
> http://sourceware.org/ml/gdb-patches/2013-07/msg00058.html
>
> The patch was never rejected, it just ran out of steam. Pedro noticed
> that we could go beyond this patch and do more, even releasing the
> value contents when we spot values are fully optimized out. I agree,
> but believe that is a separate idea, that can always be added later,
> for this case we've not even allocated any value contents yet.
>
> OK to apply?

OK. I've pushed it (with you as author), with the commit log
below.

Thanks.

-----------
From: Andrew Burgess <aburgess@broadcom.com>

Mark entirely optimized out value as non-lazy.

If a value is entirely optimized out, then there's nothing for
value_fetch_lazy to fetch. Sequences like:

if (value_lazy (retval))
value_fetch_lazy (retval);

End up allocating the value contents buffer, wasting memory, for no
use.

gdb/ChangeLog
2013-11-26 Andrew Burgess <aburgess@broadcom.com>

* value.c (allocate_optimized_out_value): Mark value as non-lazy.
---

gdb/ChangeLog | 4 ++++
gdb/value.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7e28436..c144565 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-26 Andrew Burgess <aburgess@broadcom.com>
+
+ * value.c (allocate_optimized_out_value): Mark value as non-lazy.
+
2013-11-26 Tom Tromey <tromey@redhat.com>

* dwarf2-frame.c (dwarf2_frame_cache): Revert patch from
diff --git a/gdb/value.c b/gdb/value.c
index da7778f..8052f52 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -768,7 +768,7 @@ allocate_optimized_out_value (struct type *type)
struct value *retval = allocate_value_lazy (type);

set_value_optimized_out (retval, 1);
-
+ set_value_lazy (retval, 0);
return retval;
}