Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Daniel Jacobowitz <drow@false.org>
Cc: Vladimir Prus <ghost@cs.msu.su>, gdb-patches@sources.redhat.com
Subject: Re: [PATCH] -var-update
Date: Sun, 21 May 2006 23:04:00 -0000	[thread overview]
Message-ID: <17519.63746.390090.274345@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20060521021243.GB9432@nevyn.them.org>

 > If you take a look at the code you're patching, there should be a
 > nearby call to value_fetch_lazy or gdb_value_fetch_lazy in each case.
 > You want to be calling coerce_ref before you do that.

OK.  Perhaps I called it after value_fetch_lazy.  

 > Try calling coerce_ref in here:
 > 
 >       if (gdb_evaluate_expression (var->root->exp, &var->value))
 >         {
 >           /* no error */
 > 
 > /* HERE */
 > 
 >           release_value (var->value);
 >           if (value_lazy (var->value))
 >             gdb_value_fetch_lazy (var->value);
 >         }
 >       else
 >         var->value = evaluate_type (var->root->exp);

I've tried to follow this suggestion in the patch below, which acts slightly
differently to the previous patch.  Itjust returns the actual value in the
value field instead of the address and value (which is what -stack-list-locals
does).  This is because the previously execution went through case
TYPE_CODE_REF in c-val-print, while now it goes through TYPE_CODE_INT say (for
a variable referencing an integer) because of the call to coerce_ref.  I'm
not sure which is preferable.

Now the change occurs earlier in varobj_create, I'm not sure what happens when
gdb_evaluate_expression returns 0 (or why it would return 0).

-- 
Nick                                           http://www.inet.net.nz/~nickrob


*** varobj.c	19 May 2006 11:37:28 +1200	1.60
--- varobj.c	21 May 2006 16:06:23 +1200	
*************** varobj_create (char *objname,
*** 502,513 ****
  	  select_frame (fi);
  	}
  
!       /* We definitively need to catch errors here.
           If evaluate_expression succeeds we got the value we wanted.
           But if it fails, we still go on with a call to evaluate_type()  */
        if (gdb_evaluate_expression (var->root->exp, &var->value))
  	{
  	  /* no error */
  	  release_value (var->value);
  	  if (value_lazy (var->value))
  	    gdb_value_fetch_lazy (var->value);
--- 502,514 ----
  	  select_frame (fi);
  	}
  
!       /* We definitely need to catch errors here.
           If evaluate_expression succeeds we got the value we wanted.
           But if it fails, we still go on with a call to evaluate_type()  */
        if (gdb_evaluate_expression (var->root->exp, &var->value))
  	{
  	  /* no error */
+ 	  var->value = coerce_ref (var->value);
  	  release_value (var->value);
  	  if (value_lazy (var->value))
  	    gdb_value_fetch_lazy (var->value);
*************** varobj_set_value (struct varobj *var, ch
*** 820,825 ****
--- 821,830 ----
        exp = parse_exp_1 (&s, 0, 0);
        if (!gdb_evaluate_expression (exp, &value))
  	{
+ 	  value = coerce_ref (value);
+ 	  if (value_lazy (value))
+ 	    gdb_value_fetch_lazy (value);
+ 
  	  /* We cannot proceed without a valid expression. */
  	  xfree (exp);
  	  return 0;
*************** c_value_of_root (struct varobj **var_han
*** 1898,1903 ****
--- 1903,1909 ----
           go on */
        if (gdb_evaluate_expression (var->root->exp, &new_val))
  	{
+ 	  new_val = coerce_ref (new_val);
  	  if (value_lazy (new_val))
  	    {
  	      /* We need to catch errors because if


  reply	other threads:[~2006-05-21  5:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-20  6:21 Nick Roberts
2006-05-20 16:34 ` Daniel Jacobowitz
2006-05-21  2:04   ` Nick Roberts
2006-05-21  5:22     ` Daniel Jacobowitz
2006-05-21 23:04       ` Nick Roberts [this message]
2006-05-25  0:21         ` Nick Roberts
2006-05-25  0:26           ` [patch] Fixes problem setting breakpoint in dynamic loader PAUL GILLIAM
2006-05-25  0:29             ` PAUL GILLIAM
  -- strict thread matches above, loose matches on Subject: below --
2006-05-03 23:05 Variable objects: references formatting Nick Roberts
2006-05-04  7:00 ` Vladimir Prus
2006-05-04  7:20   ` Nick Roberts
2006-05-04 12:10     ` Vladimir Prus
2006-05-08 12:41       ` [PATCH] -var-update [was Re: Variable objects: references formatting] Nick Roberts
2006-05-15 16:54         ` Daniel Jacobowitz
2006-05-17  0:45           ` Nick Roberts
2006-05-17  1:28             ` Daniel Jacobowitz
2006-05-17  1:43               ` Nick Roberts
2006-05-17  3:39                 ` Daniel Jacobowitz
2006-05-19  7:41                   ` [PATCH] -var-update Nick Roberts
2006-05-19  9:47                     ` Vladimir Prus

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=17519.63746.390090.274345@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    /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