Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Cc: "Pedro Alves" <palves@redhat.com>
Subject: Re: [2/3] [PATCH] value_optimized_out and value_fetch_lazy
Date: Thu, 04 Jul 2013 11:23:00 -0000	[thread overview]
Message-ID: <51D55B11.2030100@broadcom.com> (raw)
In-Reply-To: <51D470E8.1080708@redhat.com>

On 03/07/2013 7:43 PM, Pedro Alves wrote:
> On 07/01/2013 07:06 PM, Andrew Burgess wrote:

>> Here's the improved patch, ok to apply?
> 
> OK, with ...
> 
>> gdb/ChangeLog
>>
>> 2013-07-01  Andrew Burgess  <aburgess@broadcom.com>
>>
>> 	* stack.c (read_frame_arg): No longer need to fetch lazy values,
>> 	checking for optimized out will ensure lazy values are loaded.
> 
> Write:
> 
>  	* stack.c (read_frame_arg): No longer fetch lazy values.
> 
>> 	* value.c (value_optimized_out): If the value is not already marked
>> 	optimized out, and is lazy then fetch it so we can know for sure
>> 	if the value is optimized out.
> 
> Write:
> 
>  	* value.c (value_optimized_out): If the value is not already marked
>  	optimized out, and is lazy then fetch it.
> 
> and put the "so we can know for sure if the value is optimized out." comment
> in the sources.
> 
>> 	(value_primitive_field): Move optimized out check later to later in
>> 	the function after we have loaded any lazy values.
> 
> "later to later" sounds like a later too much.  It'd be great to have a
> comment in the sources about this detail.
> 
>> 	(value_fetch_lazy): Use optimized out flag directly rather than
>> 	calling optimized_out method to avoid triggering recursion.
> 
> Write:
> 
> 	(value_fetch_lazy): Use optimized out flag directly rather than
>  	calling optimized_out method.
> 
> and put the "to avoid triggering recursion." comment in the sources.
> 

Applied with the following ChangeLog:

gdb/ChangeLog

	* stack.c (read_frame_arg): No longer fetch lazy values.
	* value.c (value_optimized_out): If the value is not already
	marked optimized out, and is lazy then fetch it.
	(value_primitive_field): Move optimized out check to later in the
	function, after we have loaded any lazy values.
	(value_fetch_lazy): Use optimized out flag directly rather than
	calling optimized_out method.

And these additional comments:

diff --git a/gdb/value.c b/gdb/value.c
index e3a60dd..abaf23b 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1054,6 +1054,8 @@ value_contents_equal (struct value *val1, struct value *val2)
 int
 value_optimized_out (struct value *value)
 {
+  /* We can only know if a value is optimized out once we have tried to
+     fetch it.  */
   if (!value->optimized_out && value->lazy)
     value_fetch_lazy (value);
 
@@ -2677,6 +2679,9 @@ value_primitive_field (struct value *arg1, int offset,
       if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
        value_fetch_lazy (arg1);
 
+      /* The optimized_out flag is only set correctly once a lazy value is
+         loaded, having just loaded some lazy values we should check the
+         optimized out case now.  */
       if (arg1->optimized_out)
        v = allocate_optimized_out_value (type);
       else
@@ -2715,6 +2720,9 @@ value_primitive_field (struct value *arg1, int offset,
       if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
        value_fetch_lazy (arg1);
 
+      /* The optimized_out flag is only set correctly once a lazy value is
+         loaded, having just loaded some lazy values we should check for
+         the optimized out case now.  */
       if (arg1->optimized_out)
        v = allocate_optimized_out_value (type);
       else if (value_lazy (arg1))
@@ -3541,6 +3549,9 @@ value_fetch_lazy (struct value *val)
   else if (VALUE_LVAL (val) == lval_computed
           && value_computed_funcs (val)->read != NULL)
     value_computed_funcs (val)->read (val);
+  /* Don't call value_optimized_out on val, doing so would result in a
+     recursive call back to value_fetch_lazy, instead check the
+     optimized_out flag directly.  */
   else if (val->optimized_out)
     /* Keep it optimized out.  */;
   else

Thanks,
Andrew


      reply	other threads:[~2013-07-04 11:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 12:46 Andrew Burgess
2013-06-19 15:55 ` Pedro Alves
2013-07-01 18:06   ` [3/3] " Andrew Burgess
2013-07-03 19:57     ` Pedro Alves
2013-07-04 16:41       ` Andrew Burgess
2013-07-04 17:08         ` Pedro Alves
2013-07-05  9:31           ` Pedro Alves
2013-07-05 10:56             ` Pedro Alves
2013-07-01 18:06   ` [1/3] " Andrew Burgess
2013-07-03 18:42     ` Pedro Alves
2013-07-04  9:51       ` Andrew Burgess
2013-07-01 18:06   ` [2/3] " Andrew Burgess
2013-07-03 18:43     ` Pedro Alves
2013-07-04 11:23       ` Andrew Burgess [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51D55B11.2030100@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox