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: gdb-patches@sources.redhat.com,
Subject: Re: [PATCH] -var-update
Date: Fri, 19 May 2006 07:41:00 -0000	[thread overview]
Message-ID: <17517.21363.892697.745703@kahikatea.snap.net.nz> (raw)
In-Reply-To: <20060517014309.GA20934@nevyn.them.org>

 > I do not quite understand why coerce_array is used; I suspect the
 > contents of an array are checked via the children instead of the
 > parent.  coerce_array happens to also call coerce_ref.

Maybe it's historical, as varobj_update used value_equal previously and this
uses coerce_array.

Anyway here's a patch that actually seems to work.  I've taken code from
c_val_print.  Maybe there should be more checks and I've not tested
varobj_set_value (-var-assign) yet, but I thought I'd sound out the genaral
approcah first.

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


*** varobj.c	19 May 2006 11:37:28 +1200	1.60
--- varobj.c	19 May 2006 16:27:29 +1200	
*************** varobj_create (char *objname,
*** 517,522 ****
--- 517,532 ----
  
        var->type = value_type (var->value);
  
+       if (TYPE_CODE (var->type) == TYPE_CODE_REF)
+ 	{
+ 	  var->value = value_at (TYPE_TARGET_TYPE (var->type),
+ 				 unpack_pointer
+ 				 (lookup_pointer_type (builtin_type_void),
+ 				  value_contents_all (var->value)
+ 				  + value_embedded_offset (var->value)));
+ 	  release_value (var->value);
+ 	}
+ 
        /* Set language info */
        lang = variable_language (var);
        var->root->lang = languages[lang];
*************** varobj_set_value (struct varobj *var, ch
*** 825,830 ****
--- 835,847 ----
  	  return 0;
  	}
  
+       if (TYPE_CODE (var->type) == TYPE_CODE_REF)
+ 	value = value_at (TYPE_TARGET_TYPE (var->type),
+ 			  unpack_pointer
+ 			  (lookup_pointer_type (builtin_type_void),
+ 			   value_contents_all (value)
+ 			   + value_embedded_offset (value)));
+ 
        if (!my_value_equal (var->value, value, &error))
          var->updated = 1;
        if (!gdb_value_assign (var->value, value, &val))
*************** c_value_of_root (struct varobj **var_han
*** 1915,1920 ****
--- 1932,1944 ----
        else
  	var->error = 1;
  
+       if (TYPE_CODE (var->type) == TYPE_CODE_REF)
+ 	new_val = value_at (TYPE_TARGET_TYPE (var->type),
+ 			    unpack_pointer
+ 			    (lookup_pointer_type (builtin_type_void),
+ 			     value_contents_all (new_val)
+ 			     + value_embedded_offset (new_val)));
+ 
        release_value (new_val);
        return new_val;
      }


  reply	other threads:[~2006-05-19  5:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-03 23:05 Variable objects: references formatting Nick Roberts
2006-05-03 23:50 ` Jim Blandy
2006-05-04  1:53   ` Nick Roberts
2006-05-04 17:32     ` Jim Blandy
2006-05-04 22:30       ` Nick Roberts
2006-05-05  8:08         ` Jim Blandy
2006-05-04  5:30 ` Vladimir Prus
2006-05-04  6:21   ` 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-08 17:27             ` Jim Blandy
2006-05-08 21:17               ` 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                       ` Nick Roberts [this message]
2006-05-19  9:47                         ` [PATCH] -var-update Vladimir Prus
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
2006-05-25  0:21         ` Nick Roberts

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=17517.21363.892697.745703@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.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