Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Variable objects laziness
Date: Wed, 15 Nov 2006 02:45:00 -0000	[thread overview]
Message-ID: <17754.32341.141757.120973@kahikatea.snap.net.nz> (raw)


I'm having trouble to understand this patch.  If it does more than one thing
perhaps you can break it into two patches.

	* varobj.c (struct varobj): Clarify comment.
	(my_value_equal): Remove.
	(install_new_value): New.

New function presumably.

	(type_of_child): Remove.
	(varobj_create): Use install_new_value.
	(varobj_set_value): Use value_contents_equal, not
	my_value_equal.

Previously someone (Mark Kettenis?) has gone to a lot of trouble to replace
value_contents_equal with my_value_equal why do you think it's not needed?

	(varobj_update): Use install_new_value.
	(create_child): Likewise. Inline type_of_child here.
	(value_of_child): Don't fetch the value.
	(c_value_of_root): Likewise.
	(c_value_of_variable): Likewise.

Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.60
diff -u -p -r1.60 varobj.c
--- varobj.c	3 May 2006 22:59:38 -0000	1.60
+++ varobj.c	14 Nov 2006 13:38:35 -0000
@@ -101,7 +101,9 @@ struct varobj
   /* The type of this variable. This may NEVER be NULL. */
   struct type *type;
 
-  /* The value of this expression or subexpression.  This may be NULL. */
+  /* The value of this expression or subexpression.  This may be NULL. 
+     Invariant: if type_changeable (this) is non-zero, the value is either
+     NULL, or not lazy.  */


I don't understand the replacement comment

...

+/** Assign new value to a variable object.  If INITIAL is non-zero,
+    this is first assignement after the variable object was just
+    created, or changed type.  In that case, just assign the value 
+    and return 0.
+    Otherwise, assign the value and if type_changeable returns non-zero,
+    find if the new value is different from the current value.
+    Return 1 if so, and 0 is the values are equal.  */
+static int
+install_new_value (struct varobj *var, struct value *value, int initial)
+{ 

I don't understand this comment either.  INITIAL can be type_changed
i.e not really initial.  Can you give it more structure and not refer to
internals like type_changeable?

...

+  if (CPLUS_FAKE_CHILD (var))
+    changeable = 0;
+  else
+    changeable = type_changeable (var);

type_changeable returns 0 if CPLUS_FAKE_CHILD (var) is true anyway so do you
need this clause?

As a whole the patch seems to lack clarity (although that might partly be a
reflection on my abilities!)

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


             reply	other threads:[~2006-11-15  2:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-15  2:45 Nick Roberts [this message]
2006-11-15  9:22 ` Vladimir Prus
  -- strict thread matches above, loose matches on Subject: below --
2006-11-29  8:59 Nick Roberts
2006-11-29  2:08 ` Nick Roberts
2006-11-29  2:55   ` Daniel Jacobowitz
2006-11-29  4:14     ` Nick Roberts
2006-11-29  7:25   ` Vladimir Prus
2006-11-29 13:45     ` Daniel Jacobowitz
2006-11-29 13:56       ` Vladimir Prus
2006-11-29 20:25       ` Nick Roberts
2006-11-29  9:09 ` Vladimir Prus
2006-11-14 13:43 Vladimir Prus
2006-11-14 20:47 ` Daniel Jacobowitz
2006-11-15  9:04   ` Vladimir Prus
2006-11-15 16:25     ` Daniel Jacobowitz
2006-11-17  9:23       ` Vladimir Prus
2006-11-17 10:40         ` Mark Kettenis
2006-11-17 10:45           ` Vladimir Prus
2006-11-17 14:22             ` Daniel Jacobowitz
2006-11-17 15:01               ` Vladimir Prus
2006-11-17 17:19                 ` Vladimir Prus
2006-11-17 18:12                   ` Daniel Jacobowitz
2006-11-18  9:48                     ` Vladimir Prus
2006-11-28 17:09                       ` Daniel Jacobowitz
2006-12-04 19:27                         ` 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=17754.32341.141757.120973@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vladimir@codesourcery.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