public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
* [python] lazily fetch varobj children
@ 2009-07-09 16:25 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2009-07-09 16:25 UTC (permalink / raw)
  To: Project Archer

I'm checking this in on the python branch.

This changes the varobj code to lazily fetch dynamic children if a
child range has been selected.

This will yield some funny results.  For one thing it means the child
count of a varobj cannot be relied on -- it may change if you ask for
more children.  Perhaps we should add a "dynamic" flag to the varobj
output; this seems like something to discuss upstream.

Also, this change means that a well-behaved printer should not eagerly
fetch children.  Some of the existing printers do this to compute the
string form of a container.  I'll fix that, but only after some of
this goes upstream.

Tom

2009-07-09  Tom Tromey  <tromey@redhat.com>

	* varobj.c (update_dynamic_varobj_children): Terminate loop early
	if a child range is selected.

diff --git a/gdb/varobj.c b/gdb/varobj.c
index d068a6e..1412d43 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -879,7 +879,7 @@ update_dynamic_varobj_children (struct varobj *var,
     }
   make_cleanup_py_decref (iterator);
 
-  for (i = 0; ; ++i)
+  for (i = 0; var->to < 0 || i < var->to; ++i)
     {
       PyObject *item = PyIter_Next (iterator);
       PyObject *py_v;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-09 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 16:25 [python] lazily fetch varobj children Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).